From aa706b41aba93656194347be6cddd9601a286925 Mon Sep 17 00:00:00 2001 From: "Mark W. Eichin" Date: Fri, 24 Apr 2009 04:17:51 +0000 Subject: test ZGetDestAddr --- lib/zephyr_tests.py | 3 +++ lib/zephyr_tests.txt | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/zephyr_tests.py b/lib/zephyr_tests.py index bfd2901..043ed2b 100755 --- a/lib/zephyr_tests.py +++ b/lib/zephyr_tests.py @@ -339,6 +339,7 @@ class libZephyr(object): "ZClosePort", "ZMakeAscii", "ZMakeZcode", + "ZGetDestAddr", ] def __init__(self, library_path=None): """connect to the library and build the wrappers""" @@ -480,6 +481,8 @@ class libZephyr(object): c_int, # num ] + # struct sockaddr_in ZGetDestAddr (void) { + self.ZGetDestAddr.restype = sockaddr_in # library-specific setup... self.ZInitialize() diff --git a/lib/zephyr_tests.txt b/lib/zephyr_tests.txt index 8bd5e0b..906399a 100644 --- a/lib/zephyr_tests.txt +++ b/lib/zephyr_tests.txt @@ -177,14 +177,18 @@ Trivial test of ZOpenPort and ZClosePort: >>> assert st == 0 >>> assert _z.ZGetFD() != -1 >>> assert port != 0 + >>> zephyr_tests.ctypes_pprint(_z.ZGetDestAddr()) + ... # doctest: +ELLIPSIS + sin_family AF_INET(2) + sin_port ... + sin_addr 127.0.0.1 + sin_zero [ignored] TODO: consider checking that ZGetFD is returning a socket on that port. >>> assert _z.ZClosePort() == 0 >>> assert _z.ZGetFD() == -1 -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. -- cgit v1.2.3