|
@ -172,8 +172,8 @@ def test_func_pppPc_args_pppPc_ppPc(): |
|
|
def test_func__PS_args_V(): |
|
|
def test_func__PS_args_V(): |
|
|
(ret,) = func__PS_args_V() |
|
|
(ret,) = func__PS_args_V() |
|
|
print(PS_to_string(ret)) |
|
|
print(PS_to_string(ret)) |
|
|
assert(ret.field__P_1 == 23); |
|
|
assert(ret.field__P_1 == 23) |
|
|
assert(ret.field__P_2 == 23); |
|
|
assert(ret.field__P_2 == 23) |
|
|
|
|
|
|
|
|
def test_func__PS_args__PS(): |
|
|
def test_func__PS_args__PS(): |
|
|
ps = lib_test._PS() |
|
|
ps = lib_test._PS() |
|
@ -182,16 +182,16 @@ def test_func__PS_args__PS(): |
|
|
(ret,psout) = func__PS_args__PS(ps) |
|
|
(ret,psout) = func__PS_args__PS(ps) |
|
|
print("ret:",PS_to_string(ret)) |
|
|
print("ret:",PS_to_string(ret)) |
|
|
print("psout:",PS_to_string(psout)) |
|
|
print("psout:",PS_to_string(psout)) |
|
|
assert(ret.field__P_1 == 23); |
|
|
assert(ret.field__P_1 == 23) |
|
|
assert(ret.field__P_2 == 23); |
|
|
assert(ret.field__P_2 == 23) |
|
|
assert(psout.field__P_1 == 3); |
|
|
assert(psout.field__P_1 == 3) |
|
|
assert(psout.field__P_2 == 3); |
|
|
assert(psout.field__P_2 == 3) |
|
|
|
|
|
|
|
|
def test_func_TTAPS_args_V(): |
|
|
def test_func_TTAPS_args_V(): |
|
|
(ret,) = func_TTAPS_args_V() |
|
|
(ret,) = func_TTAPS_args_V() |
|
|
print(PS_to_string(ret)) |
|
|
print(PS_to_string(ret)) |
|
|
assert(ret.field__P_1 == 23); |
|
|
assert(ret.field__P_1 == 23) |
|
|
assert(ret.field__P_2 == 23); |
|
|
assert(ret.field__P_2 == 23) |
|
|
|
|
|
|
|
|
def test_func_TTAPS_args_TTAPS(): |
|
|
def test_func_TTAPS_args_TTAPS(): |
|
|
ps = PS() |
|
|
ps = PS() |
|
@ -200,56 +200,127 @@ def test_func_TTAPS_args_TTAPS(): |
|
|
(ret,psout) = func_TTAPS_args_TTAPS(ps) |
|
|
(ret,psout) = func_TTAPS_args_TTAPS(ps) |
|
|
print("ret:",PS_to_string(ret)) |
|
|
print("ret:",PS_to_string(ret)) |
|
|
print("psout:",PS_to_string(psout)) |
|
|
print("psout:",PS_to_string(psout)) |
|
|
assert(ret.field__P_1 == 23); |
|
|
assert(ret.field__P_1 == 23) |
|
|
assert(ret.field__P_2 == 23); |
|
|
assert(ret.field__P_2 == 23) |
|
|
assert(psout.field__P_1 == 3); |
|
|
assert(psout.field__P_1 == 3) |
|
|
assert(psout.field__P_2 == 3); |
|
|
assert(psout.field__P_2 == 3) |
|
|
|
|
|
|
|
|
# // By pointer |
|
|
# // By pointer |
|
|
def test_func_pTAPS_args_V(): |
|
|
def test_func_pTAPS_args_V(): |
|
|
(ret,) = func_pTAPS_args_V() |
|
|
(ret,) = func_pTAPS_args_V() |
|
|
print(PS_to_string(ret)) |
|
|
print(PS_to_string(ret)) |
|
|
assert(ret.field__P_1 == 23); |
|
|
assert(ret.field__P_1 == 23) |
|
|
assert(ret.field__P_2 == 23); |
|
|
assert(ret.field__P_2 == 23) |
|
|
|
|
|
|
|
|
def test_func_ppTAPS_args_V(): |
|
|
def test_func_ppTAPS_args_V(): |
|
|
(ret,) = func_ppTAPS_args_V() |
|
|
(ret,) = func_ppTAPS_args_V() |
|
|
print(PS_to_string(ret)) |
|
|
print(PS_to_string(ret)) |
|
|
assert(ret.field__P_1 == 23); |
|
|
assert(ret.field__P_1 == 23) |
|
|
assert(ret.field__P_2 == 23); |
|
|
assert(ret.field__P_2 == 23) |
|
|
|
|
|
|
|
|
def test_func_pppTAPS_args_V(): |
|
|
def test_func_pppTAPS_args_V(): |
|
|
(ret,) = func_ppTAPS_args_V() |
|
|
(ret,) = func_ppTAPS_args_V() |
|
|
print(PS_to_string(ret)) |
|
|
print(PS_to_string(ret)) |
|
|
assert(ret.field__P_1 == 23); |
|
|
assert(ret.field__P_1 == 23) |
|
|
assert(ret.field__P_2 == 23); |
|
|
assert(ret.field__P_2 == 23) |
|
|
|
|
|
|
|
|
def test_func_V_args_pTAPS(): |
|
|
def test_func_V_args_pTAPS(): |
|
|
ps = PS() |
|
|
ps = PS() |
|
|
print(PS_to_string(ps)) |
|
|
print(PS_to_string(ps)) |
|
|
(ret,psnew) = func_V_args_pTAPS(ps) |
|
|
(ret,psnew) = func_V_args_pTAPS(ps) |
|
|
print(PS_to_string(psnew)) |
|
|
print(PS_to_string(psnew)) |
|
|
assert(ret == None); |
|
|
assert(ret == None) |
|
|
assert(psnew.field__P_1 == 23); |
|
|
assert(psnew.field__P_1 == 23) |
|
|
assert(psnew.field__P_2 == 23); |
|
|
assert(psnew.field__P_2 == 23) |
|
|
|
|
|
|
|
|
def test_func_ppTAPS_args_ppTAPS(): |
|
|
def test_func_ppTAPS_args_ppTAPS(): |
|
|
ps = PS() |
|
|
ps = PS() |
|
|
print(PS_to_string(ps)) |
|
|
print(PS_to_string(ps)) |
|
|
(ret,inout) = func_ppTAPS_args_ppTAPS(ps) |
|
|
(ret,inout) = func_ppTAPS_args_ppTAPS(ps) |
|
|
print(PS_to_string(ret)) |
|
|
print(PS_to_string(ret)) |
|
|
assert(ret.field__P_1 == 23); |
|
|
assert(ret.field__P_1 == 23) |
|
|
assert(inout.field__P_1 == 23); |
|
|
assert(inout.field__P_1 == 23) |
|
|
assert(inout.field__P_2 == 23); |
|
|
assert(inout.field__P_2 == 23) |
|
|
|
|
|
|
|
|
def test_func_pppTAPS_args_pppTAPS(): |
|
|
def test_func_pppTAPS_args_pppTAPS(): |
|
|
ps = PS() |
|
|
ps = PS() |
|
|
print(PS_to_string(ps)) |
|
|
print(PS_to_string(ps)) |
|
|
(ret,inout) = func_pppTAPS_args_pppTAPS(ps) |
|
|
(ret,inout) = func_pppTAPS_args_pppTAPS(ps) |
|
|
print(PS_to_string(ret)) |
|
|
print(PS_to_string(ret)) |
|
|
assert(ret.field__P_1 == 23); |
|
|
assert(ret.field__P_1 == 23) |
|
|
assert(inout.field__P_1 == 23); |
|
|
assert(inout.field__P_1 == 23) |
|
|
assert(inout.field__P_2 == 23); |
|
|
assert(inout.field__P_2 == 23) |
|
|
|
|
|
|
|
|
|
|
|
# // PSa - Primitive Structs containing array |
|
|
|
|
|
# // PSa contains a char[4] (which is an array of bytes, NOT a string) |
|
|
|
|
|
# // By value |
|
|
|
|
|
def test_func_TTAPSa_args_V(): |
|
|
|
|
|
(ret,) = func_TTAPSa_args_V() |
|
|
|
|
|
assert(ret.field__Pa_1 == b"pEp\x00") |
|
|
|
|
|
|
|
|
|
|
|
def test_func_TTAPSa_args_TTAPSa(): |
|
|
|
|
|
psa = PSa() |
|
|
|
|
|
psa.field__Pa_1 = b'pEp' |
|
|
|
|
|
(ret,inout) = func_TTAPSa_args_TTAPSa(psa) |
|
|
|
|
|
assert(ret.field__Pa_1 == b'pEp\x00') |
|
|
|
|
|
assert(inout.field__Pa_1 == b'pEp\x00') |
|
|
|
|
|
|
|
|
|
|
|
# // By pointer |
|
|
|
|
|
def test_func_V_args_pTTAPSa(): |
|
|
|
|
|
psa = PSa() |
|
|
|
|
|
(ret,inout) = func_V_args_pTTAPSa(psa) |
|
|
|
|
|
assert(ret == None) |
|
|
|
|
|
assert(inout.field__Pa_1 == b'pEp\x00') |
|
|
|
|
|
|
|
|
|
|
|
def test_func_ppTTAPSa_args_ppTTAPSa(): |
|
|
|
|
|
psa = PSa() |
|
|
|
|
|
(ret,inout) = func_ppTTAPSa_args_ppTTAPSa(psa) |
|
|
|
|
|
assert(ret.field__Pa_1 == b'pEp\x00') |
|
|
|
|
|
assert(inout.field__Pa_1 == b'pEp\x00') |
|
|
|
|
|
|
|
|
|
|
|
def test_func_pppTTAPSa_args_pppTTAPSa(): |
|
|
|
|
|
psa = PSa() |
|
|
|
|
|
(ret,inout) = func_pppTTAPSa_args_pppTTAPSa(psa) |
|
|
|
|
|
assert(ret.field__Pa_1 == b'pEp\x00') |
|
|
|
|
|
assert(inout.field__Pa_1 == b'pEp\x00') |
|
|
|
|
|
|
|
|
|
|
|
def test_struct_field_array_of_char_get_set(): |
|
|
|
|
|
a = PSa() |
|
|
|
|
|
a.field__Pa_1 = b'' |
|
|
|
|
|
assert(a.field__Pa_1 == b'\x00\x00\x00\x00') |
|
|
|
|
|
assert(len(a.field__Pa_1) == 4 ) |
|
|
|
|
|
a.field__Pa_1 = b'pEp' |
|
|
|
|
|
assert(a.field__Pa_1 == b'pEp\x00') |
|
|
|
|
|
assert(len(a.field__Pa_1) == 4 ) |
|
|
|
|
|
a.field__Pa_1 = b'pEpTooLong' |
|
|
|
|
|
assert(a.field__Pa_1 == b'pEpT') |
|
|
|
|
|
assert(len(a.field__Pa_1) == 4 ) |
|
|
|
|
|
a.field__Pa_1 = b'p' |
|
|
|
|
|
assert(a.field__Pa_1 == b'p\x00\x00\x00') |
|
|
|
|
|
assert(len(a.field__Pa_1) == 4 ) |
|
|
|
|
|
|
|
|
|
|
|
# // CS - Complex Structs containing array |
|
|
|
|
|
# // CS contains a PS[3] (which is an array of structs) |
|
|
|
|
|
# // By value |
|
|
|
|
|
# TACS func_TACS_args_V(); // MISSING |
|
|
|
|
|
# |
|
|
|
|
|
# TACS func_TACS_args_TACS(TACS arg1_TACS); // MISSING |
|
|
|
|
|
# |
|
|
|
|
|
# // By pointer |
|
|
|
|
|
# void func_V_args_pTACS(TACS* arg1_pTACS); // MISSING |
|
|
|
|
|
# |
|
|
|
|
|
# TACS** func_ppTACS_args_ppTACS(TACS** arg1_ppTACS); // MISSING |
|
|
|
|
|
# |
|
|
|
|
|
# TACS*** func_pppTACS_args_pppTACS(TACS*** arg1_pppTACS); // MISSING |
|
|
|
|
|
|
|
|
|
|
|
def test_struct_field_array_of_structs_set_get(): |
|
|
|
|
|
a = CS() |
|
|
|
|
|
b = PS() |
|
|
|
|
|
b.field__P_1 = 23 |
|
|
|
|
|
b.field__P_2 = 23 |
|
|
|
|
|
a.field_APS_1 = [b] |
|
|
|
|
|
assert(a.field_APS_1[0].field__P_1 == 23) |
|
|
|
|
|
assert(a.field_APS_1[0].field__P_2 == 23) |
|
|
|
|
|
|
|
|
def test_struct_field_array_of_structs_immutable_len(): |
|
|
def test_struct_field_array_of_structs_immutable_len(): |
|
|
a = CS() |
|
|
a = CS() |
|
@ -271,18 +342,9 @@ def test_struct_field_array_of_structs_accept_unityped_arr_only(): |
|
|
with pytest.raises(Exception): |
|
|
with pytest.raises(Exception): |
|
|
a.field_APS_1 = [b,"invalid_type"] |
|
|
a.field_APS_1 = [b,"invalid_type"] |
|
|
|
|
|
|
|
|
def test_struct_field_array_of_structs_of_structs_set_get(): |
|
|
|
|
|
a = CS() |
|
|
|
|
|
b = PS() |
|
|
|
|
|
b.field__P_1 = 23 |
|
|
|
|
|
b.field__P_2 = 23 |
|
|
|
|
|
a.field_APS_1 = [b] |
|
|
|
|
|
assert(a.field_APS_1[0].field__P_1 == 23) |
|
|
|
|
|
assert(a.field_APS_1[0].field__P_2 == 23) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def PS_to_string(ps): |
|
|
def PS_to_string(ps): |
|
|
ret = "{}\n".format(type(ps)) |
|
|
ret = "{}\n".format(type(ps)) |
|
|
ret += "field__P_1: {}\n".format(ps.field__P_1); |
|
|
ret += "field__P_1: {}\n".format(ps.field__P_1) |
|
|
ret += "field__P_2: {}".format(ps.field__P_2); |
|
|
ret += "field__P_2: {}".format(ps.field__P_2) |
|
|
return ret |
|
|
return ret |
|
|