aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/octave
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/octave')
-rw-r--r--Examples/test-suite/octave/Makefile.in40
-rw-r--r--Examples/test-suite/octave/abstract_access_runme.m2
-rw-r--r--Examples/test-suite/octave/abstract_typedef_runme.m2
-rw-r--r--Examples/test-suite/octave/argcargvtest_runme.m33
-rw-r--r--Examples/test-suite/octave/callback_runme.m18
-rw-r--r--Examples/test-suite/octave/catches_strings_runme.m32
-rw-r--r--Examples/test-suite/octave/char_binary_runme.m57
-rw-r--r--Examples/test-suite/octave/class_ignore_runme.m2
-rw-r--r--Examples/test-suite/octave/class_scope_weird_runme.m2
-rw-r--r--Examples/test-suite/octave/compactdefaultargs_runme.m8
-rw-r--r--Examples/test-suite/octave/constructor_copy_runme.m8
-rw-r--r--Examples/test-suite/octave/cpp11_move_typemaps_runme.m37
-rw-r--r--Examples/test-suite/octave/cpp11_rvalue_reference_move_runme.m85
-rw-r--r--Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m138
-rw-r--r--Examples/test-suite/octave/default_args_runme.m8
-rw-r--r--Examples/test-suite/octave/director_abstract_runme.m6
-rw-r--r--Examples/test-suite/octave/director_basic_runme.m8
-rw-r--r--Examples/test-suite/octave/director_enum_runme.m2
-rw-r--r--Examples/test-suite/octave/director_nested_runme.m4
-rw-r--r--Examples/test-suite/octave/director_unroll_runme.m2
-rw-r--r--Examples/test-suite/octave/enum_template_runme.m4
-rw-r--r--Examples/test-suite/octave/enums_runme.m8
-rw-r--r--Examples/test-suite/octave/extend_template_ns_runme.m4
-rw-r--r--Examples/test-suite/octave/extend_template_runme.m4
-rw-r--r--Examples/test-suite/octave/extend_variable_runme.m2
-rw-r--r--Examples/test-suite/octave/friends_runme.m27
-rw-r--r--Examples/test-suite/octave/grouping_runme.m4
-rw-r--r--Examples/test-suite/octave/iadd_runme.m2
-rw-r--r--Examples/test-suite/octave/inout_runme.m10
-rw-r--r--Examples/test-suite/octave/inplaceadd_runme.m8
-rw-r--r--Examples/test-suite/octave/input_runme.m8
-rw-r--r--Examples/test-suite/octave/li_attribute_runme.m32
-rw-r--r--Examples/test-suite/octave/li_carrays_cpp_runme.m2
-rw-r--r--Examples/test-suite/octave/li_carrays_runme.m2
-rw-r--r--Examples/test-suite/octave/li_cmalloc_runme.m2
-rw-r--r--Examples/test-suite/octave/li_constraints_runme.m62
-rw-r--r--Examples/test-suite/octave/li_cpointer_cpp_runme.m2
-rw-r--r--Examples/test-suite/octave/li_cpointer_runme.m2
-rw-r--r--Examples/test-suite/octave/li_cstring_runme.m14
-rw-r--r--Examples/test-suite/octave/li_cwstring_runme.m18
-rw-r--r--Examples/test-suite/octave/li_factory_runme.m4
-rw-r--r--Examples/test-suite/octave/li_std_auto_ptr_runme.m138
-rw-r--r--Examples/test-suite/octave/li_std_carray_runme.m52
-rw-r--r--Examples/test-suite/octave/li_std_set_runme.m26
-rw-r--r--Examples/test-suite/octave/li_std_stream_runme.m2
-rw-r--r--Examples/test-suite/octave/li_std_string_extra_runme.m10
-rw-r--r--Examples/test-suite/octave/li_std_wstream_runme.m2
-rw-r--r--Examples/test-suite/octave/multi_import_runme.m10
-rw-r--r--Examples/test-suite/octave/namespace_typemap_runme.m50
-rw-r--r--Examples/test-suite/octave/naturalvar_runme.m2
-rw-r--r--Examples/test-suite/octave/null_pointer_runme.m10
-rw-r--r--Examples/test-suite/octave/overload_extend2_runme.m16
-rw-r--r--Examples/test-suite/octave/overload_extend_c_runme.m10
-rw-r--r--Examples/test-suite/octave/overload_extend_runme.m10
-rw-r--r--Examples/test-suite/octave/overload_null_runme.m14
-rw-r--r--Examples/test-suite/octave/preproc_runme.m8
-rw-r--r--Examples/test-suite/octave/primitive_ref_runme.m26
-rw-r--r--Examples/test-suite/octave/reference_global_vars_runme.m34
-rw-r--r--Examples/test-suite/octave/rename_scope_runme.m4
-rw-r--r--Examples/test-suite/octave/ret_by_value_runme.m4
-rw-r--r--Examples/test-suite/octave/smart_pointer_extend_runme.m12
-rw-r--r--Examples/test-suite/octave/smart_pointer_member_runme.m10
-rw-r--r--Examples/test-suite/octave/smart_pointer_multi_runme.m4
-rw-r--r--Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m4
-rw-r--r--Examples/test-suite/octave/smart_pointer_overload_runme.m12
-rw-r--r--Examples/test-suite/octave/smart_pointer_rename_runme.m6
-rw-r--r--Examples/test-suite/octave/smart_pointer_simple_runme.m4
-rw-r--r--Examples/test-suite/octave/smart_pointer_templatevariables_runme.m8
-rw-r--r--Examples/test-suite/octave/smart_pointer_typedef_runme.m4
-rw-r--r--Examples/test-suite/octave/static_const_member_2_runme.m2
-rw-r--r--Examples/test-suite/octave/std_containers_runme.m2
-rw-r--r--Examples/test-suite/octave/struct_value_runme.m4
-rw-r--r--Examples/test-suite/octave/swigobject_runme.m6
-rw-r--r--Examples/test-suite/octave/template_extend1_runme.m4
-rw-r--r--Examples/test-suite/octave/template_extend2_runme.m4
-rw-r--r--Examples/test-suite/octave/template_inherit_runme.m30
-rw-r--r--Examples/test-suite/octave/template_ns4_runme.m2
-rw-r--r--Examples/test-suite/octave/template_ns_runme.m8
-rw-r--r--Examples/test-suite/octave/template_tbase_template_runme.m2
-rw-r--r--Examples/test-suite/octave/template_typedef_cplx2_runme.m6
-rw-r--r--Examples/test-suite/octave/template_typedef_runme.m8
-rw-r--r--Examples/test-suite/octave/typedef_inherit_runme.m5
-rw-r--r--Examples/test-suite/octave/typemap_namespace_runme.m4
-rw-r--r--Examples/test-suite/octave/typemap_ns_using_runme.m2
-rw-r--r--Examples/test-suite/octave/types_directive_runme.m4
-rw-r--r--Examples/test-suite/octave/using1_runme.m2
-rw-r--r--Examples/test-suite/octave/using2_runme.m2
-rw-r--r--Examples/test-suite/octave/virtual_poly_runme.m12
-rw-r--r--Examples/test-suite/octave/voidtest_runme.m6
89 files changed, 943 insertions, 379 deletions
diff --git a/Examples/test-suite/octave/Makefile.in b/Examples/test-suite/octave/Makefile.in
index 3c8f3b165..78d4dec92 100644
--- a/Examples/test-suite/octave/Makefile.in
+++ b/Examples/test-suite/octave/Makefile.in
@@ -5,11 +5,19 @@
LANGUAGE = octave
OCTAVE = @OCTAVE@
SCRIPTSUFFIX = _runme.m
+PCHSUPPORT = @PCHSUPPORT@
+HAVE_CXX11 = @HAVE_CXX11@
+HAVE_CXX14 = @HAVE_CXX14@
+HAVE_CXX17 = @HAVE_CXX17@
+HAVE_CXX20 = @HAVE_CXX20@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
+FAILING_CPP_TESTS = \
+ cpp17_map_no_default_ctor \
+
CPP_TEST_CASES += \
li_std_pair_extra \
li_std_string_extra \
@@ -18,24 +26,11 @@ CPP_TEST_CASES += \
CPP11_TEST_CASES += \
cpp11_shared_ptr_const \
+ cpp11_shared_ptr_crtp_upcast \
cpp11_shared_ptr_nullptr_in_containers \
cpp11_shared_ptr_overload \
cpp11_shared_ptr_upcast \
-CPP_TEST_BROKEN += \
- implicittest \
- li_implicit \
- li_std_set \
- li_std_stream
-
-#C_TEST_CASES +=
-
-#
-# This test only works with modern C compilers
-#
-#C_TEST_CASES += \
-# complextest
-
include $(srcdir)/../common.mk
# Overridden variables here
@@ -61,6 +56,23 @@ CSRCS = octave_empty.c
+$(swig_and_compile_multi_cpp)
$(run_testcase)
+# Pre-compile Octave headers, if supported
+
+ifeq (yes,$(PCHSUPPORT))
+
+export OCTHEADERSSRC = @top_srcdir@/Lib/octave/octheaders.hpp
+export OCTHEADERS = @top_builddir@/Examples/test-suite/octave/octheaders.hpp
+export OCTHEADERSGCH = $(OCTHEADERS).gch
+export SWIGOCTHDROPT = -DSWIG_OCTAVE_EXTERNAL_OCTHEADERS
+export IOCTHEADERS = -I@top_builddir@/Examples/test-suite/octave @PCHINCLUDEARG@ $(OCTHEADERS)@PCHINCLUDEEXT@
+
+$(OCTHEADERSGCH): $(OCTHEADERSSRC)
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile octave_precompile_headers
+
+$(NOT_BROKEN_TEST_CASES) $(BROKEN_TEST_CASES): $(OCTHEADERSGCH)
+
+endif
+
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.m appended after the testcase name.
run_testcase = \
diff --git a/Examples/test-suite/octave/abstract_access_runme.m b/Examples/test-suite/octave/abstract_access_runme.m
index e49343a92..e47223c47 100644
--- a/Examples/test-suite/octave/abstract_access_runme.m
+++ b/Examples/test-suite/octave/abstract_access_runme.m
@@ -2,6 +2,6 @@ abstract_access
d = abstract_access.D();
if (d.do_x() != 1)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/abstract_typedef_runme.m b/Examples/test-suite/octave/abstract_typedef_runme.m
index e57f71504..6f90b8159 100644
--- a/Examples/test-suite/octave/abstract_typedef_runme.m
+++ b/Examples/test-suite/octave/abstract_typedef_runme.m
@@ -10,7 +10,7 @@ a = A();
if (a.write(e) != 1)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/argcargvtest_runme.m b/Examples/test-suite/octave/argcargvtest_runme.m
index f246dd9db..d1e4f3a65 100644
--- a/Examples/test-suite/octave/argcargvtest_runme.m
+++ b/Examples/test-suite/octave/argcargvtest_runme.m
@@ -11,9 +11,15 @@ if (mainv(targs,1) != 'hola')
endif
targs={'hi', 'hola'};
+if (mainv(targs,0) != 'hi')
+ error("bad main typemap");
+endif
if (mainv(targs,1) != 'hola')
error("bad main typemap");
endif
+if (mainv(targs,2) != '<<NULL>>')
+ error("bad main typemap");
+endif
try
error_flag = 0;
@@ -27,3 +33,30 @@ endif
initializeApp(largs);
+
+# Check that an empty array works.
+empty_args={};
+if (mainc(empty_args) != 0)
+ error("bad main typemap");
+endif
+if (mainv(empty_args,0) != '<<NULL>>')
+ error("bad main typemap");
+endif
+
+# Check that empty strings are handled.
+empty_string={"hello", blanks(0), "world"};
+if (mainc(empty_string) != 3)
+ error("bad main typemap");
+endif
+if (mainv(empty_string, 0) != "hello")
+ error("bad main typemap");
+endif
+if (mainv(empty_string, 1) != "")
+ error("bad main typemap");
+endif
+if (mainv(empty_string, 2) != "world")
+ error("bad main typemap");
+endif
+if (mainv(empty_string, 3) != "<<NULL>>")
+ error("bad main typemap");
+endif
diff --git a/Examples/test-suite/octave/callback_runme.m b/Examples/test-suite/octave/callback_runme.m
index db9f7888d..95df598f1 100644
--- a/Examples/test-suite/octave/callback_runme.m
+++ b/Examples/test-suite/octave/callback_runme.m
@@ -2,39 +2,39 @@ _callback
callback
if (foo(2) != 2)
- error
+ error("failed");
endif
if (A_bar(2) != 4)
- error
+ error("failed");
endif
if (foobar(3, _callback.foo) != foo(3))
- error
+ error("failed");
endif
if (foobar(3, foo) != foo(3))
- error
+ error("failed");
endif
if (foobar(3, A_bar) != A_bar(3))
- error
+ error("failed");
endif
if (foobar(3, foof) != foof(3))
- error
+ error("failed");
endif
if (foobar_i(3, foo_i) != foo_i(3))
- error
+ error("failed");
endif
if (foobar_d(3.5, foo_d) != foo_d(3.5))
- error
+ error("failed");
endif
a = A();
if (foobarm(3, a, A.foom_cb_ptr) != a.foom(3))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/catches_strings_runme.m b/Examples/test-suite/octave/catches_strings_runme.m
new file mode 100644
index 000000000..7e323cc13
--- /dev/null
+++ b/Examples/test-suite/octave/catches_strings_runme.m
@@ -0,0 +1,32 @@
+# do not dump Octave core
+if exist("crash_dumps_octave_core", "builtin")
+ crash_dumps_octave_core(0);
+endif
+
+catches_strings
+
+exception_thrown = false;
+try
+ StringsThrower.charstring();
+catch e
+ if (isempty(strfind(e.message, "charstring message")))
+ error("incorrect exception message: %s", e.message)
+ endif
+ exception_thrown = true;
+end_try_catch
+if (!exception_thrown)
+ error("Should have thrown an exception");
+endif
+
+exception_thrown = false;
+try
+ StringsThrower.stdstring();
+catch e
+ if (isempty(strfind(e.message, "stdstring message")))
+ error("incorrect exception message: %s", e.message)
+ endif
+ exception_thrown = true;
+end_try_catch
+if (!exception_thrown)
+ error("Should have thrown an exception");
+endif
diff --git a/Examples/test-suite/octave/char_binary_runme.m b/Examples/test-suite/octave/char_binary_runme.m
new file mode 100644
index 000000000..e2cdb01e9
--- /dev/null
+++ b/Examples/test-suite/octave/char_binary_runme.m
@@ -0,0 +1,57 @@
+char_binary
+
+t = char_binary.Test();
+str = "hile";
+if (t.strlen(str) != 4)
+ disp(t.strlen(str));
+ error("bad multi-arg typemap");
+endif
+if (t.ustrlen(str) != 4)
+ disp(t.ustrlen(str));
+ error("bad multi-arg typemap");
+endif
+
+if (t.strlen("hil\000") != 4)
+ error("bad multi-arg typemap");
+endif
+if (t.ustrlen("hil\000") != 4)
+ error("bad multi-arg typemap");
+endif
+
+% creating a raw char*
+pc = new_pchar(5);
+pchar_setitem(pc, 0, 'h');
+pchar_setitem(pc, 1, 'o');
+pchar_setitem(pc, 2, 'l');
+pchar_setitem(pc, 3, 'a');
+pchar_setitem(pc, 4, 0);
+
+if (0)
+ % FIXME: Can not convert to const (SWIG_TypeError)
+ if (t.strlen(pc) != 4)
+ error("bad multi-arg typemap");
+ endif
+
+ % FIXME: Can not convert to const (SWIG_TypeError)
+ if (t.ustrlen(pc) != 4)
+ error("bad multi-arg typemap");
+ endif
+endif
+
+char_binary.var_pchar = pc;
+if (0)
+ % FIXME: could not dispatch binary operator
+ if (char_binary.var_pchar != "hola")
+ error("bad pointer case");
+ endif
+endif
+
+char_binary.var_namet = pc;
+if (0)
+ % FIXME: could not dispatch binary operator
+ if (char_binary.var_namet != "hola")
+ error("bad pointer case");
+ endif
+endif
+
+delete_pchar(pc);
diff --git a/Examples/test-suite/octave/class_ignore_runme.m b/Examples/test-suite/octave/class_ignore_runme.m
index 3e52047c2..53cad9570 100644
--- a/Examples/test-suite/octave/class_ignore_runme.m
+++ b/Examples/test-suite/octave/class_ignore_runme.m
@@ -8,5 +8,5 @@ class_ignore
a = class_ignore.Bar();
if (!strcmp(class_ignore.do_blah(a),"Bar::blah"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/class_scope_weird_runme.m b/Examples/test-suite/octave/class_scope_weird_runme.m
index 2fc857808..b0e975359 100644
--- a/Examples/test-suite/octave/class_scope_weird_runme.m
+++ b/Examples/test-suite/octave/class_scope_weird_runme.m
@@ -3,5 +3,5 @@ class_scope_weird
f = class_scope_weird.Foo();
g = class_scope_weird.Foo(3);
if (f.bar(3) != 3)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/compactdefaultargs_runme.m b/Examples/test-suite/octave/compactdefaultargs_runme.m
index 08e872724..ada60dcbe 100644
--- a/Examples/test-suite/octave/compactdefaultargs_runme.m
+++ b/Examples/test-suite/octave/compactdefaultargs_runme.m
@@ -4,21 +4,21 @@ defaults1 = Defaults1(1000);
defaults1 = Defaults1();
if (defaults1.ret(10.0) != 10.0)
- error
+ error("failed");
endif
if (defaults1.ret() != -1.0)
- error
+ error("failed");
endif
defaults2 = Defaults2(1000);
defaults2 = Defaults2();
if (defaults2.ret(10.0) != 10.0)
- error
+ error("failed");
endif
if (defaults2.ret() != -1.0)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/constructor_copy_runme.m b/Examples/test-suite/octave/constructor_copy_runme.m
index e450214c6..b6d3c3b6a 100644
--- a/Examples/test-suite/octave/constructor_copy_runme.m
+++ b/Examples/test-suite/octave/constructor_copy_runme.m
@@ -10,7 +10,7 @@ f11 = Foo1(f1);
if (f1.x != f11.x)
- error
+ error("failed");
endif
@@ -23,7 +23,7 @@ catch
end_try_catch
if (!good)
- error
+ error("failed");
endif
@@ -31,7 +31,7 @@ bi = Bari(5);
bc = Bari(bi);
if (bi.x != bc.x)
- error
+ error("failed");
endif
@@ -44,6 +44,6 @@ catch
end_try_catch
if (!good)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/cpp11_move_typemaps_runme.m b/Examples/test-suite/octave/cpp11_move_typemaps_runme.m
new file mode 100644
index 000000000..c0532565b
--- /dev/null
+++ b/Examples/test-suite/octave/cpp11_move_typemaps_runme.m
@@ -0,0 +1,37 @@
+# do not dump Octave core
+if exist("crash_dumps_octave_core", "builtin")
+ crash_dumps_octave_core(0);
+endif
+
+cpp11_move_typemaps
+
+Counter.reset_counts();
+mo = MoveOnly(111);
+Counter_check_counts(1, 0, 0, 0, 0, 0);
+MoveOnly.take(mo);
+Counter_check_counts(1, 0, 0, 1, 0, 2);
+clear mo;
+Counter_check_counts(1, 0, 0, 1, 0, 2);
+
+Counter.reset_counts();
+mo = MovableCopyable(111);
+Counter_check_counts(1, 0, 0, 0, 0, 0);
+MovableCopyable.take(mo);
+Counter_check_counts(1, 0, 0, 1, 0, 2);
+clear mo;
+Counter_check_counts(1, 0, 0, 1, 0, 2);
+
+mo = MoveOnly(222);
+MoveOnly.take(mo);
+exception_thrown = false;
+try
+ MoveOnly.take(mo);
+catch e
+ if (isempty(strfind(e.message, "cannot release ownership as memory is not owned")))
+ error("incorrect exception message %s", e.message);
+ endif
+ exception_thrown = true;
+end_try_catch
+if (!exception_thrown)
+ error("double usage of take should have been an error");
+endif
diff --git a/Examples/test-suite/octave/cpp11_rvalue_reference_move_runme.m b/Examples/test-suite/octave/cpp11_rvalue_reference_move_runme.m
new file mode 100644
index 000000000..5be37cc7e
--- /dev/null
+++ b/Examples/test-suite/octave/cpp11_rvalue_reference_move_runme.m
@@ -0,0 +1,85 @@
+# do not dump Octave core
+if exist("crash_dumps_octave_core", "builtin")
+ crash_dumps_octave_core(0);
+endif
+
+cpp11_rvalue_reference_move
+
+# Function containing rvalue reference parameter
+Counter.reset_counts();
+mo = MovableCopyable(222);
+Counter.check_counts(1, 0, 0, 0, 0, 0);
+MovableCopyable.movein(mo);
+Counter.check_counts(1, 0, 0, 1, 0, 2);
+if (!MovableCopyable_is_nullptr(mo))
+ error("is_nullptr failed");
+endif
+clear mo;
+Counter.check_counts(1, 0, 0, 1, 0, 2);
+
+# Move constructor test
+Counter.reset_counts();
+mo = MovableCopyable(222);
+Counter.check_counts(1, 0, 0, 0, 0, 0);
+mo_moved = MovableCopyable(mo);
+Counter.check_counts(1, 0, 0, 1, 0, 1);
+if (!MovableCopyable_is_nullptr(mo))
+ error("is_nullptr failed");
+endif
+clear mo;
+Counter.check_counts(1, 0, 0, 1, 0, 1);
+clear mo_moved;
+Counter.check_counts(1, 0, 0, 1, 0, 2);
+
+# Move assignment operator test
+Counter.reset_counts();
+mo111 = MovableCopyable(111);
+mo222 = MovableCopyable(222);
+Counter.check_counts(2, 0, 0, 0, 0, 0);
+mo111.MoveAssign(mo222);
+Counter.check_counts(2, 0, 0, 0, 1, 1);
+if (!MovableCopyable_is_nullptr(mo222))
+ error("is_nullptr failed");
+endif
+clear mo222;
+Counter.check_counts(2, 0, 0, 0, 1, 1);
+clear mo111;
+Counter.check_counts(2, 0, 0, 0, 1, 2);
+
+# null check
+null = []; # NULL pointer
+Counter.reset_counts();
+exception_thrown = false;
+try
+ MovableCopyable.movein(null);
+catch e
+ if (isempty(strfind(e.message, "invalid null reference")))
+ error("incorrect exception message: %s", e.message)
+ endif
+ exception_thrown = true;
+end_try_catch
+if (!exception_thrown)
+ error("Should have thrown null error");
+endif
+Counter.check_counts(0, 0, 0, 0, 0, 0);
+
+
+# output
+Counter.reset_counts();
+mc = MovableCopyable.moveout(1234);
+Counter.check_counts(2, 0, 0, 0, 1, 1);
+MovableCopyable.check_numbers_match(mc, 1234);
+
+exception_thrown = false;
+try
+ MovableCopyable.movein(mc);
+catch e
+ if (isempty(strfind(e.message, "cannot release ownership as memory is not owned")))
+ error("incorrect exception message: %s", e.message)
+ endif
+ exception_thrown = true;
+end_try_catch
+if (!exception_thrown)
+ error("Should have thrown 'Cannot release ownership as memory is not owned' error");
+endif
+Counter.check_counts(2, 0, 0, 0, 1, 1);
diff --git a/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m b/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m
new file mode 100644
index 000000000..dbd461711
--- /dev/null
+++ b/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m
@@ -0,0 +1,138 @@
+# do not dump Octave core
+if exist("crash_dumps_octave_core", "builtin")
+ crash_dumps_octave_core(0);
+endif
+
+cpp11_std_unique_ptr
+
+function checkCount(expected_count)
+ actual_count = Klass_getTotal_count();
+ if (actual_count != expected_count)
+ error("Counts incorrect, expected:%d actual:%d", expected_count, actual_count);
+ endif
+end
+
+# Test raw pointer handling involving virtual inheritance
+kini = KlassInheritance("KlassInheritanceInput");
+checkCount(1);
+s = useKlassRawPtr(kini);
+if (!strcmp(s, "KlassInheritanceInput"))
+ error("Incorrect string: %s", s);
+endif
+clear kini;
+checkCount(0);
+
+
+# unique_ptr as input
+kin = Klass("KlassInput");
+checkCount(1);
+s = takeKlassUniquePtr(kin);
+checkCount(0);
+if (!strcmp(s, "KlassInput"))
+ error("Incorrect string: %s", s);
+endif
+if (!is_nullptr(kin))
+ error("is_nullptr failed");
+endif
+clear kin; # Should not fail, even though already deleted
+checkCount(0);
+
+kin = Klass("KlassInput");
+checkCount(1);
+s = takeKlassUniquePtr(kin);
+checkCount(0);
+if (!strcmp(s, "KlassInput"))
+ error("Incorrect string: %s", s);
+endif
+if (!is_nullptr(kin))
+ error("is_nullptr failed");
+endif
+exception_thrown = false;
+try
+ takeKlassUniquePtr(kin);
+catch e
+ if (isempty(strfind(e.message, "cannot release ownership as memory is not owned")))
+ error("incorrect exception message %s", e.message);
+ endif
+ exception_thrown = true;
+end_try_catch
+if (!exception_thrown)
+ error("double usage of takeKlassUniquePtr should have been an error");
+endif
+clear kin; # Should not fail, even though already deleted
+checkCount(0);
+
+kin = Klass("KlassInput");
+exception_thrown = false;
+notowned = get_not_owned_ptr(kin);
+try
+ takeKlassUniquePtr(notowned);
+catch e
+ if (isempty(strfind(e.message, "cannot release ownership as memory is not owned")))
+ error("incorrect exception message %s", e.message);
+ endif
+ exception_thrown = true;
+end_try_catch
+if (!exception_thrown)
+ error("Should have thrown 'Cannot release ownership as memory is not owned' error");
+endif
+checkCount(1);
+clear kin;
+checkCount(0);
+
+kini = KlassInheritance("KlassInheritanceInput");
+checkCount(1);
+s = takeKlassUniquePtr(kini);
+checkCount(0);
+if (!strcmp(s, "KlassInheritanceInput"))
+ error("Incorrect string: %s", s);
+endif
+if (!is_nullptr(kini))
+ error("is_nullptr failed");
+endif
+clear kini; # Should not fail, even though already deleted
+checkCount(0);
+
+null = []; # NULL pointer
+null_ptr = make_null();
+takeKlassUniquePtr([]);
+takeKlassUniquePtr(null);
+takeKlassUniquePtr(null_ptr);
+checkCount(0);
+
+# overloaded parameters
+if (overloadTest() != 0)
+ error("overloadTest failed");
+endif
+if (overloadTest(null) != 1)
+ error("overloadTest failed");
+endif
+if (overloadTest(Klass("over")) != 1)
+ error("overloadTest failed");
+endif
+checkCount(0);
+
+
+# unique_ptr as output
+k1 = makeKlassUniquePtr("first");
+if (!strcmp(k1.getLabel(), "first"))
+ error("wrong object label");
+endif
+
+k2 = makeKlassUniquePtr("second");
+checkCount(2);
+
+clear k1;
+checkCount(1);
+
+if (!strcmp(k2.getLabel(), "second"))
+ error("wrong object label");
+endif
+
+clear k2;
+checkCount(0);
+
+null_smart_prt = makeNullUniquePtr();
+assert(ismatrix(null_smart_prt))
+assert(size(null_smart_prt) == size([]))
+assert(isequal([], null_smart_prt))
diff --git a/Examples/test-suite/octave/default_args_runme.m b/Examples/test-suite/octave/default_args_runme.m
index 3d00f63e0..d2c6b4a6f 100644
--- a/Examples/test-suite/octave/default_args_runme.m
+++ b/Examples/test-suite/octave/default_args_runme.m
@@ -7,19 +7,19 @@ default_args
if (default_args.Statics.staticmethod() != 60)
- error
+ error("failed");
endif
if (default_args.cfunc1(1) != 2)
- error
+ error("failed");
endif
if (default_args.cfunc2(1) != 3)
- error
+ error("failed");
endif
if (default_args.cfunc3(1) != 4)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/director_abstract_runme.m b/Examples/test-suite/octave/director_abstract_runme.m
index 657e2e1d9..c96cf7554 100644
--- a/Examples/test-suite/octave/director_abstract_runme.m
+++ b/Examples/test-suite/octave/director_abstract_runme.m
@@ -28,17 +28,17 @@ MyExample3=@() subclass(director_abstract.Example3_i(),'Color',@(self,r,g,b) b);
me1 = MyExample1();
if (director_abstract.Example1.get_color(me1, 1,2,3) != 1)
- error
+ error("failed");
endif
me2 = MyExample2(1,2);
if (me2.get_color(me2, 1,2,3) != 2)
- error
+ error("failed");
endif
me3 = MyExample3();
if (me3.get_color(me3, 1,2,3) != 3)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/director_basic_runme.m b/Examples/test-suite/octave/director_basic_runme.m
index 9de54a385..9a411a703 100644
--- a/Examples/test-suite/octave/director_basic_runme.m
+++ b/Examples/test-suite/octave/director_basic_runme.m
@@ -33,7 +33,7 @@ endif
a = director_basic.A1(1);
if (a.rg(2) != 2)
- error
+ error("failed");
endif
function self=OctClass()
@@ -62,16 +62,16 @@ bd = dd.cmethod(b);
cc.method(b);
if (c.cmethod != 7)
- error
+ error("failed");
endif
if (bc.x != 34)
- error
+ error("failed");
endif
if (bd.x != 16)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/director_enum_runme.m b/Examples/test-suite/octave/director_enum_runme.m
index 96f158d39..59a5ccf8b 100644
--- a/Examples/test-suite/octave/director_enum_runme.m
+++ b/Examples/test-suite/octave/director_enum_runme.m
@@ -6,5 +6,5 @@ b = director_enum.Foo();
a = MyFoo();
if (a.say_hi(director_enum.hello) != b.say_hello(director_enum.hi))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/director_nested_runme.m b/Examples/test-suite/octave/director_nested_runme.m
index 6e1d0ded9..614af0c60 100644
--- a/Examples/test-suite/octave/director_nested_runme.m
+++ b/Examples/test-suite/octave/director_nested_runme.m
@@ -31,9 +31,9 @@ c = FooBar_int_get_self(cc);
c.advance();
if (!strcmp(c.get_name(),"FooBar::get_name hello"))
- error
+ error("failed");
endif
if (!strcmp(c.name(),"FooBar::get_name hello"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/director_unroll_runme.m b/Examples/test-suite/octave/director_unroll_runme.m
index 6ca213c4c..607b9d5ef 100644
--- a/Examples/test-suite/octave/director_unroll_runme.m
+++ b/Examples/test-suite/octave/director_unroll_runme.m
@@ -11,6 +11,6 @@ c = b.get();
if (swig_this(a) != swig_this(c))
a,c
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/enum_template_runme.m b/Examples/test-suite/octave/enum_template_runme.m
index a9f940a9f..1474ce1cc 100644
--- a/Examples/test-suite/octave/enum_template_runme.m
+++ b/Examples/test-suite/octave/enum_template_runme.m
@@ -6,13 +6,13 @@ endif
enum_template
if (enum_template.MakeETest() != 1)
- error
+ error("failed");
endif
enum_template.TakeETest(0);
try
a=enum_template.TakeETest(0);
- error
+ error("failed");
catch
end_try_catch
diff --git a/Examples/test-suite/octave/enums_runme.m b/Examples/test-suite/octave/enums_runme.m
index b654d9d04..5f6bd6951 100644
--- a/Examples/test-suite/octave/enums_runme.m
+++ b/Examples/test-suite/octave/enums_runme.m
@@ -6,18 +6,18 @@ enums.bar3(1)
enums.bar1(1)
if (enums.cvar.enumInstance != 2)
- error
+ error("failed");
endif
if (enums.cvar.Slap != 10)
- error
+ error("failed");
endif
if (enums.cvar.Mine != 11)
- error
+ error("failed");
endif
if (enums.cvar.Thigh != 12)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/extend_template_ns_runme.m b/Examples/test-suite/octave/extend_template_ns_runme.m
index e79a00dda..7196fac73 100644
--- a/Examples/test-suite/octave/extend_template_ns_runme.m
+++ b/Examples/test-suite/octave/extend_template_ns_runme.m
@@ -7,9 +7,9 @@ extend_template_ns
f = Foo_One();
if (f.test1(37) != 37)
- error
+ error("failed");
endif
if (f.test2(42) != 42)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/extend_template_runme.m b/Examples/test-suite/octave/extend_template_runme.m
index 1cad7bfc9..125bd4a5a 100644
--- a/Examples/test-suite/octave/extend_template_runme.m
+++ b/Examples/test-suite/octave/extend_template_runme.m
@@ -2,9 +2,9 @@ extend_template
f = extend_template.Foo_0();
if (f.test1(37) != 37)
- error
+ error("failed");
endif
if (f.test2(42) != 42)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/extend_variable_runme.m b/Examples/test-suite/octave/extend_variable_runme.m
index c55b6c55c..89af26c9d 100644
--- a/Examples/test-suite/octave/extend_variable_runme.m
+++ b/Examples/test-suite/octave/extend_variable_runme.m
@@ -1,6 +1,6 @@
extend_variable
if (Foo.Bar != 42)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/friends_runme.m b/Examples/test-suite/octave/friends_runme.m
index 31211567f..1b6071004 100644
--- a/Examples/test-suite/octave/friends_runme.m
+++ b/Examples/test-suite/octave/friends_runme.m
@@ -8,44 +8,51 @@ friends
a = friends.A(2);
if (friends.get_val1(a) != 2)
- error
+ error("failed");
endif
if (friends.get_val2(a) != 4)
- error
+ error("failed");
endif
if (friends.get_val3(a) != 6)
- error
+ error("failed");
endif
# nice overload working fine
if (friends.get_val1(1,2,3) != 1)
- error
+ error("failed");
endif
b = friends.B(3);
# David's case
if (friends.mix(a,b) != 5)
- error
+ error("failed");
endif
-di = friends.D_d(2);
+di = friends.D_i(2);
dd = friends.D_d(3.3);
# incredible template overloading working just fine
if (friends.get_val1(di) != 2)
- error
+ error("failed");
endif
if (friends.get_val1(dd) != 3.3)
- error
+ error("failed");
endif
friends.set(di, 4);
friends.set(dd, 1.3);
if (friends.get_val1(di) != 4)
- error
+ error("failed");
endif
if (friends.get_val1(dd) != 1.3)
- error
+ error("failed");
+endif
+
+if (friends.chum_blah() != 1234)
+ error("failed");
+endif
+if (friends.mate_blah() != 4321)
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/grouping_runme.m b/Examples/test-suite/octave/grouping_runme.m
index 6d1a2d673..4e2c9ea2d 100644
--- a/Examples/test-suite/octave/grouping_runme.m
+++ b/Examples/test-suite/octave/grouping_runme.m
@@ -7,14 +7,14 @@ grouping
x = grouping.test1(42);
if (x != 42)
- error
+ error("failed");
endif
grouping.test2(42);
x = (grouping.do_unary(37, grouping.NEGATE));
if (x != -37)
- error
+ error("failed");
endif
grouping.cvar.test3 = 42;
diff --git a/Examples/test-suite/octave/iadd_runme.m b/Examples/test-suite/octave/iadd_runme.m
index c386c669e..70cd75dae 100644
--- a/Examples/test-suite/octave/iadd_runme.m
+++ b/Examples/test-suite/octave/iadd_runme.m
@@ -6,5 +6,5 @@ f.AsA.x = 3;
f.AsA += f.AsA;
if (f.AsA.x != 6)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/inout_runme.m b/Examples/test-suite/octave/inout_runme.m
index 74caaff46..c5d293eb6 100644
--- a/Examples/test-suite/octave/inout_runme.m
+++ b/Examples/test-suite/octave/inout_runme.m
@@ -2,26 +2,26 @@ inout
a = inout.AddOne1(1);
if (a != 2)
- error
+ error("failed");
endif
a = inout.AddOne3(1,1,1);
if (a != [2,2,2])
- error
+ error("failed");
endif
a = inout.AddOne1p((1,1));
if (a != (2,2))
- error
+ error("failed");
endif
a = inout.AddOne2p((1,1),1);
if (a != [(2,2),2])
- error
+ error("failed");
endif
a = inout.AddOne3p(1,(1,1),1);
if (a != [2,(2,2),2])
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/inplaceadd_runme.m b/Examples/test-suite/octave/inplaceadd_runme.m
index 2bc193793..50b680aba 100644
--- a/Examples/test-suite/octave/inplaceadd_runme.m
+++ b/Examples/test-suite/octave/inplaceadd_runme.m
@@ -3,22 +3,22 @@ a = inplaceadd.A(7);
a += 5;
if (a.val != 12)
- error
+ error("failed");
endif
a -= 5;
if a.val != 7:
- error
+ error("failed");
endif
a *= 2;
if (a.val != 14)
- error
+ error("failed");
endif
a += a;
if (a.val != 28)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/input_runme.m b/Examples/test-suite/octave/input_runme.m
index 1a92d032b..477ffaac1 100644
--- a/Examples/test-suite/octave/input_runme.m
+++ b/Examples/test-suite/octave/input_runme.m
@@ -7,21 +7,21 @@ input
f = Foo();
if (f.foo(2) != 4)
- error
+ error("failed");
endif
try
a=f.foo();
- error
+ error("failed");
catch
end_try_catch
if (!strcmp(sfoo("Hello"),"Hello world"))
- error
+ error("failed");
endif
try
a=sfoo();
- error
+ error("failed");
catch
end_try_catch
diff --git a/Examples/test-suite/octave/li_attribute_runme.m b/Examples/test-suite/octave/li_attribute_runme.m
index ed051d9df..5e239045f 100644
--- a/Examples/test-suite/octave/li_attribute_runme.m
+++ b/Examples/test-suite/octave/li_attribute_runme.m
@@ -8,7 +8,7 @@ li_attribute
aa = li_attribute.A(1,2,3);
if (aa.a != 1)
- error
+ error("failed");
endif
aa.a = 3;
if (aa.a != 3)
@@ -20,31 +20,31 @@ if (aa.b != 2)
endif
aa.b = 5;
if (aa.b != 5)
- error
+ error("failed");
endif
if (aa.d != aa.b)
- error
+ error("failed");
endif
if (aa.c != 3)
- error
+ error("failed");
endif
pi = li_attribute.Param_i(7);
if (pi.value != 7)
- error
+ error("failed");
endif
pi.value=3;
if (pi.value != 3)
- error
+ error("failed");
endif
b = li_attribute.B(aa);
if (b.a.c != 3)
- error
+ error("failed");
endif
# class/struct attribute with get/set methods using return/pass by reference
@@ -53,38 +53,38 @@ myFoo.x = 8;
myClass = li_attribute.MyClass();
myClass.Foo = myFoo;
if (myClass.Foo.x != 8)
- error
+ error("failed");
endif
# class/struct attribute with get/set methods using return/pass by value
myClassVal = li_attribute.MyClassVal();
if (myClassVal.ReadWriteFoo.x != -1)
- error
+ error("failed");
endif
if (myClassVal.ReadOnlyFoo.x != -1)
- error
+ error("failed");
endif
myClassVal.ReadWriteFoo = myFoo;
if (myClassVal.ReadWriteFoo.x != 8)
- error
+ error("failed");
endif
if (myClassVal.ReadOnlyFoo.x != 8)
- error
+ error("failed");
endif
# string attribute with get/set methods using return/pass by value
myStringyClass = li_attribute.MyStringyClass("initial string");
if (myStringyClass.ReadWriteString != "initial string")
- error
+ error("failed");
endif
if (myStringyClass.ReadOnlyString != "initial string")
- error
+ error("failed");
endif
myStringyClass.ReadWriteString = "changed string";
if (myStringyClass.ReadWriteString != "changed string")
- error
+ error("failed");
endif
if (myStringyClass.ReadOnlyString != "changed string")
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_carrays_cpp_runme.m b/Examples/test-suite/octave/li_carrays_cpp_runme.m
index b3b520920..57e3e9a87 100644
--- a/Examples/test-suite/octave/li_carrays_cpp_runme.m
+++ b/Examples/test-suite/octave/li_carrays_cpp_runme.m
@@ -11,5 +11,5 @@ d(0) = 7;
d(5) = d(0) + 3;
if (d(5) + d(0) != 17)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_carrays_runme.m b/Examples/test-suite/octave/li_carrays_runme.m
index c6b5f1619..5f180cce3 100644
--- a/Examples/test-suite/octave/li_carrays_runme.m
+++ b/Examples/test-suite/octave/li_carrays_runme.m
@@ -11,5 +11,5 @@ d(0) = 7;
d(5) = d(0) + 3;
if (d(5) + d(0) != 17)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_cmalloc_runme.m b/Examples/test-suite/octave/li_cmalloc_runme.m
index 92bcd9515..5daea2cb9 100644
--- a/Examples/test-suite/octave/li_cmalloc_runme.m
+++ b/Examples/test-suite/octave/li_cmalloc_runme.m
@@ -17,6 +17,6 @@ catch
end_try_catch
if (ok != 1)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_constraints_runme.m b/Examples/test-suite/octave/li_constraints_runme.m
new file mode 100644
index 000000000..eaea571a0
--- /dev/null
+++ b/Examples/test-suite/octave/li_constraints_runme.m
@@ -0,0 +1,62 @@
+li_constraints
+
+function check_double(except, f, val, name)
+ actual = true;
+ proper = false;
+ try
+ f(val);
+ catch
+ actual = false;
+ proper = strcmp(lasterr, ["Expected a ", name , " value. (SWIG_ValueError)"]) == 1;
+ end
+ if (actual)
+ if (!except)
+ error(["function '", name, "' with ", num2str(val), " should perform an exception"]);
+ end
+ else
+ if (except)
+ error(["function '", name, "' with ", num2str(val), " should not perform an exception"]);
+ elseif (!proper)
+ error(["function '", name, "' with ", num2str(val), " should perform a proper exception"]);
+ end
+ end
+end
+
+function nonnegative(x);global li_constraints;li_constraints.test_nonnegative(x);end
+check_double(true, @nonnegative, 10, "non-negative");
+check_double(true, @nonnegative, 0, "non-negative");
+check_double(false, @nonnegative, -10, "non-negative");
+
+function nonpositive(x);global li_constraints;li_constraints.test_nonpositive(x);end
+check_double(false, @nonpositive, 10, "non-positive");
+check_double(true, @nonpositive, 0, "non-positive");
+check_double(true, @nonpositive, -10, "non-positive");
+
+function positive(x);global li_constraints;li_constraints.test_positive(x);end
+check_double(true, @positive, 10, "positive");
+check_double(false, @positive, 0, "positive");
+check_double(false, @positive, -10, "positive");
+
+function negative(x);global li_constraints;li_constraints.test_negative(x);end
+check_double(false, @negative, 10, "negative");
+check_double(false, @negative, 0, "negative");
+check_double(true, @negative, -10, "negative");
+
+function nonzero(x);global li_constraints;li_constraints.test_nonzero(x);end
+check_double(true, @nonzero, 10, "nonzero");
+check_double(false, @nonzero, 0, "nonzero");
+check_double(true, @nonzero, -10, "nonzero");
+
+have_exception = false;
+try
+ # Empty matrix translate to null pointer
+ li_constraints.test_nonnull([]);
+catch
+ have_exception = strcmp("Received a NULL pointer. (SWIG_ValueError)", lasterr) == 1;
+end
+if (!have_exception)
+ error("test_nonnull should perform exception with 'null' value");
+end
+
+nonnull = li_constraints.get_nonnull();
+li_constraints.test_nonnull(nonnull);
diff --git a/Examples/test-suite/octave/li_cpointer_cpp_runme.m b/Examples/test-suite/octave/li_cpointer_cpp_runme.m
index 463cf44f8..3551a17a9 100644
--- a/Examples/test-suite/octave/li_cpointer_cpp_runme.m
+++ b/Examples/test-suite/octave/li_cpointer_cpp_runme.m
@@ -5,7 +5,7 @@ p = new_intp();
intp_assign(p,3);
if (intp_value(p) != 3)
- error
+ error("failed");
endif
delete_intp(p);
diff --git a/Examples/test-suite/octave/li_cpointer_runme.m b/Examples/test-suite/octave/li_cpointer_runme.m
index ce055cddd..995cc2abf 100644
--- a/Examples/test-suite/octave/li_cpointer_runme.m
+++ b/Examples/test-suite/octave/li_cpointer_runme.m
@@ -10,7 +10,7 @@ p = new_intp();
intp_assign(p,3);
if (intp_value(p) != 3)
- error
+ error("failed");
endif
delete_intp(p);
diff --git a/Examples/test-suite/octave/li_cstring_runme.m b/Examples/test-suite/octave/li_cstring_runme.m
index 8aea6b709..4a706d33f 100644
--- a/Examples/test-suite/octave/li_cstring_runme.m
+++ b/Examples/test-suite/octave/li_cstring_runme.m
@@ -7,15 +7,15 @@ li_cstring
if (count("ab\0ab\0ab\0", 0) != 3)
- error
+ error("failed");
endif
if (!strcmp(test1(),"Hello World"))
- error
+ error("failed");
endif
if (!strcmp(test2()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
- error
+ error("failed");
endif
if (!strcmp(test3("hello"),"hello-suffix"))
@@ -27,18 +27,18 @@ if (!strcmp(test4("hello"),"hello-suffix"))
endif
if (!strcmp(test5(4),'xxxx'))
- error
+ error("failed");
endif
if (!strcmp(test6(10),'xxxxx'))
- error
+ error("failed");
endif
if (!strcmp(test7(),"Hello world!"))
- error
+ error("failed");
endif
if (!strcmp(test8()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_cwstring_runme.m b/Examples/test-suite/octave/li_cwstring_runme.m
index 1fb0962e7..5b9055110 100644
--- a/Examples/test-suite/octave/li_cwstring_runme.m
+++ b/Examples/test-suite/octave/li_cwstring_runme.m
@@ -6,38 +6,38 @@ endif
li_cwstring
if (count("ab\0ab\0ab\0", 0) != 3)
- error
+ error("failed");
endif
if (!strcmp(test1(),"Hello World"))
- error
+ error("failed");
endif
if (!strcmp(test2()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
- error
+ error("failed");
endif
if (!strcmp(test3("hello"),"hello-suffix"))
- error
+ error("failed");
endif
if (!strcmp(test4("hello"),"hello-suffix"))
- error
+ error("failed");
endif
if (!strcmp(test5(4),'xxxx'))
- error
+ error("failed");
endif
if (!strcmp(test6(10),'xxxxx'))
- error
+ error("failed");
endif
if (!strcmp(test7(),"Hello world!"))
- error
+ error("failed");
endif
if (!strcmp(test8()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_factory_runme.m b/Examples/test-suite/octave/li_factory_runme.m
index 5ea9b779f..7c07825f4 100644
--- a/Examples/test-suite/octave/li_factory_runme.m
+++ b/Examples/test-suite/octave/li_factory_runme.m
@@ -8,11 +8,11 @@ li_factory
circle = Geometry_create(Geometry.CIRCLE);
r = circle.radius();
if (r != 1.5)
- error
+ error("failed");
endif
point = Geometry_create(Geometry.POINT);
w = point.width();
if (w != 1.0)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_std_auto_ptr_runme.m b/Examples/test-suite/octave/li_std_auto_ptr_runme.m
new file mode 100644
index 000000000..9f0dd16cd
--- /dev/null
+++ b/Examples/test-suite/octave/li_std_auto_ptr_runme.m
@@ -0,0 +1,138 @@
+# do not dump Octave core
+if exist("crash_dumps_octave_core", "builtin")
+ crash_dumps_octave_core(0);
+endif
+
+li_std_auto_ptr
+
+function checkCount(expected_count)
+ actual_count = Klass_getTotal_count();
+ if (actual_count != expected_count)
+ error("Counts incorrect, expected:%d actual:%d", expected_count, actual_count);
+ endif
+end
+
+# Test raw pointer handling involving virtual inheritance
+kini = KlassInheritance("KlassInheritanceInput");
+checkCount(1);
+s = useKlassRawPtr(kini);
+if (!strcmp(s, "KlassInheritanceInput"))
+ error("Incorrect string: %s", s);
+endif
+clear kini;
+checkCount(0);
+
+
+# auto_ptr as input
+kin = Klass("KlassInput");
+checkCount(1);
+s = takeKlassAutoPtr(kin);
+checkCount(0);
+if (!strcmp(s, "KlassInput"))
+ error("Incorrect string: %s", s);
+endif
+if (!is_nullptr(kin))
+ error("is_nullptr failed");
+endif
+clear kin; # Should not fail, even though already deleted
+checkCount(0);
+
+kin = Klass("KlassInput");
+checkCount(1);
+s = takeKlassAutoPtr(kin);
+checkCount(0);
+if (!strcmp(s, "KlassInput"))
+ error("Incorrect string: %s", s);
+endif
+if (!is_nullptr(kin))
+ error("is_nullptr failed");
+endif
+exception_thrown = false;
+try
+ takeKlassAutoPtr(kin);
+catch e
+ if (isempty(strfind(e.message, "cannot release ownership as memory is not owned")))
+ error("incorrect exception message %s", e.message);
+ endif
+ exception_thrown = true;
+end_try_catch
+if (!exception_thrown)
+ error("double usage of takeKlassAutoPtr should have been an error");
+endif
+clear kin; # Should not fail, even though already deleted
+checkCount(0);
+
+kin = Klass("KlassInput");
+exception_thrown = false;
+notowned = get_not_owned_ptr(kin);
+try
+ takeKlassAutoPtr(notowned);
+catch e
+ if (isempty(strfind(e.message, "cannot release ownership as memory is not owned")))
+ error("incorrect exception message %s", e.message);
+ endif
+ exception_thrown = true;
+end_try_catch
+if (!exception_thrown)
+ error("Should have thrown 'Cannot release ownership as memory is not owned' error");
+endif
+checkCount(1);
+clear kin;
+checkCount(0);
+
+kini = KlassInheritance("KlassInheritanceInput");
+checkCount(1);
+s = takeKlassAutoPtr(kini);
+checkCount(0);
+if (!strcmp(s, "KlassInheritanceInput"))
+ error("Incorrect string: %s", s);
+endif
+if (!is_nullptr(kini))
+ error("is_nullptr failed");
+endif
+clear kini; # Should not fail, even though already deleted
+checkCount(0);
+
+null = []; # NULL pointer
+null_ptr = make_null();
+takeKlassAutoPtr([]);
+takeKlassAutoPtr(null);
+takeKlassAutoPtr(null_ptr);
+checkCount(0);
+
+# overloaded parameters
+if (overloadTest() != 0)
+ error("overloadTest failed");
+endif
+if (overloadTest(null) != 1)
+ error("overloadTest failed");
+endif
+if (overloadTest(Klass("over")) != 1)
+ error("overloadTest failed");
+endif
+checkCount(0);
+
+
+# auto_ptr as output
+k1 = makeKlassAutoPtr("first");
+if (!strcmp(k1.getLabel(), "first"))
+ error("wrong object label");
+endif
+
+k2 = makeKlassAutoPtr("second");
+checkCount(2);
+
+clear k1;
+checkCount(1);
+
+if (!strcmp(k2.getLabel(), "second"))
+ error("wrong object label");
+endif
+
+clear k2;
+checkCount(0);
+
+null_smart_prt = makeNullAutoPtr();
+assert(ismatrix(null_smart_prt))
+assert(size(null_smart_prt) == size([]))
+assert(isequal([], null_smart_prt))
diff --git a/Examples/test-suite/octave/li_std_carray_runme.m b/Examples/test-suite/octave/li_std_carray_runme.m
deleted file mode 100644
index 4943fa8a2..000000000
--- a/Examples/test-suite/octave/li_std_carray_runme.m
+++ /dev/null
@@ -1,52 +0,0 @@
-li_std_carray
-
-
-v3 = Vector3();
-for i=0:len(v3),
- v3(i) = i;
-endfor
-
-i = 0;
-for d in v3,
- if (d != i)
- error
- endif
- i = i + 1;
-endfor
-
-
-m3 = Matrix3();
-
-for i=0:len(m3),
- v3 = m3(i);
- for j=0:len(v3),
- v3(j) = i + j;
- endfor
-endfor
-
-i = 0;
-for v3 in m3,
- j = 0;
- for d in v3,
- if (d != i + j)
- error
- endif
- j = j + 1;
- endfor
- i = i + 1
-endfor
-
-for i=0:len(m3),
- for j=0:len(m3),
- if (m3(i,j) != i + j)
- error
- endif
- endfor
-endfor
-
-da = Vector3([1,2,3]);
-ma = Matrix3({[1,2,3],[4,5,6],[7,8,9]});
-
-
-
-
diff --git a/Examples/test-suite/octave/li_std_set_runme.m b/Examples/test-suite/octave/li_std_set_runme.m
index 9bd4f152c..7f43f2f13 100644
--- a/Examples/test-suite/octave/li_std_set_runme.m
+++ b/Examples/test-suite/octave/li_std_set_runme.m
@@ -11,15 +11,15 @@ for i in s:
sum = sum + i
if (sum != "abc")
- error
+ error("failed");
i = s.__iter__()
if i.next() != "a":
- error
+ error("failed");
if i.next() != "b":
- error
+ error("failed");
if i.next() != "c":
- error
+ error("failed");
b = s.begin()
@@ -28,7 +28,7 @@ sum = ""
while (b != e):
sum = sum + b.next()
if sum != "abc":
- error
+ error("failed");
b = s.rbegin()
e = s.rend()
@@ -37,7 +37,7 @@ while (b != e):
sum = sum + b.next()
if sum != "cba":
- error
+ error("failed");
@@ -49,11 +49,11 @@ si.append(3)
i = si.__iter__()
if i.next() != 1:
- error
+ error("failed");
if i.next() != 2:
- error
+ error("failed");
if i.next() != 3:
- error
+ error("failed");
@@ -68,17 +68,17 @@ sum = ""
while (b != e):
sum = sum + b.next()
if sum != "ac":
- error
+ error("failed");
b = s.begin()
e = s.end()
if e - b != 2:
- error
+ error("failed");
m = b + 1
if m.value() != "c":
- error
+ error("failed");
@@ -93,4 +93,4 @@ for i in s:
sum = sum + (i,)
if sum != (1, 'hello', (1, 2)):
- error
+ error("failed");
diff --git a/Examples/test-suite/octave/li_std_stream_runme.m b/Examples/test-suite/octave/li_std_stream_runme.m
index bf9402e16..cedc8e59c 100644
--- a/Examples/test-suite/octave/li_std_stream_runme.m
+++ b/Examples/test-suite/octave/li_std_stream_runme.m
@@ -8,6 +8,6 @@ o << a << " " << 2345 << " " << 1.435;
if (o.str() != "A class 2345 1.435")
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/li_std_string_extra_runme.m b/Examples/test-suite/octave/li_std_string_extra_runme.m
index 8d506af8a..15e18eec7 100644
--- a/Examples/test-suite/octave/li_std_string_extra_runme.m
+++ b/Examples/test-suite/octave/li_std_string_extra_runme.m
@@ -140,23 +140,23 @@ endif
if (li_std_string_extra.test_reference_input("hello") != "hello")
- error
+ error("failed");
endif
s = li_std_string_extra.test_reference_inout("hello");
if (s != "hellohello")
- error
+ error("failed");
endif
if (li_std_string_extra.stdstring_empty() != "")
- error
+ error("failed");
endif
if (li_std_string_extra.c_empty() != "")
- error
+ error("failed");
endif
#if (li_std_string_extra.c_null() != None)
-# error
+# error("failed");
#endif
diff --git a/Examples/test-suite/octave/li_std_wstream_runme.m b/Examples/test-suite/octave/li_std_wstream_runme.m
index a017e8acd..4f1c62166 100644
--- a/Examples/test-suite/octave/li_std_wstream_runme.m
+++ b/Examples/test-suite/octave/li_std_wstream_runme.m
@@ -9,6 +9,6 @@ o = wostringstream();
o << a << u" " << 2345 << u" " << 1.435 << wends;
if (o.str() != "A class 2345 1.435\0")
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/multi_import_runme.m b/Examples/test-suite/octave/multi_import_runme.m
index 2b7a610d4..d22ff5c81 100644
--- a/Examples/test-suite/octave/multi_import_runme.m
+++ b/Examples/test-suite/octave/multi_import_runme.m
@@ -8,22 +8,22 @@ multi_import_b;
x = multi_import_b.XXX();
if (x.testx() != 0)
- error
+ error("failed");
endif
y = multi_import_b.YYY();
if (y.testx() != 0)
- error
+ error("failed");
endif
if (y.testy() != 1)
- error
+ error("failed");
endif
z = multi_import_a.ZZZ();
if (z.testx() != 0)
- error
+ error("failed");
endif
if (z.testz() != 2)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/namespace_typemap_runme.m b/Examples/test-suite/octave/namespace_typemap_runme.m
index ca3730773..d7e338104 100644
--- a/Examples/test-suite/octave/namespace_typemap_runme.m
+++ b/Examples/test-suite/octave/namespace_typemap_runme.m
@@ -1,106 +1,106 @@
namespace_typemap
if (!strcmp(stest1("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest2("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest3("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest4("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest5("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest6("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest7("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest8("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest9("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest10("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest11("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(stest12("hello"),"hello"))
- error
+ error("failed");
endif
c = complex(2,3);
r = real(c);
if (ctest1(c) != r)
- error
+ error("failed");
endif
if (ctest2(c) != r)
- error
+ error("failed");
endif
if (ctest3(c) != r)
- error
+ error("failed");
endif
if (ctest4(c) != r)
- error
+ error("failed");
endif
if (ctest5(c) != r)
- error
+ error("failed");
endif
if (ctest6(c) != r)
- error
+ error("failed");
endif
if (ctest7(c) != r)
- error
+ error("failed");
endif
if (ctest8(c) != r)
- error
+ error("failed");
endif
if (ctest9(c) != r)
- error
+ error("failed");
endif
if (ctest10(c) != r)
- error
+ error("failed");
endif
if (ctest11(c) != r)
- error
+ error("failed");
endif
if (ctest12(c) != r)
- error
+ error("failed");
endif
try
ttest1(-14)
- error
+ error("failed");
catch
end_try_catch
diff --git a/Examples/test-suite/octave/naturalvar_runme.m b/Examples/test-suite/octave/naturalvar_runme.m
index 6059b0273..40546f26c 100644
--- a/Examples/test-suite/octave/naturalvar_runme.m
+++ b/Examples/test-suite/octave/naturalvar_runme.m
@@ -14,6 +14,6 @@ cvar.s = "hello";
b.s = "hello";
if (b.s != cvar.s)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/null_pointer_runme.m b/Examples/test-suite/octave/null_pointer_runme.m
index 72362f451..7a49d37f0 100644
--- a/Examples/test-suite/octave/null_pointer_runme.m
+++ b/Examples/test-suite/octave/null_pointer_runme.m
@@ -6,3 +6,13 @@ endif
null_pointer;
assert(funk([]));
+null_ptr = getnull();
+assert(ismatrix(null_ptr))
+assert(size(null_ptr) == size([]))
+assert(isequal([], null_ptr))
+
+# Can't use isnull as a test due to null matrix not being copyable...
+# n = []
+# isnull(n) # ans = 0
+# isnull([]) # ans = 1
+# isnull(getnull()) # ans = 0
diff --git a/Examples/test-suite/octave/overload_extend2_runme.m b/Examples/test-suite/octave/overload_extend2_runme.m
index 6db6b66bb..e4611948e 100644
--- a/Examples/test-suite/octave/overload_extend2_runme.m
+++ b/Examples/test-suite/octave/overload_extend2_runme.m
@@ -2,29 +2,29 @@ overload_extend2
f = overload_extend2.Foo();
if (f.test(3) != 1)
- error
+ error("failed");
endif
if (f.test("hello") != 2)
- error
+ error("failed");
endif
if (f.test(3.5,2.5) != 3)
- error
+ error("failed");
endif
if (f.test("hello",20) != 1020)
- error
+ error("failed");
endif
if (f.test("hello",20,100) != 120)
- error
+ error("failed");
endif
# C default args
if (f.test(f) != 30)
- error
+ error("failed");
endif
if (f.test(f,100) != 120)
- error
+ error("failed");
endif
if (f.test(f,100,200) != 300)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/overload_extend_c_runme.m b/Examples/test-suite/octave/overload_extend_c_runme.m
index 79b92ca47..2a6c5c21e 100644
--- a/Examples/test-suite/octave/overload_extend_c_runme.m
+++ b/Examples/test-suite/octave/overload_extend_c_runme.m
@@ -7,18 +7,18 @@ overload_extend_c
f = overload_extend_c.Foo();
if (f.test() != 0)
- error
+ error("failed");
endif
if (f.test(3) != 1)
- error
+ error("failed");
endif
if (f.test("hello") != 2)
- error
+ error("failed");
endif
if (f.test(3,2) != 5)
- error
+ error("failed");
endif
if (f.test(3.1)-.1 != 1003) # :)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/overload_extend_runme.m b/Examples/test-suite/octave/overload_extend_runme.m
index d9959804f..a29f1910e 100644
--- a/Examples/test-suite/octave/overload_extend_runme.m
+++ b/Examples/test-suite/octave/overload_extend_runme.m
@@ -7,18 +7,18 @@ overload_extend
f = overload_extend.Foo();
if (f.test() != 0)
- error
+ error("failed");
endif
if (f.test(3) != 1)
- error
+ error("failed");
endif
if (f.test("hello") != 2)
- error
+ error("failed");
endif
if (f.test(3,2) != 5)
- error
+ error("failed");
endif
if (f.test(3.1)-.1 != 1003) # :)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/overload_null_runme.m b/Examples/test-suite/octave/overload_null_runme.m
index a7c346c26..83c11a199 100644
--- a/Examples/test-suite/octave/overload_null_runme.m
+++ b/Examples/test-suite/octave/overload_null_runme.m
@@ -40,13 +40,13 @@ check(14, o.byval1cpr(null));
check(15, o.byval2cpr(null));
check(16, o.byval2cpr(x));
-# forward class declaration
-check(17, o.byval1forwardptr(x));
-check(18, o.byval1forwardptr(null));
+# fwd class declaration
+check(17, o.byval1fwdptr(x));
+check(18, o.byval1fwdptr(null));
-check(19, o.byval2forwardptr(null));
-check(20, o.byval2forwardptr(x));
+check(19, o.byval2fwdptr(null));
+check(20, o.byval2fwdptr(x));
-check(21, o.byval1forwardref(x));
+check(21, o.byval1fwdref(x));
-check(22, o.byval2forwardref(x));
+check(22, o.byval2fwdref(x));
diff --git a/Examples/test-suite/octave/preproc_runme.m b/Examples/test-suite/octave/preproc_runme.m
index e9af66e78..80f1d32ba 100644
--- a/Examples/test-suite/octave/preproc_runme.m
+++ b/Examples/test-suite/octave/preproc_runme.m
@@ -6,18 +6,18 @@ endif
preproc
if (preproc.cvar.endif != 1)
- error
+ error("failed");
endif
if (preproc.cvar.define != 1)
- error
+ error("failed");
endif
if (preproc.cvar.defined != 1)
- error
+ error("failed");
endif
if (2*preproc.one != preproc.two)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/primitive_ref_runme.m b/Examples/test-suite/octave/primitive_ref_runme.m
index 68a5750c3..799b6db17 100644
--- a/Examples/test-suite/octave/primitive_ref_runme.m
+++ b/Examples/test-suite/octave/primitive_ref_runme.m
@@ -1,53 +1,53 @@
primitive_ref
if (ref_int(3) != 3)
- error
+ error("failed");
endif
if (ref_uint(3) != 3)
- error
+ error("failed");
endif
if (ref_short(3) != 3)
- error
+ error("failed");
endif
if (ref_ushort(3) != 3)
- error
+ error("failed");
endif
if (ref_long(3) != 3)
- error
+ error("failed");
endif
if (ref_ulong(3) != 3)
- error
+ error("failed");
endif
if (ref_schar(3) != 3)
- error
+ error("failed");
endif
if (ref_uchar(3) != 3)
- error
+ error("failed");
endif
if (ref_float(3.5) != 3.5)
- error
+ error("failed");
endif
if (ref_double(3.5) != 3.5)
- error
+ error("failed");
endif
if (ref_bool(true) != true)
- error
+ error("failed");
endif
if (!strcmp(ref_char('x'),'x'))
- error
+ error("failed");
endif
if (ref_over(0) != 0)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/reference_global_vars_runme.m b/Examples/test-suite/octave/reference_global_vars_runme.m
index 67ad9c514..c7f4f56b7 100644
--- a/Examples/test-suite/octave/reference_global_vars_runme.m
+++ b/Examples/test-suite/octave/reference_global_vars_runme.m
@@ -2,90 +2,90 @@ reference_global_vars
# const class reference variable
if (getconstTC().num != 33)
- error
+ error("failed");
endif
# primitive reference variables
cvar.var_bool = createref_bool(false);
if (value_bool(cvar.var_bool) != 0)
- error
+ error("failed");
endif
cvar.var_bool = createref_bool(true);
if (value_bool(cvar.var_bool) != 1)
- error
+ error("failed");
endif
cvar.var_char = createref_char('w');
if (!strcmp(value_char(cvar.var_char),'w'))
- error
+ error("failed");
endif
cvar.var_unsigned_char = createref_unsigned_char(10);
if (value_unsigned_char(cvar.var_unsigned_char) != 10)
- error
+ error("failed");
endif
cvar.var_signed_char = createref_signed_char(10);
if (value_signed_char(cvar.var_signed_char) != 10)
- error
+ error("failed");
endif
cvar.var_short = createref_short(10);
if (value_short(cvar.var_short) != 10)
- error
+ error("failed");
endif
cvar.var_unsigned_short = createref_unsigned_short(10);
if (value_unsigned_short(cvar.var_unsigned_short) != 10)
- error
+ error("failed");
endif
cvar.var_int = createref_int(10);
if (value_int(cvar.var_int) != 10)
- error
+ error("failed");
endif
cvar.var_unsigned_int = createref_unsigned_int(10);
if (value_unsigned_int(cvar.var_unsigned_int) != 10)
- error
+ error("failed");
endif
cvar.var_long = createref_long(10);
if (value_long(cvar.var_long) != 10)
- error
+ error("failed");
endif
cvar.var_unsigned_long = createref_unsigned_long(10);
if (value_unsigned_long(cvar.var_unsigned_long) != 10)
- error
+ error("failed");
endif
cvar.var_long_long = createref_long_long(int64(0x6FFFFFFFFFFFFFF8));
if (value_long_long(cvar.var_long_long) != int64(0x6FFFFFFFFFFFFFF8))
- error
+ error("failed");
endif
#ull = abs(0xFFFFFFF2FFFFFFF0)
ull = uint64(55834574864);
cvar.var_unsigned_long_long = createref_unsigned_long_long(ull);
if (value_unsigned_long_long(cvar.var_unsigned_long_long) != ull)
- error
+ error("failed");
endif
cvar.var_float = createref_float(10.5);
if (value_float(cvar.var_float) != 10.5)
- error
+ error("failed");
endif
cvar.var_double = createref_double(10.5);
if (value_double(cvar.var_double) != 10.5)
- error
+ error("failed");
endif
# class reference variable
cvar.var_TestClass = createref_TestClass(TestClass(20));
if (value_TestClass(cvar.var_TestClass).num != 20)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/rename_scope_runme.m b/Examples/test-suite/octave/rename_scope_runme.m
index 154f99dfe..776d218c5 100644
--- a/Examples/test-suite/octave/rename_scope_runme.m
+++ b/Examples/test-suite/octave/rename_scope_runme.m
@@ -4,11 +4,11 @@ a = Natural_UP();
b = Natural_BP();
if (a.rtest() != 1)
- error
+ error("failed");
endif
if (b.rtest() != 1)
- error
+ error("failed");
endif
f = @equals;
diff --git a/Examples/test-suite/octave/ret_by_value_runme.m b/Examples/test-suite/octave/ret_by_value_runme.m
index 67f80aae2..c1c508353 100644
--- a/Examples/test-suite/octave/ret_by_value_runme.m
+++ b/Examples/test-suite/octave/ret_by_value_runme.m
@@ -7,9 +7,9 @@ ret_by_value
a = ret_by_value.get_test();
if (a.myInt != 100)
- error
+ error("failed");
endif
if (a.myShort != 200)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_extend_runme.m b/Examples/test-suite/octave/smart_pointer_extend_runme.m
index 6c9258e6d..cf82f7350 100644
--- a/Examples/test-suite/octave/smart_pointer_extend_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_extend_runme.m
@@ -9,7 +9,7 @@ f = Foo();
b = Bar(f);
if (b.extension() != f.extension())
- error
+ error("failed");
endif
@@ -18,15 +18,15 @@ d = CDerived();
p = CPtr();
if (b.bar() != p.bar())
- error
+ error("failed");
endif
if (d.foo() != p.foo())
- error
+ error("failed");
endif
if (b.hello() != p.hello())
- error
+ error("failed");
endif
@@ -36,11 +36,11 @@ d = DFoo();
dp = DPtrFoo(d);
if (d.SExt(1) != dp.SExt(1))
- error
+ error("failed");
endif
if (d.Ext(1) != dp.Ext(1))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_member_runme.m b/Examples/test-suite/octave/smart_pointer_member_runme.m
index 30251c3a8..1c2d0e9ed 100644
--- a/Examples/test-suite/octave/smart_pointer_member_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_member_runme.m
@@ -4,7 +4,7 @@ f = Foo();
f.y = 1;
if (f.y != 1)
- error
+ error("failed");
endif
b = Bar(f);
@@ -15,18 +15,18 @@ if (f.y != 2)
endif
if (swig_this(b.x) != swig_this(f.x))
- error
+ error("failed");
endif
if (b.z != f.z)
- error
+ error("failed");
endif
try
if (Foo.z == Bar.z)
- error
+ error("failed");
endif
- error
+ error("failed");
catch
end_try_catch
diff --git a/Examples/test-suite/octave/smart_pointer_multi_runme.m b/Examples/test-suite/octave/smart_pointer_multi_runme.m
index 71ef9109a..ea15d04b9 100644
--- a/Examples/test-suite/octave/smart_pointer_multi_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_multi_runme.m
@@ -7,11 +7,11 @@ g = Grok(b);
s.x = 3;
if (s.getx() != 3)
- error
+ error("failed");
endif
g.x = 4;
if (g.getx() != 4)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m b/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
index 4b77e0eea..c2ab78714 100644
--- a/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
@@ -7,12 +7,12 @@ g = Grok(b);
s.x = 3;
if (s.getx() != 3)
- error
+ error("failed");
endif
g.x = 4;
if (g.getx() != 4)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_overload_runme.m b/Examples/test-suite/octave/smart_pointer_overload_runme.m
index a5df0ded4..1bfb68354 100644
--- a/Examples/test-suite/octave/smart_pointer_overload_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_overload_runme.m
@@ -10,23 +10,23 @@ b = Bar(f);
if (f.test(3) != 1)
- error
+ error("failed");
endif
if (f.test(3.5) != 2)
- error
+ error("failed");
endif
if (f.test("hello") != 3)
- error
+ error("failed");
endif
if (b.test(3) != 1)
- error
+ error("failed");
endif
if (b.test(3.5) != 2)
- error
+ error("failed");
endif
if (b.test("hello") != 3)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_rename_runme.m b/Examples/test-suite/octave/smart_pointer_rename_runme.m
index 5eb6d4c3c..307bd8f95 100644
--- a/Examples/test-suite/octave/smart_pointer_rename_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_rename_runme.m
@@ -9,14 +9,14 @@ f = Foo();
b = Bar(f);
if (b.test() != 3)
- error
+ error("failed");
endif
if (b.ftest1(1) != 1)
- error
+ error("failed");
endif
if (b.ftest2(2,3) != 2)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_simple_runme.m b/Examples/test-suite/octave/smart_pointer_simple_runme.m
index 30b1387c4..c15c43ca9 100644
--- a/Examples/test-suite/octave/smart_pointer_simple_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_simple_runme.m
@@ -10,11 +10,11 @@ b = Bar(f);
b.x = 3;
if (b.getx() != 3)
- error
+ error("failed");
endif
fp = b.__deref__();
fp.x = 4;
if (fp.getx() != 4)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m b/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
index 4884fa24b..ee45f68f9 100644
--- a/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
@@ -3,17 +3,17 @@ smart_pointer_templatevariables
d = DiffImContainerPtr_D(create(1234, 5678));
if (d.id != 1234)
- error
+ error("failed");
endif
#if (d.xyz != 5678):
-# error
+# error("failed");
d.id = 4321;
#d.xyz = 8765
if (d.id != 4321)
- error
+ error("failed");
endif
#if (d.xyz != 8765):
-# error
+# error("failed");
diff --git a/Examples/test-suite/octave/smart_pointer_typedef_runme.m b/Examples/test-suite/octave/smart_pointer_typedef_runme.m
index 0e1c8a61e..3a094670f 100644
--- a/Examples/test-suite/octave/smart_pointer_typedef_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_typedef_runme.m
@@ -10,11 +10,11 @@ b = Bar(f);
b.x = 3;
if (b.getx() != 3)
- error
+ error("failed");
endif
fp = b.__deref__();
fp.x = 4;
if (fp.getx() != 4)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/static_const_member_2_runme.m b/Examples/test-suite/octave/static_const_member_2_runme.m
index 73260bae7..8619fd1eb 100644
--- a/Examples/test-suite/octave/static_const_member_2_runme.m
+++ b/Examples/test-suite/octave/static_const_member_2_runme.m
@@ -18,6 +18,6 @@ end_try_catch
if (Foo.BAZ.val != 2*Foo.BAR.val)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/std_containers_runme.m b/Examples/test-suite/octave/std_containers_runme.m
index eae3d5d9f..d069b585c 100644
--- a/Examples/test-suite/octave/std_containers_runme.m
+++ b/Examples/test-suite/octave/std_containers_runme.m
@@ -132,7 +132,7 @@ s.append(3);
j=1;
for i in s,
if (i != j)
- error
+ error("failed");
endif
j = j + 1;
endfor
diff --git a/Examples/test-suite/octave/struct_value_runme.m b/Examples/test-suite/octave/struct_value_runme.m
index ff344047e..7f7448bb6 100644
--- a/Examples/test-suite/octave/struct_value_runme.m
+++ b/Examples/test-suite/octave/struct_value_runme.m
@@ -9,10 +9,10 @@ b = struct_value.Bar();
b.a.x = 3;
if (b.a.x != 3)
- error
+ error("failed");
endif
b.b.x = 3;
if (b.b.x != 3)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/swigobject_runme.m b/Examples/test-suite/octave/swigobject_runme.m
index 73167e497..9ab3aa8c6 100644
--- a/Examples/test-suite/octave/swigobject_runme.m
+++ b/Examples/test-suite/octave/swigobject_runme.m
@@ -11,7 +11,7 @@ a1 = a_ptr(a);
a2 = a_ptr(a);
if (swig_this(a1) != swig_this(a2))
- error
+ error("failed");
endif
@@ -20,7 +20,7 @@ xstr1 = printf("0x%x",lthis);
xstr2 = pointer_str(a);
if (xstr1 != xstr2)
- error
+ error("failed");
endif
s = str(a.this);
@@ -29,5 +29,5 @@ r = repr(a.this);
v1 = v_ptr(a);
v2 = v_ptr(a);
if (uint64(v1) != uint64(v2))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_extend1_runme.m b/Examples/test-suite/octave/template_extend1_runme.m
index 5035debf5..05e534107 100644
--- a/Examples/test-suite/octave/template_extend1_runme.m
+++ b/Examples/test-suite/octave/template_extend1_runme.m
@@ -9,9 +9,9 @@ a = template_extend1.lBaz();
b = template_extend1.dBaz();
if (!strcmp(a.foo(),"lBaz::foo"))
- error
+ error("failed");
endif
if (!strcmp(b.foo(),"dBaz::foo"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_extend2_runme.m b/Examples/test-suite/octave/template_extend2_runme.m
index 24472a9ed..e9b5fb799 100644
--- a/Examples/test-suite/octave/template_extend2_runme.m
+++ b/Examples/test-suite/octave/template_extend2_runme.m
@@ -9,9 +9,9 @@ a = template_extend2.lBaz();
b = template_extend2.dBaz();
if (!strcmp(a.foo(),"lBaz::foo"))
- error
+ error("failed");
endif
if (!strcmp(b.foo(),"dBaz::foo"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_inherit_runme.m b/Examples/test-suite/octave/template_inherit_runme.m
index 368cce227..72d7e7511 100644
--- a/Examples/test-suite/octave/template_inherit_runme.m
+++ b/Examples/test-suite/octave/template_inherit_runme.m
@@ -12,62 +12,62 @@ e = FooUInt();
f = BarUInt();
if (!strcmp(a.blah(),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(b.blah(),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(e.blah(),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(c.blah(),"Bar"))
- error
+ error("failed");
endif
if (!strcmp(d.blah(),"Bar"))
- error
+ error("failed");
endif
if (!strcmp(f.blah(),"Bar"))
- error
+ error("failed");
endif
if (!strcmp(c.foomethod(),"foomethod"))
- error
+ error("failed");
endif
if (!strcmp(d.foomethod(),"foomethod"))
- error
+ error("failed");
endif
if (!strcmp(f.foomethod(),"foomethod"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_int(a),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_int(c),"Bar"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_double(b),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_double(d),"Bar"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_uint(e),"Foo"))
- error
+ error("failed");
endif
if (!strcmp(invoke_blah_uint(f),"Bar"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_ns4_runme.m b/Examples/test-suite/octave/template_ns4_runme.m
index b5746427b..6dff55694 100644
--- a/Examples/test-suite/octave/template_ns4_runme.m
+++ b/Examples/test-suite/octave/template_ns4_runme.m
@@ -7,5 +7,5 @@ template_ns4
d = make_Class_DD();
if (!strcmp(d.test(),"test"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_ns_runme.m b/Examples/test-suite/octave/template_ns_runme.m
index 29a2f53f6..44b13e62c 100644
--- a/Examples/test-suite/octave/template_ns_runme.m
+++ b/Examples/test-suite/octave/template_ns_runme.m
@@ -3,19 +3,19 @@ p1 = pairii(2,3);
p2 = pairii(p1);
if (p2.first != 2)
- error
+ error("failed");
endif
if (p2.second != 3)
- error
+ error("failed");
endif
p3 = pairdd(3.5,2.5);
p4 = pairdd(p3);
if (p4.first != 3.5)
- error
+ error("failed");
endif
if (p4.second != 2.5)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_tbase_template_runme.m b/Examples/test-suite/octave/template_tbase_template_runme.m
index da8ec4c69..b1bfd8f7d 100644
--- a/Examples/test-suite/octave/template_tbase_template_runme.m
+++ b/Examples/test-suite/octave/template_tbase_template_runme.m
@@ -2,5 +2,5 @@ template_tbase_template
a = make_Class_dd();
if (!strcmp(a.test(),"test"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/template_typedef_cplx2_runme.m b/Examples/test-suite/octave/template_typedef_cplx2_runme.m
index a72e0f1e0..eb783fe81 100644
--- a/Examples/test-suite/octave/template_typedef_cplx2_runme.m
+++ b/Examples/test-suite/octave/template_typedef_cplx2_runme.m
@@ -15,7 +15,7 @@ end_try_catch
if (strfind('ArithUnaryFunction',swig_type(d)) != 1)
d
error("is not an ArithUnaryFunction")
- error
+ error("failed");
endif
try
@@ -77,7 +77,7 @@ end_try_catch
if (strfind('ArithUnaryFunction',swig_type(g)) != 1)
g
error("is not an ArithUnaryFunction")
- error
+ error("failed");
endif
@@ -98,6 +98,6 @@ try
a = g.get_value();
catch
error(g, "has not get_value() method")
- error
+ error("failed");
end_try_catch
diff --git a/Examples/test-suite/octave/template_typedef_runme.m b/Examples/test-suite/octave/template_typedef_runme.m
index 8d8af795b..2a734e207 100644
--- a/Examples/test-suite/octave/template_typedef_runme.m
+++ b/Examples/test-suite/octave/template_typedef_runme.m
@@ -8,7 +8,7 @@ try
a = swig_this(d);
a = swig_this(c);
catch
- error
+ error("failed");
end_try_catch
try
@@ -37,15 +37,15 @@ end_try_catch
# the old large format
if (strcmp("<unknown>",swig_typequery("vfncs::ArithUnaryFunction<vfncs::arith_traits<float,double>::argument_type,vfncs::arith_traits<float,double >::result_type > *")))
- error
+ error("failed");
endif
# the reduced format
if (strcmp("<unknown>",swig_typequery("vfncs::ArithUnaryFunction<double,double> *")))
- error
+ error("failed");
endif
# this is a bad name
if (!strcmp("<unknown>",swig_typequery("vfncs::ArithUnaryFunction<double,doublex> *")))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/typedef_inherit_runme.m b/Examples/test-suite/octave/typedef_inherit_runme.m
index fbe5436d1..b562e3125 100644
--- a/Examples/test-suite/octave/typedef_inherit_runme.m
+++ b/Examples/test-suite/octave/typedef_inherit_runme.m
@@ -30,3 +30,8 @@ x = typedef_inherit.do_blah2(d);
if (!strcmp(x,"Grok::blah"))
error("Whoa! Bad return", x)
endif
+
+x = d.far();
+if (!strcmp(x,"Spam::far"))
+ error("Whoa! Bad return", x)
+endif
diff --git a/Examples/test-suite/octave/typemap_namespace_runme.m b/Examples/test-suite/octave/typemap_namespace_runme.m
index ec62a3910..e67781c66 100644
--- a/Examples/test-suite/octave/typemap_namespace_runme.m
+++ b/Examples/test-suite/octave/typemap_namespace_runme.m
@@ -1,10 +1,10 @@
typemap_namespace
if (!strcmp(test1("hello"),"hello"))
- error
+ error("failed");
endif
if (!strcmp(test2("hello"),"hello"))
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/typemap_ns_using_runme.m b/Examples/test-suite/octave/typemap_ns_using_runme.m
index dd3f657f0..d94241b9c 100644
--- a/Examples/test-suite/octave/typemap_ns_using_runme.m
+++ b/Examples/test-suite/octave/typemap_ns_using_runme.m
@@ -1,5 +1,5 @@
typemap_ns_using
if (typemap_ns_using.spam(37) != 37)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/types_directive_runme.m b/Examples/test-suite/octave/types_directive_runme.m
index 0757c6c39..5ad4af1bb 100644
--- a/Examples/test-suite/octave/types_directive_runme.m
+++ b/Examples/test-suite/octave/types_directive_runme.m
@@ -3,13 +3,13 @@ types_directive
d1 = Time1(2001, 2, 3, 60);
newDate = add(d1, 7); # check that a Time1 instance is accepted where Date is expected
if (newDate.day != 10)
- error
+ error("failed");
endif
d2 = Time2(1999, 8, 7, 60);
newDate = add(d2, 7); # check that a Time2 instance is accepted where Date is expected
if (newDate.day != 14)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/using1_runme.m b/Examples/test-suite/octave/using1_runme.m
index 9253a1d35..e25128ec7 100644
--- a/Examples/test-suite/octave/using1_runme.m
+++ b/Examples/test-suite/octave/using1_runme.m
@@ -6,5 +6,5 @@ endif
using1
if (using1.spam(37) != 37)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/using2_runme.m b/Examples/test-suite/octave/using2_runme.m
index 7cc668940..0213ee7c6 100644
--- a/Examples/test-suite/octave/using2_runme.m
+++ b/Examples/test-suite/octave/using2_runme.m
@@ -6,5 +6,5 @@ endif
using2
if (using2.spam(37) != 37)
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/virtual_poly_runme.m b/Examples/test-suite/octave/virtual_poly_runme.m
index 0c7c95153..363f86798 100644
--- a/Examples/test-suite/octave/virtual_poly_runme.m
+++ b/Examples/test-suite/octave/virtual_poly_runme.m
@@ -10,23 +10,23 @@ dc = d.copy();
ic = i.copy();
if (d.get() != dc.get())
- error
+ error("failed");
endif
if (i.get() != ic.get())
- error
+ error("failed");
endif
virtual_poly.incr(ic);
if ((i.get() + 1) != ic.get())
- error
+ error("failed");
endif
dr = d.ref_this();
if (d.get() != dr.get())
- error
+ error("failed");
endif
@@ -35,10 +35,10 @@ endif
#
ddc = virtual_poly.NDouble_narrow(d.nnumber());
if (d.get() != ddc.get())
- error
+ error("failed");
endif
dic = virtual_poly.NInt_narrow(i.nnumber());
if (i.get() != dic.get())
- error
+ error("failed");
endif
diff --git a/Examples/test-suite/octave/voidtest_runme.m b/Examples/test-suite/octave/voidtest_runme.m
index fb411ee4e..c4815a597 100644
--- a/Examples/test-suite/octave/voidtest_runme.m
+++ b/Examples/test-suite/octave/voidtest_runme.m
@@ -27,16 +27,16 @@ end_try_catch
v1 = voidtest.vfunc1(f);
v2 = voidtest.vfunc2(f);
if (swig_this(v1) != swig_this(v2))
- error
+ error("failed");
endif
v3 = voidtest.vfunc3(v1);
if (swig_this(v3) != swig_this(f))
- error
+ error("failed");
endif
v4 = voidtest.vfunc1(f);
if (swig_this(v4) != swig_this(v1))
- error
+ error("failed");
endif