summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Mark W. Eichin <eichin@thok.org>2009-04-16 22:44:58 +0000
committerGravatar Mark W. Eichin <eichin@thok.org>2009-04-16 22:44:58 +0000
commit59fef1f71ec4a1fddbae282fa11fd2b5e829b084 (patch)
treeb2eacbc304c3494f49a1b1530be5bd13b474c588 /lib
parent0aea3fbd83491c5a57e98d18ebe682505b0978f4 (diff)
show what ZMakeAscii actually *does*
Diffstat (limited to 'lib')
-rw-r--r--lib/zephyr_tests.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/zephyr_tests.txt b/lib/zephyr_tests.txt
index a6e7998..f5b40a8 100644
--- a/lib/zephyr_tests.txt
+++ b/lib/zephyr_tests.txt
@@ -103,6 +103,9 @@ TODO: check that ZGetDestAddr points somewhere, too.
ZMakeAscii takes a target buffer and length and an input buffer and
length, and generates the "special" Zephyr encoding.
+TODO: use the "reference" implementation to run a bunch of
+random-value comparison tests.
+
>>> sample = "test\0message"
>>> ref = zephyr_tests.py_make_ascii(sample)
>>> from ctypes import create_string_buffer
@@ -112,6 +115,21 @@ length, and generates the "special" Zephyr encoding.
>>> assert st == 0
>>> assert outbuf.value == ref, "%r != %r" % (outbuf.value, ref)
+A few simple string tests:
+ >>> def zma(sample):
+ ... outlen = len(sample) * 6
+ ... outbuf = create_string_buffer(outlen)
+ ... st = _z.ZMakeAscii(outbuf, outlen, sample, len(sample))
+ ... assert st == 0
+ ... return outbuf.value
+ >>> zma("")
+ ''
+ >>> zma("j")
+ '0x6A'
+ >>> zma("jK")
+ '0x6A4B'
+ >>> zma("jK__\0")
+ '0x6A4B5F5F 0x00'
Coverage: