diff --git a/examples/ext/lib_test/tests/test_lib_test.py b/examples/ext/lib_test/tests/test_lib_test.py index cb4c584..bed18f1 100644 --- a/examples/ext/lib_test/tests/test_lib_test.py +++ b/examples/ext/lib_test/tests/test_lib_test.py @@ -55,15 +55,42 @@ def test_func_V_args_Pc(): assert(ret == None) assert(arg1 == 'A') +def test_func_V_args_Pc_with_Str(): + with pytest.raises(Exception): + (ret,arg1) = func_V_args_Pc('pEp') + def test_func_Pc_args_Pc(): (ret,arg1) = func_Pc_args_Pc('a') print("RESULT:", ret, arg1) assert (ret == 'A') assert (arg1 == 'a') -# @pytest.mark.skip("") -def test_func_V_args_pPc(): - (ret,arg1) = func_V_args_pPc('a') +# char* +def test_func_pPcStr_args_V(): + (ret,) = func_pPcStr_args_V() + print("RESULT:", ret) + assert (ret == "pEp") + +def test_func_V_args_pPcChr(): + (ret,arg1) = func_V_args_pPcChr('a') + print("RESULT:", ret, arg1) + assert (ret == None) + assert (arg1 == 'A') + +def test_func_V_args_pPcChr_with_Str(): + (ret,arg1) = func_V_args_pPcChr('pep') + print("RESULT:", ret, arg1) + assert (ret == None) + assert (arg1 == 'Pep') + +def test_func_V_args_pPcStr(): + (ret,arg1) = func_V_args_pPcStr('pep') + print("RESULT:", ret, arg1) + assert (ret == None) + assert (arg1 == 'PEP') + +def test_func_V_args_pPcChr_with_Str_with_Chr(): + (ret,arg1) = func_V_args_pPcChr('a') print("RESULT:", ret, arg1) assert (ret == None) assert (arg1 == 'A') @@ -104,3 +131,91 @@ def test_func_pPcc_args_pPcc_pPcc(): assert (ret == instr) assert (arg1 == instr) assert (arg2 == instr) + +def test_func_ppPc_args_V(): + (ret,) = func_ppPc_args_V() + print("RESULT:", ret) + assert (ret == "pEp") + +def test_func_pppPc_args_V(): + (ret,) = func_pppPc_args_V() + print("RESULT:", ret) + assert (ret == "pEp") + +def test_func_V_args_ppPc(): + instr = "orig" + (ret,arg1) = func_V_args_ppPc(instr) + print("RESULT:", ret,arg1) + assert (ret == None) + assert (arg1 == "pEp") + +def test_func_pppPc_args_pppPc(): + instr = "orig" + (ret,arg1) = func_pppPc_args_pppPc(instr) + print("RESULT:", ret,arg1) + assert (ret == "pEp") + assert (arg1 == "pEp") +# +# def test_func_ppPc_args_ppPc_ppPc(): +# instr = "orig" +# instr2 = "orig" +# (ret,arg1,arg2) = func_ppPc_args_ppPc_ppPc(instr,instr2) +# print("RESULT:", ret,arg1,arg2) +# assert (ret == "pEp") +# assert (arg1 == "pEp") +# assert (arg2 == "pEp") + +def test_func__PS_args_V(): + (ret,) = func__PS_args_V() + print(PS_to_string(ret)) + assert(ret.field__P_1 == 23); + assert(ret.field__P_2 == 23); + +def test_func_TTAPS_args_V(): + (ret,) = func_TTAPS_args_V() + print(PS_to_string(ret)) + assert(ret.field__P_1 == 23); + assert(ret.field__P_2 == 23); + +def test_func_pTAPS_args_V(): + (ret,) = func_pTAPS_args_V() + print(PS_to_string(ret)) + assert(ret.field__P_1 == 23); + assert(ret.field__P_2 == 23); + +def test_func_ppTAPS_args_V(): + (ret,) = func_ppTAPS_args_V() + print(PS_to_string(ret)) + assert(ret.field__P_1 == 23); + assert(ret.field__P_2 == 23); + +def test_func_pppTAPS_args_V(): + (ret,) = func_ppTAPS_args_V() + print(PS_to_string(ret)) + assert(ret.field__P_1 == 23); + assert(ret.field__P_2 == 23); + + + + + + + + + +def test_func_V_args_pTAPS(): + ps = PS() + print(PS_to_string(ps)) + (ret,psnew) = func_V_args_pTAPS(ps) + print(PS_to_string(psnew)) + assert(ret == None); + assert(psnew.field__P_1 == 23); + assert(psnew.field__P_2 == 23); + + + +def PS_to_string(ps): + ret = "{}\n".format(type(ps)) + ret += "field__P_1: {}\n".format(ps.field__P_1); + ret += "field__P_2: {}".format(ps.field__P_2); + return ret