diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/programs/memdebug_interior.expected | 1 | ||||
| -rw-r--r-- | tests/programs/memdebug_interior.zc | 18 | ||||
| -rwxr-xr-x | tests/test.sh | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/programs/memdebug_interior.expected b/tests/programs/memdebug_interior.expected new file mode 100644 index 0000000..580692a --- /dev/null +++ b/tests/programs/memdebug_interior.expected @@ -0,0 +1 @@ +7 3 2 diff --git a/tests/programs/memdebug_interior.zc b/tests/programs/memdebug_interior.zc new file mode 100644 index 0000000..8464f2c --- /dev/null +++ b/tests/programs/memdebug_interior.zc @@ -0,0 +1,18 @@ +namespace; +include rt; + +// memdebug finds the block of an interior pointer however deep it is: buf[255] +// of a 256-word block is 255 words past its header, beyond the old 64-word scan. +memdebug on; +fn main() { + let buf = rt.new(256), small = rt.new(4); + buf[255] = 7; + buf[100] = 3; + small[3] = 2; + rt.put_n(buf[255]); rt.put_c(32); + rt.put_n(buf[100]); rt.put_c(32); + rt.put_n(small[3]); rt.put_c(10); + rt.free(small); + rt.free(buf); + return 0; +} diff --git a/tests/test.sh b/tests/test.sh index a1a5453..16abf91 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -188,6 +188,7 @@ ABC" "$l o3 lifts byte loads and stores" chk "$($vm < tests/programs/strings.zc)" "hi! 3 3 104 i! 1 1 1 -42 42 -42 11 1 -9223372036854775808 0 1 3 10 1 1 1 W ab" "$l byte strings" chk "$($vm < tests/programs/share.zc)" "1 2 1 4 1 1 1 1 42 1 1 1 6 0" "$l shared cons cells" chk "$($vm < tests/programs/share_dbg.zc)" "7 1" "$l memdebug accepts a shared cell" + chk "$($vm < tests/programs/memdebug_interior.zc | md5sum)" "$(md5sum < tests/programs/memdebug_interior.expected)" "$l memdebug finds the block of a deep interior pointer" chk "$($vm < tests/programs/global_transfer.zc)" "5 9" "$l an m or u owner stored in a global is transferred" chk "$($vm < tests/programs/closure_result.zc)" "8 1.500000" "$l a closure with a declared result type" chk "$($vm < examples/strings.zc)" "hello, zc |
