Skip to content

Commit ce3ac37

Browse files
committed
Update tests from upstream
1 parent ed5930b commit ce3ac37

File tree

7 files changed

+84
-90
lines changed

7 files changed

+84
-90
lines changed

Examples/test-suite/argcargvtest.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%module argcargvtest
22

3-
#if !defined(SWIGCSHARP) && !defined(SWIGD) && !defined(SWIGGO) && !defined(SWIGGUILE) && !defined(SWIGJAVA) && !defined(SWIGJAVASCRIPT) && !defined(SWIGMZSCHEME) && !defined(SWIGOCAML) && !defined(SWIGR) && !defined(SWIGSCILAB)
3+
#if !defined(SWIGCSHARP) && !defined(SWIGD) && !defined(SWIGFORTRAN) && !defined(SWIGGO) && !defined(SWIGGUILE) && !defined(SWIGJAVA) && !defined(SWIGJAVASCRIPT) && !defined(SWIGMZSCHEME) && !defined(SWIGOCAML) && !defined(SWIGR) && !defined(SWIGSCILAB)
44
%include <argcargv.i>
55

66
%apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }

Examples/test-suite/common.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ CPP_TEST_CASES += \
224224
disown \
225225
dynamic_cast \
226226
empty \
227-
enum_callback \
228227
enum_ignore \
229228
enum_plus \
230229
enum_rename \

