# HG changeset patch # User Tassilo Philipp # Date 1612775727 -3600 # Node ID e4bf6e44fbf5c52467382ff0cb494d0253fb00ba # Parent 80b11152c6591c734c03c34b3fc0ac5a780f1a15 fixes to test code diff -r 80b11152c659 -r e4bf6e44fbf5 python/pydc/test/types.py --- a/python/pydc/test/types.py Mon Feb 08 09:58:25 2021 +0100 +++ b/python/pydc/test/types.py Mon Feb 08 10:15:27 2021 +0100 @@ -24,8 +24,8 @@ fp = pydc.find(lib, c_fsym) r = pydc.call(fp, dcsig, *args) rt = type(r).__name__ - if(r != exp_ret or args != post_args): - if((type(exp_ret) is types.LambdaType) and exp_ret(r) == False): + if(r != exp_ret or args != post_args): # @@@ type test also or type(r) is not type(exp_ret)): + if((type(exp_ret) is not types.LambdaType) or exp_ret(r) == False): err_sgr = '\033[41m' except: r = '[EXCEPTION]' @@ -66,7 +66,7 @@ t(libc, ")v", "void", "sranddev", "(void)", '') # int() - t(libc, ")i", "int", "rand", "(void)", '') + t(libc, ")i", "int", "rand", "(void)", '', r=lambda i: type(i) is int) # void(unsigned int) t(libc, "I)v", "void", "srand", "(int)", '', i=(123,)) @@ -144,7 +144,7 @@ t(l, "Z)Z", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => "Y"', i=(bytearray(b'xY'),), r= 'Y') # bytearray object t(l, "p)Z", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => "Y"', i=(bytearray(b'xY'),), r='Y') # bytearray object -t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => p+1 (~ odd addr)', i=(bytearray(b'xY'),), r='??') # bytearray object +t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => p+1 (~ odd addr)', i=(bytearray(b'xY'),), r=lambda i: type(i) is int and (i%2)==1) # bytearray object t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' 0xdeadc0de => 0xdeadc0de+1=3735929055', i=(long_h,), r=3735929055) # handle (integer interpreted as ptr) t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' 0xdeadc0de => 0xdeadc0de+1=3735929055', i=(long_h,), r=3735929055) # handle (integer interpreted as ptr, long in Python 2) t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' NULL => NULL+1=1', i=( None,), r=1) # NULL, adding one will result in 0x1