mirror of https://github.com/swig/swig
Rename inout testcase to inout_typemaps
inout is a D keyword
This commit is contained in:
parent
d85003849c
commit
d7c90c8f8f
|
@ -291,7 +291,7 @@ CPP_TEST_CASES += \
|
|||
inherit_target_language \
|
||||
inherit_void_arg \
|
||||
inline_initializer \
|
||||
inout \
|
||||
inout_typemaps \
|
||||
insert_directive \
|
||||
keyword_rename \
|
||||
kind \
|
||||
|
|
|
@ -25,7 +25,6 @@ CPP11_TEST_CASES = \
|
|||
|
||||
# "D classes support the single inheritance paradigm" https://dlang.org/spec/class.html
|
||||
FAILING_CPP_TESTS += \
|
||||
inout \
|
||||
using_composition \
|
||||
using_extend \
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
%module inout
|
||||
%module inout_typemaps
|
||||
|
||||
%include "typemaps.i"
|
||||
%include "std_pair.i"
|
|
@ -1,13 +0,0 @@
|
|||
var inout = require("inout");
|
||||
|
||||
if (inout.AddOne1(1) != 2) {
|
||||
throw new Error;
|
||||
}
|
||||
|
||||
if (JSON.stringify(inout.AddOne3(1, 1, 1)) != JSON.stringify([2, 2, 2])) {
|
||||
throw new Error;
|
||||
}
|
||||
|
||||
if (JSON.stringify(inout.NonVoidOut(-42)) != JSON.stringify([null, 0])) {
|
||||
throw new Error;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
var inout_typemaps = require("inout_typemaps");
|
||||
|
||||
if (inout_typemaps.AddOne1(1) != 2) {
|
||||
throw new Error;
|
||||
}
|
||||
|
||||
if (JSON.stringify(inout_typemaps.AddOne3(1, 1, 1)) != JSON.stringify([2, 2, 2])) {
|
||||
throw new Error;
|
||||
}
|
||||
|
||||
if (JSON.stringify(inout_typemaps.NonVoidOut(-42)) != JSON.stringify([null, 0])) {
|
||||
throw new Error;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
open Swig
|
||||
open Inout
|
||||
open Inout_typemaps
|
||||
|
||||
let _ =
|
||||
assert (_AddOne1 '(1.) as float = 2.);
|
|
@ -1,21 +1,21 @@
|
|||
inout
|
||||
inout_typemaps
|
||||
|
||||
a = inout.AddOne1(1);
|
||||
a = inout_typemaps.AddOne1(1);
|
||||
assert(a, 2)
|
||||
|
||||
a = inout.AddOne3(10,20,30);
|
||||
a = inout_typemaps.AddOne3(10,20,30);
|
||||
# TODO: SWIG_Octave_AppendOutput seems broken, only one element comes back from C++ code.
|
||||
# assert(all(cell2mat(a) == [11,21,31]));
|
||||
|
||||
a = inout.AddOne1p({10,20});
|
||||
a = inout_typemaps.AddOne1p({10,20});
|
||||
assert(all(cell2mat(a) == [11,21]))
|
||||
|
||||
a = inout.AddOne2p({10,20},30);
|
||||
a = inout_typemaps.AddOne2p({10,20},30);
|
||||
# TODO
|
||||
# assert(a == [{11,21},31]))
|
||||
assert(a{1}, 11); # Wrong
|
||||
assert(a{2}, 21); # Wrong
|
||||
|
||||
a = inout.AddOne3p(1,{1,1},1);
|
||||
a = inout_typemaps.AddOne3p(1,{1,1},1);
|
||||
# TODO
|
||||
# assert(a == [2,{2,2},2])
|
|
@ -1,26 +1,26 @@
|
|||
import inout
|
||||
import inout_typemaps
|
||||
|
||||
a = inout.AddOne1(1)
|
||||
a = inout_typemaps.AddOne1(1)
|
||||
if a != 2:
|
||||
raise RuntimeError
|
||||
|
||||
a = inout.AddOne3(1, 1, 1)
|
||||
a = inout_typemaps.AddOne3(1, 1, 1)
|
||||
if a != [2, 2, 2]:
|
||||
raise RuntimeError
|
||||
|
||||
a = inout.AddOne1p((1, 1))
|
||||
a = inout_typemaps.AddOne1p((1, 1))
|
||||
if a != (2, 2):
|
||||
raise RuntimeError
|
||||
|
||||
a = inout.AddOne2p((1, 1), 1)
|
||||
a = inout_typemaps.AddOne2p((1, 1), 1)
|
||||
if a != [(2, 2), 2]:
|
||||
raise RuntimeError
|
||||
|
||||
a = inout.AddOne3p(1, (1, 1), 1)
|
||||
a = inout_typemaps.AddOne3p(1, (1, 1), 1)
|
||||
if a != [2, (2, 2), 2]:
|
||||
raise RuntimeError
|
||||
|
||||
ret, out = inout.NonVoidOut(-42)
|
||||
ret, out = inout_typemaps.NonVoidOut(-42)
|
||||
if ret is not None:
|
||||
raise RuntimeError
|
||||
if out != 0:
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
require 'swig_assert'
|
||||
|
||||
require 'inout'
|
||||
require 'inout_typemaps'
|
||||
|
||||
include Inout
|
||||
include Inout_typemaps
|
||||
|
||||
swig_assert_equal_simple(AddOne1(1), 2)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
if [ catch { load ./inout[info sharedlibextension] Inout} err_msg ] {
|
||||
if [ catch { load ./inout_typemaps[info sharedlibextension] Inout_typemaps} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
|
Loading…
Reference in New Issue