Examples/test-suite/cpp_basic.i

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class Foo {
2424
int func1(int a) {
2525
return 2*a*num;
2626
}
27-
27+
2828
int func2(int a) {
2929
return -a*num;
3030
}
31-
31+
3232
int (Foo::*func_ptr)(int);
3333

3434
const char* __str__() const { return "Foo"; }
@@ -58,7 +58,7 @@ static Foo init_ref = Foo(-4);
5858
class Bar {
5959
public:
6060
Bar() : fptr(0), fref(init_ref), fval(15) , cint(3) {}
61-
61+
6262
Foo *fptr;
6363
Foo &fref;
6464
Foo fval;

Examples/test-suite/enum_callback.i

Lines changed: 0 additions & 14 deletions
This file was deleted.

Examples/test-suite/fortran/Makefile.in

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ top_srcdir = @top_srcdir@
2121
top_builddir = @top_builddir@
2222

2323
CPP_TEST_CASES = \
24+
complextest \
2425
fortran_bindc \
2526
fortran_callback \
2627
fortran_naming \
@@ -29,7 +30,6 @@ CPP_TEST_CASES = \
2930
fortran_std_span \
3031
fortran_subroutine \
3132
li_std_set \
32-
complextest \
3333

3434
C_TEST_CASES = \
3535
fortran_array_typemap \
@@ -39,72 +39,76 @@ C_TEST_CASES = \
3939
ccomplextest \
4040

4141
FAILING_CPP_TESTS += \
42-
contract \
43-
global_scope_types \
44-
grouping \
45-
member_funcptr_galore \
46-
member_pointer \
47-
member_pointer_const \
48-
namespace_class \
49-
nested_scope_flat \
50-
overload_arrays \
51-
overload_complicated \
52-
overload_return_type \
53-
overload_simple \
54-
overload_subtype \
55-
smart_pointer_member \
56-
smart_pointer_template_defaults_overload \
57-
typedef_classforward_same_name \
58-
cpp11_result_of \
59-
cpp11_rvalue_reference2 \
60-
cpp11_rvalue_reference3 \
61-
cpp11_default_delete \
6242
allprotected \
63-
apply_strings \
6443
apply_signed_char \
44+
apply_strings \
45+
contract \
6546
director_abstract \
66-
director_binary_string \
67-
director_classic \
6847
director_basic \
69-
director_default \
70-
director_detect \
48+
director_binary_string \
7149
director_classes \
50+
director_classic \
7251
director_comparison_operators \
7352
director_conversion_operators \
53+
director_default \
54+
director_detect \
55+
director_enum \
56+
director_exception \
7457
director_exception_catches \
7558
director_exception_nothrow \
76-
director_exception \
77-
director_enum \
59+
director_extend \
7860
director_frob \
61+
director_ignore \
62+
director_keywords \
63+
director_namespace_clash \
7964
director_nested \
80-
director_extend \
81-
director_nspace_director_name_collision \
8265
director_nspace \
83-
director_keywords \
66+
director_nspace_director_name_collision \
8467
director_overload \
85-
director_namespace_clash \
86-
director_pass_by_value \
87-
director_ignore \
68+
director_overload2 \
8869
director_ownership \
70+
director_pass_by_value \
71+
director_primitives \
72+
director_property \
8973
director_protected \
74+
director_protected_overloaded \
75+
director_redefined \
9076
director_ref \
91-
director_property \
92-
director_primitives \
9377
director_smartptr \
78+
director_string \
9479
director_unroll \
95-
director_overload2 \
96-
director_protected_overloaded \
9780
director_using \
98-
director_redefined \
99-
director_wombat \
81+
director_using_member_scopes \
10082
director_void \
83+
director_wombat \
84+
global_scope_types \
85+
grouping \
10186
li_boost_shared_ptr_director \
87+
member_funcptr_galore \
88+
member_pointer \
89+
member_pointer_const \
90+
namespace_class \
10291
nested_directors \
92+
nested_scope_flat \
93+
overload_arrays \
94+
overload_complicated \
95+
overload_return_type \
96+
overload_simple \
97+
overload_subtype \
98+
smart_pointer_member \
99+
smart_pointer_template_defaults_overload \
100+
typedef_classforward_same_name \
103101
typemap_directorout \
104-
director_string \
102+
using_member_scopes \
103+
104+
FAILING_CPP_TESTS += \
105+
cpp11_default_delete \
105106
cpp11_director_enums \
106107
cpp11_directors \
107108
cpp11_function_objects \
109+
cpp11_result_of \
110+
cpp11_rvalue_reference2 \
111+
cpp11_rvalue_reference3 \
108112

109113
FAILING_C_TESTS += \
110114
char_constant \
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
! File : constructor_copy_runme.F90
2+
3+
#include "fassert.h"
4+
5+
program constructor_copy_runme
6+
implicit none
7+
8+
call test_assignment
9+
10+
contains
11+
12+
subroutine test_assignment
13+
use constructor_copy
14+
use ISO_C_BINDING
15+
implicit none
16+
type(Bari) :: a, b, c
17+
18+
ASSERT(.not. c_associated(a%swigdata%cptr))
19+
ASSERT(a%swigdata%cmemflags == 0)
20+
21+
! Create
22+
a = Bari(123)
23+
ASSERT(a%get_x() == 123)
24+
! Copy
25+
b = Bari(a)
26+
! Value should be same, but pointers should not
27+
ASSERT(b%get_x() == 123)
28+
ASSERT(.not. c_associated(a%swigdata%cptr, b%swigdata%cptr))
29+
30+
call b%release()
31+
call a%release()
32+
end subroutine
33+
34+
end program
35+

Examples/test-suite/fortran/cpp_basic_runme.F90

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
#include "fassert.h"
44

55
program cpp_basic_runme
6-
use cpp_basic
7-
use ISO_C_BINDING
86
implicit none
97

108
call test_ownership
11-
call test_assignment
129

1310
contains
1411
subroutine test_ownership
@@ -57,32 +54,5 @@ subroutine test_ownership
5754
ASSERT(c%swigdata%cmemflags == 0)
5855

5956
end subroutine
60-
61-
subroutine test_assignment
62-
use cpp_basic
63-
use ISO_C_BINDING
64-
implicit none
65-
type(Foo) :: a, b, c
66-
67-
ASSERT(.not. c_associated(a%swigdata%cptr))
68-
ASSERT(a%swigdata%cmemflags == 0)
69-
70-
! Create
71-
a = Foo(123)
72-
ASSERT(a%func1(3) == 2 * 3 * 123)
73-
! Copy
74-
b = Foo(a)
75-
! Value should be same, but pointers should not
76-
ASSERT(b%func1(3) == 2 * 3 * 123)
77-
ASSERT(.not. c_associated(a%swigdata%cptr, b%swigdata%cptr))
78-
79-
! Get reference to b, then release b
80-
c = get_reference(b)
81-
call b%release()
82-
! 'c' is a reference to deleted data, but it shouldn't crash when we clear it
83-
call c%release()
84-
! Release 'a's memory
85-
call a%release()
86-
end subroutine
8757
end program
8858

0 commit comments

Comments
 (0)