Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Try to refactor test engine into a separate module; however, it does not work nearly as well as I would like. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
0be7136182eeb953569aeb01f3883c66 |
| User & Date: | kc5tja 2019-08-23 06:54:59.212 |
Context
|
2019-08-24
| ||
| 21:27 | Remove parser; started on wrong foot. Starting over check-in: de174e1877 user: kc5tja tags: trunk | |
|
2019-08-23
| ||
| 06:54 | Try to refactor test engine into a separate module; however, it does not work nearly as well as I would like. check-in: 0be7136182 user: kc5tja tags: trunk | |
|
2019-08-21
| ||
| 22:27 | prepare to work on parser next check-in: ffc86e1698 user: kc5tja tags: trunk | |
Changes
Added dev/src/bcpl/assemrv/bud.b.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
/**************************************************************
*
* BCPL Unit-Test Driver -- AssemRV's Standard Unit Test Engine
*
**************************************************************/
SECTION "BUD"
GET "libhdr"
GET "bud_manifest"
GET "bud_globals"
GET "manifest"
LET start() = VALOF {
LET result1, tl = 0, testlist()
testid := -1
FOR i = 1 TO tl!0 DO result1 := (tl!i)(result1)
TEST result1
THEN writef("*nFAILED testid := %s*n*n", testid)
ELSE writef("*nPASSED*n*n")
// If needed, each test procedure sets the result2 global.
RESULTIS result1
}
AND EQ(actual, expected, field) = VALOF {
UNLESS actual = expected DO {
writef("FAILED: Expected value #x%16x (%n); got value #x%16x (%n)*n", expected, expected, actual, actual)
result2 := err_field + field
}
RESULTIS actual = expected
}
AND NEQ(actual, expected, field) = VALOF {
IF actual = expected DO {
writef("FAILED: Did NOT expect value #x%16x (%n) ", expected, expected)
result2 := err_field + field
}
RESULTIS actual ~= expected
}
|
Added dev/src/bcpl/assemrv/bud_globals.h.
> > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
/**************************************************************
*
* BCPL Unit-Test Driver -- AssemRV's Standard Unit Test Engine
*
**************************************************************/
GLOBAL {
testid: g_bud_base;
testlist;
EQ;
NEQ;
}
|
Added dev/src/bcpl/assemrv/bud_manifest.h.
> > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 |
/**************************************************************
*
* BCPL Unit-Test Driver -- AssemRV's Standard Unit Test Engine
*
**************************************************************/
MANIFEST {
g_bud_base = ug;
}
|
Changes to dev/src/bcpl/assemrv/manifest.h.
1 2 3 4 5 6 |
MANIFEST {
// By default, we want failed unit tests to die with CLI result 20.
// This might one day be a parameter.
failat = 20;
// These are stuffed into result2 to give the developer a crude
| | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
MANIFEST {
// By default, we want failed unit tests to die with CLI result 20.
// This might one day be a parameter.
failat = 20;
// These are stuffed into result2 to give the developer a crude
// indication of why a test failed. Ideally, these should be
// taken from standard BCPL/Tripos error result codes as much as
// possible. For now, though, they're proprietary.
err_no_memory = 1;
err_overflow = 2;
err_field = 50000; // Record field (n - err_field) not of expected value
// Hunk format executables use these constants.
HUNK_END = 3000;
HUNK_CODE;
// Global Vector Constants
g_sections = ug + 200;
g_parser = g_sections + 100;
// Section record fields
s_lc = 0; // "Location Counter"; traditionally referred to as LC.
s_largest_global;
s_bufsize;
s_buf;
s_globinits;
|
| ︙ | ︙ |
Added dev/src/bcpl/assemrv/parser.b.
> > > > > > | 1 2 3 4 5 6 |
GET "libhdr"
GLOBAL { foo: ug+1 }
LET foo() = 0
|
Changes to dev/src/bcpl/assemrv/runtests.
1 2 3 4 5 | cintsys64 -c <<endcli failat 20 bcpl from test_sections.b to test_sections test_sections endcli | > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | set -e echo ====== Sections ====== cintsys64 -c <<endcli failat 20 bcpl from test_sections.b to test_sections test_sections endcli echo ====== Parser ====== cintsys64 -c <<endcli failat 20 bcpl from test_parser.b to test_parser test_parser endcli |
Added dev/src/bcpl/assemrv/test_parser.b.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
GET "bud.b"
.
GET "parser.b"
.
SECTION "test_parser"
GET "libhdr"
GET "manifest"
GET "globals"
GET "bud_manifest"
GET "bud_globals"
LET testlist() = VALOF {
MANIFEST { ntests = 1 }
LET tl = getvec(ntests)
tl!0 := ntests
tl!1 := test_hello
RESULTIS tl
}
AND test_hello(r) = VALOF {
writef("Hello test world*n")
RESULTIS r
}
|
Changes to dev/src/bcpl/assemrv/test_sections.b.
|
| | | | | | | < | < | | | | | | | | | | < < < < < < | < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
GET "bud.b"
.
GET "sections.b"
.
SECTION "test_sections"
GET "libhdr"
GET "manifest"
GET "globals"
GET "bud_manifest"
GET "bud_globals"
LET testlist() = VALOF {
MANIFEST { ntests = 6 }
LET tl = getvec(ntests)
tl!0 := ntests
tl!1 := test_new_section
tl!2 := test_emit_new_section
tl!3 := test_emit_byte
tl!4 := test_emit_hword_and_2byte
tl!5 := test_globinit
tl!6 := test_duplicate_globinit
RESULTIS tl
}
// Section Tests: Creation
AND test_new_section(r) = VALOF {
LET err, s = failat, ?
IF r DO RESULTIS r
|
| ︙ | ︙ |