[z-machine] Z-machine Regression tests, Order of strings in high memory

Amir Karger amirkargerweb@yahoo.com
Thu, 25 Sep 2003 07:34:50 -0700 (PDT)


Hi.

I'm working on the Z-machine regression tests. I'm up to 181 tests so
far, testing about 50 opcodes. (In a perfect world, I would write tests
for all the opcodes before doing any testing. You can stop laughing
now.) Of course there's LOTS more to test even for these opcodes:
Unicode char printing, @load [sp] and lots of other things, but it's a
start.

Btw, Dzip gets a couple tests wrong due to signed/unsigned problems,
and rezrov does too (Rezrov then dies due to unimplemented codes).
Frotz agrees with all 181, though, so I *think* that means my tests are
right.

The real reason I'm writing, though, is to ask about how to test
print_paddr. My plan was to put 'print "A long string testing
print_paddr..."' in a sub right at the beginning of the program, which
- if I'm guessing correctly - Inform would turn into the first string
(aka s001) in high memory. Then I could do "@load $2a sp; @print_paddr
sp;" The problem, of course, is that according to the spec, $2a doesn't
exist in version 5. So am I correct in thinking that there's no real
way to guarantee an exact address in high memory where a string will
appear? If so, how to test print_paddr? Obviously the test program
can't use @storew to write a string into high memory.

Idea! Maybe I could put the string at the END of the program, and count
backwards the number of bytes that the string is long (times 2/3) from
file size * 4. True, that'll make the test version-specific, but that's
OK: using particular opcodes already does that, and in the long run,
it's probably worth creating a z3, z5, z6, and z8 version of the test
program.

Another idea would be to write to an array in low memory and then fake
the packed address to actually read from low memory. A really strict
interpreter would die, though, telling me that print_paddr only works
on high memory, right? That hardly makes a good test, then.

Thoughts?

-Amir

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com