inout_typemaps test rework

Use more distinct numbers, now consistent across all languages
This commit is contained in:
William S Fulton 2024-10-06 08:57:41 +01:00
parent 822e1f46ec
commit df87bbe437
6 changed files with 18 additions and 18 deletions

View File

@ -4,7 +4,7 @@ if (inout_typemaps.AddOne1(1) != 2) {
throw new Error;
}
if (JSON.stringify(inout_typemaps.AddOne3(1, 1, 1)) != JSON.stringify([2, 2, 2])) {
if (JSON.stringify(inout_typemaps.AddOne3(10, 20, 30)) != JSON.stringify([11, 21, 31])) {
throw new Error;
}

View File

@ -3,6 +3,6 @@ open Inout_typemaps
let _ =
assert (_AddOne1 '(1.) as float = 2.);
assert (_AddOne3 '(1, 1, 1) = C_list ['2.;'2.;'2.]);
assert (_AddOne1r '(1.) as float = 2.);
assert (_AddOne3 '(10, 20, 30) = C_list ['11.;'21.;'31.]);
assert (_AddOne1r '(20.) as float = 21.);
;;

View File

@ -16,6 +16,6 @@ a = inout_typemaps.AddOne2p({10,20},30);
assert(a{1}, 11); # Wrong
assert(a{2}, 21); # Wrong
a = inout_typemaps.AddOne3p(1,{1,1},1);
a = inout_typemaps.AddOne3p(10,{20,30},40);
# TODO
# assert(a == [2,{2,2},2])
# assert(a == [11,{21,31},41])

View File

@ -4,20 +4,20 @@ a = inout_typemaps.AddOne1(1)
if a != 2:
raise RuntimeError
a = inout_typemaps.AddOne3(1, 1, 1)
if a != [2, 2, 2]:
a = inout_typemaps.AddOne3(10, 20, 30)
if a != [11, 21, 31]:
raise RuntimeError
a = inout_typemaps.AddOne1p((1, 1))
if a != (2, 2):
a = inout_typemaps.AddOne1p((10, 20))
if a != (11, 21):
raise RuntimeError
a = inout_typemaps.AddOne2p((1, 1), 1)
if a != [(2, 2), 2]:
a = inout_typemaps.AddOne2p((10, 20), 30)
if a != [(11, 21), 31]:
raise RuntimeError
a = inout_typemaps.AddOne3p(1, (1, 1), 1)
if a != [2, (2, 2), 2]:
a = inout_typemaps.AddOne3p(10, (20, 30), 40)
if a != [11, (21, 31), 41]:
raise RuntimeError
ret, out = inout_typemaps.NonVoidOut(-42)

View File

@ -5,10 +5,10 @@ null = getNull();
a = AddOne1(10);
if a <> 11 then swigtesterror(); end
[a, b, c] = AddOne3(1, 2, 3);
if a <> 2 then swigtesterror(); end
if b <> 3 then swigtesterror(); end
if c <> 4 then swigtesterror(); end
[a, b, c] = AddOne3(10, 20, 30);
if a <> 11 then swigtesterror(); end
if b <> 21 then swigtesterror(); end
if c <> 31 then swigtesterror(); end
a = AddOne1r(20);
if a <> 21 then swigtesterror(); end

View File

@ -11,7 +11,7 @@ if {[lindex $a 0] != 11} { error "fail AddOne3[0]" }
if {[lindex $a 1] != 21} { error "fail AddOne3[1]" }
if {[lindex $a 2] != 31} { error "fail AddOne3[2]" }
if {[AddOne1r 1] != 2} { error "fail AddOner" }
if {[AddOne1r 20] != 21} { error "fail AddOner" }
set a [NonVoidOut -42]
if {[lindex $a 0] != "NULL"} { error "fail NonVoidOut[0]" }