* * * * * Unit testing from inside an assembler, part V I've made some major changes to my 6809 assembler [1], mostly to how the unit testing works. The first change was to assemble the test code elsewhere far in memory from the code being tested (there's a default value that can be changed via an .OPT directive). This separation makes it easier to keep the test code out of the final assembled artifact. The next change was to remove the “unit test feature” as a distinct output type and make it work the rest of the output formats (like the flat binary format, the Color Computer executable format, or the Motorola SREC format [2]). But aside from the internal changes, no changes were required of any existing 6809 assembly code with tests. And I didn't have to resort to embedding Lua to run the tests. I consider that a success. Less successful were the multiple attempts to come up with a table driven format [3] to describe tests that wasted most of the time I spent on this so far. I did devise a format I liked: -----[ Assembly ]----- .test "atod" .case atod /x := zero /d = 0 , 'zero' .case atod /x := nine /d = 9 , 'nine' .case atod /x := dechalf /d = 3276 , 'half' .case atod /x := decfull /d = 65535 , 'full' .case atod /x := none /d = 0 , 'none' zero ascii "0"z nine ascii "9"z dechalf ascii "3276"z decfull ascii "65535"z none ascii ""z .endtst -----[ END OF LINE ]----- which would replace: -----[ Assembly ]----- .test "atod" ldx #zero jsr atod .assert /d = 0 , 'zero' ldx #nine jsr atod .assert /d = 9 , 'nine' ldx #dechalf jsr atod .assert /d = 3276 , 'half' ldx #decfull jsr atod .assert /d = 65535 , 'full' ldx #none jsr atod .assert /d = 0 , 'none' rts .endtst -----[ END OF LINE ]----- Input parameters would be marked by the assignment operator “:=” so it would be “easy” to distinguish pre-initializations with post-checks, but the word “easy” is carry a lot of weight there. Any more inputs or outputs would stretch the line out, and given that I don't support line continuations with a “\” and have a hard line length limit, never mind the mini-Forth engine [4] that handles the .ASSERT directives doesn't support assignment and is “attached” to the 6809 emulator hitting a particular address and … yeah … I see a lot of work ahead of me if I want to support this format. More thinking is required. [1] https://github.com/spc476/a09 [2] https://en.wikipedia.org/wiki/SREC_(file_format) [3] gopher://gopher.conman.org/0Phlog:2024/10/13.2 [4] gopher://gopher.conman.org/0Phlog:2023/12/01.1 Email author at sean@conman.org .