summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
authorErez Geva <ErezGeva2@gmail.com>2023-05-03 12:09:15 +0200
committerOlly Betts <olly@survex.com>2023-05-04 13:18:10 +1200
commit63b1293e1a760e0ce1a27208a5231e705c8f0f3b (patch)
tree49ae567d51c5b72ace63a15b54612308274ee56a /Examples
parentdada37e1d1a860100c23f7971b0aac58154441fa (diff)
downloadswig-63b1293e1a760e0ce1a27208a5231e705c8f0f3b.tar.gz
Drop D version 1
See #2538
Diffstat (limited to 'Examples')
-rw-r--r--Examples/Makefile.in13
-rw-r--r--Examples/d/callback/d1/runme.d36
-rw-r--r--Examples/d/class/d1/runme.d58
-rw-r--r--Examples/d/constants/d1/runme.d28
-rw-r--r--Examples/d/enum/d1/runme.d28
-rw-r--r--Examples/d/example.mk.in36
-rw-r--r--Examples/d/extend/d1/runme.d75
-rw-r--r--Examples/d/funcptr/d1/runme.d42
-rw-r--r--Examples/d/simple/d1/runme.d27
-rw-r--r--Examples/d/variables/d1/runme.d71
-rw-r--r--Examples/test-suite/d/Makefile.in40
-rw-r--r--Examples/test-suite/d/aggregate_runme.1.d25
-rw-r--r--Examples/test-suite/d/allprotected_runme.1.d65
-rw-r--r--Examples/test-suite/d/apply_strings_runme.1.d12
-rw-r--r--Examples/test-suite/d/bools_runme.1.d20
-rw-r--r--Examples/test-suite/d/catches_runme.1.d33
-rw-r--r--Examples/test-suite/d/catches_strings_runme.1.d32
-rw-r--r--Examples/test-suite/d/char_strings_runme.1.d151
-rw-r--r--Examples/test-suite/d/constover_runme.1.d31
-rw-r--r--Examples/test-suite/d/cpp11_move_typemaps_runme.1.d42
-rw-r--r--Examples/test-suite/d/cpp11_rvalue_reference_move_runme.1.d86
-rw-r--r--Examples/test-suite/d/cpp11_std_unique_ptr_runme.1.d123
-rw-r--r--Examples/test-suite/d/d_nativepointers_runme.1.d38
-rw-r--r--Examples/test-suite/d/default_args_runme.1.d127
-rw-r--r--Examples/test-suite/d/default_constructor_runme.1.d17
-rw-r--r--Examples/test-suite/d/director_alternating_runme.1.d7
-rw-r--r--Examples/test-suite/d/director_basic_runme.1.d59
-rw-r--r--Examples/test-suite/d/director_classes_runme.1.d177
-rw-r--r--Examples/test-suite/d/director_classic_runme.1.d207
-rw-r--r--Examples/test-suite/d/director_ignore_runme.1.d39
-rw-r--r--Examples/test-suite/d/director_primitives_runme.1.d122
-rw-r--r--Examples/test-suite/d/director_protected_runme.1.d50
-rw-r--r--Examples/test-suite/d/director_string_runme.1.d46
-rw-r--r--Examples/test-suite/d/enum_thorough_runme.1.d447
-rw-r--r--Examples/test-suite/d/inherit_target_language_runme.1.d29
-rw-r--r--Examples/test-suite/d/li_attribute_runme.1.d75
-rw-r--r--Examples/test-suite/d/li_boost_shared_ptr_bits_runme.1.d21
-rw-r--r--Examples/test-suite/d/li_boost_shared_ptr_runme.1.d604
-rw-r--r--Examples/test-suite/d/li_std_auto_ptr_runme.1.d123
-rw-r--r--Examples/test-suite/d/li_std_except_runme.1.d40
-rw-r--r--Examples/test-suite/d/li_std_string_runme.1.d97
-rw-r--r--Examples/test-suite/d/li_std_vector_runme.1.d219
-rw-r--r--Examples/test-suite/d/li_typemaps_runme.1.d94
-rw-r--r--Examples/test-suite/d/long_long_runme.1.d35
-rw-r--r--Examples/test-suite/d/member_pointer_runme.1.d43
-rw-r--r--Examples/test-suite/d/nspace_extend_runme.1.d32
-rw-r--r--Examples/test-suite/d/nspace_runme.1.d87
-rw-r--r--Examples/test-suite/d/operator_overload_runme.1.d89
-rw-r--r--Examples/test-suite/d/overload_complicated_runme.1.d50
-rw-r--r--Examples/test-suite/d/overload_template_runme.1.d146
-rw-r--r--Examples/test-suite/d/pointer_reference_runme.1.d13
-rw-r--r--Examples/test-suite/d/preproc_constants_c_runme.1.d69
-rw-r--r--Examples/test-suite/d/preproc_constants_runme.1.d68
-rw-r--r--Examples/test-suite/d/sizet_runme.1.d15
-rw-r--r--Examples/test-suite/d/sneaky1_runme.1.d21
-rw-r--r--Examples/test-suite/d/special_variable_macros_runme.1.d43
-rw-r--r--Examples/test-suite/d/threads_runme.1.d70
-rw-r--r--Examples/test-suite/d/throw_exception_runme.1.d30
-rw-r--r--Examples/test-suite/d/typemap_namespace_runme.1.d13
-rw-r--r--Examples/test-suite/d/typemap_out_optimal_runme.1.d10
-rw-r--r--Examples/test-suite/d/varargs_runme.1.d20
-rw-r--r--Examples/test-suite/d/virtual_poly_runme.1.d27
-rw-r--r--Examples/test-suite/special_variable_macros.i8
63 files changed, 26 insertions, 4575 deletions
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 5a4639076..9cbdeee78 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -280,17 +280,8 @@ csharp_clean:
DLIBPREFIX = @DLIBPREFIX@
-ifeq (,$(D_VERSION))
- D_VERSION = @DDEFAULTVERSION@
-endif
-
-ifeq (2,$(D_VERSION))
- SWIGD = $(SWIG) -d -d2
- DCOMPILER = @D2COMPILER@
-else
- SWIGD = $(SWIG) -d
- DCOMPILER = @D1COMPILER@
-endif
+SWIGD = $(SWIG) -d -d2
+DCOMPILER = @D2COMPILER@
D_RUNME = ./$(RUNME)
diff --git a/Examples/d/callback/d1/runme.d b/Examples/d/callback/d1/runme.d
deleted file mode 100644
index e34e09603..000000000
--- a/Examples/d/callback/d1/runme.d
+++ /dev/null
@@ -1,36 +0,0 @@
-module runme;
-
-import tango.io.Stdout;
-import example;
-
-public class DCallback : Callback {
- public override void run() {
- Stdout( "DCallback.run()" ).newline;
- }
-}
-
-void main() {
- auto caller = new Caller();
-
- Stdout( "Adding and calling a normal C++ callback" ).newline;
- Stdout( "----------------------------------------" ).newline;
- {
- scope auto callback = new Callback();
- caller.setCallback(callback);
- caller.call();
- caller.resetCallback();
- }
-
- Stdout.newline;
- Stdout( "Adding and calling a D callback" ).newline;
- Stdout( "-------------------------------" ).newline;
- {
- scope auto callback = new DCallback();
- caller.setCallback(callback);
- caller.call();
- caller.resetCallback();
- }
-
- Stdout.newline;
- Stdout( "D exit" ).newline;
-}
diff --git a/Examples/d/class/d1/runme.d b/Examples/d/class/d1/runme.d
deleted file mode 100644
index b0c4263a2..000000000
--- a/Examples/d/class/d1/runme.d
+++ /dev/null
@@ -1,58 +0,0 @@
-// This example illustrates how C++ classes can be used from D using SWIG.
-// The D class gets mapped onto the C++ class and behaves as if it is a D class.
-module runme;
-
-import tango.io.Stdout;
-import example;
-
-void main() {
- // ----- Object creation -----
-
- Stdout( "Creating some objects:" ).newline;
-
- {
- scope Square s = new Square(10);
- scope Circle c = new Circle(10);
-
- // ----- Access a static member -----
- Stdout.format( "{} shapes were created.", Shape.nshapes ).newline;
-
- // ----- Member data access -----
-
- // Notice how we can do this using functions specific to
- // the 'Circle' class.
- c.x = 20;
- c.y = 30;
-
- // Now use the same functions in the base class
- Shape shape = s;
- shape.x = -10;
- shape.y = 5;
-
- Stdout( "\nHere is their current position:" ).newline;
- Stdout.format( " Circle = ( {}, {} )", c.x, c.y ).newline;
- Stdout.format( " Square = ( {}, {} )", s.x, s.y ).newline;
-
- // ----- Call some methods -----
-
- Stdout( "\nHere are some properties of the shapes:" ).newline;
- Shape[] shapes = [ cast(Shape) c, cast(Shape) s ];
- foreach ( currentShape; shapes )
- {
- Stdout.format( " {}", currentShape.classinfo.name ).newline;
- Stdout.format( " area = {}", currentShape.area() ).newline;
- Stdout.format( " perimeter = {}", currentShape.perimeter() ).newline;
- }
-
- // Notice how the area() and perimeter() functions really
- // invoke the appropriate virtual method on each object.
-
- // ----- Delete everything -----
- Stdout( "\nGuess I'll clean up now:" ).newline;
- // Note: when this using scope is exited the D destructors are called which
- // in turn call the C++ destructors.
- }
-
- Stdout.format( "{} shapes remain", Shape.nshapes ).newline;
- Stdout( "\nGoodbye!" ).newline;
-}
diff --git a/Examples/d/constants/d1/runme.d b/Examples/d/constants/d1/runme.d
deleted file mode 100644
index 47362cbf3..000000000
--- a/Examples/d/constants/d1/runme.d
+++ /dev/null
@@ -1,28 +0,0 @@
-module runme;
-
-import tango.io.Stdout;
-static import example;
-
-void main() {
- Stdout.formatln("ICONST = {} (should be 42)", example.ICONST);
- Stdout.formatln("FCONST = {} (should be 2.18)", example.FCONST);
- Stdout.formatln("CCONST = {} (should be 'x')", example.CCONST);
- Stdout.formatln("CCONST2 = {} (this should be on a new line)", example.CCONST2);
- Stdout.formatln("SCONST = {} (should be 'Hello World')", example.SCONST);
- Stdout.formatln("SCONST2 = {} (should be '\"Hello World\"')", example.SCONST2);
- Stdout.formatln("EXPR = {} (should be 48.55)", example.EXPR);
- Stdout.formatln("iconst = {} (should be 37)", example.iconst);
- Stdout.formatln("fconst = {} (should be 3.14)", example.fconst);
-
- static if (is(typeof(example.EXTERN))) {
- Stdout.formatln("EXTERN should not be defined, but is: {}.", example.EXTERN );
- } else {
- Stdout.formatln("EXTERN isn't defined (good)");
- }
-
- static if (is(typeof(example.FOO))) {
- Stdout.formatln("FOO should not be defined, but is: {}.", example.FOO);
- } else {
- Stdout.formatln("FOO isn't defined (good)");
- }
-}
diff --git a/Examples/d/enum/d1/runme.d b/Examples/d/enum/d1/runme.d
deleted file mode 100644
index d986986d1..000000000
--- a/Examples/d/enum/d1/runme.d
+++ /dev/null
@@ -1,28 +0,0 @@
-module runme;
-
-import tango.io.Stdout;
-import example;
-
-void main() {
- Stdout( "Printing out some enum values:" ).newline;
- Stdout(" color:").newline;
- Stdout.formatln(" {} = {}", color.RED, cast(int)color.RED);
- Stdout.formatln(" {} = {}", color.BLUE, cast(int)color.BLUE);
- Stdout.formatln(" {} = {}", color.GREEN, cast(int)color.GREEN);
-
- Stdout("\n Foo.speed:").newline;
- Stdout.formatln(" Foo.{} = {}", Foo.speed.IMPULSE, cast(int)Foo.speed.IMPULSE);
- Stdout.formatln(" Foo.{} = {}", Foo.speed.WARP, cast(int)Foo.speed.WARP);
- Stdout.formatln(" Foo.{} = {}", Foo.speed.LUDICROUS , cast(int)Foo.speed.LUDICROUS);
-
- Stdout("\nTesting use of enums with functions:").newline;
- example.enum_test(color.RED, Foo.speed.IMPULSE);
- example.enum_test(color.BLUE, Foo.speed.WARP);
- example.enum_test(color.GREEN, Foo.speed.LUDICROUS);
-
- Stdout( "\nTesting use of enum with class method:" ).newline;
- scope f = new Foo();
- f.enum_test(Foo.speed.IMPULSE);
- f.enum_test(Foo.speed.WARP);
- f.enum_test(Foo.speed.LUDICROUS);
-}
diff --git a/Examples/d/example.mk.in b/Examples/d/example.mk.in
index 84b3ceb09..766057f3f 100644
--- a/Examples/d/example.mk.in
+++ b/Examples/d/example.mk.in
@@ -1,26 +1,10 @@
#
# Common Makefile code for building D examples.
#
-# We actually need to configure this to gain access to the default D version to
-# use when D_VERSION is not set. Using Examples/Makefile.in is not enough, as
-# the location of the source files (d1/ or d2/) depends on it. The alternative
-# would be to add the functionality specific to Examples/d (as opposed to the
-# test suite) directly to Examples/Makefile.in.
-#
# This file is supposed to be included from a Makefile in the subdirectory
# corresponding to a specific example.
#
-ifeq (,$(D_VERSION))
- D_VERSION = @DDEFAULTVERSION@
-endif
-
-ifeq (1,$(D_VERSION))
- VERSION_DIR = d1/
-else
- VERSION_DIR = d2/
-endif
-
EXAMPLES_TOP = ../../..
SWIG_TOP = ../../../..
SWIGEXE = $(SWIG_TOP)/swig
@@ -35,32 +19,32 @@ DFLAGS = -ofrunme
ifeq (,$(SRCDIR))
DSRCS = *.d
else
-DSRCS = *.d $(addprefix ../$(SRCDIR)$(VERSION_DIR),runme.d)
+DSRCS = *.d $(addprefix ../$(SRCDIR)d2/,runme.d)
endif
check: build
- $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' d_run
+ $(MAKE) -C d2/ -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' d_run
build:
- mkdir -p $(VERSION_DIR)
+ mkdir -p d2/
if [ -f $(SRCDIR)example.cxx ]; then \
- $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CXXFLAGS='$(EXTRA_CXXFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
+ $(MAKE) -C d2/ -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CXXFLAGS='$(EXTRA_CXXFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' CXXSRCS='example.cxx' d_cpp; \
elif [ -f $(SRCDIR)example.c ]; then \
- $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
+ $(MAKE) -C d2/ -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' SRCS='example.c' d; \
else \
- $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
+ $(MAKE) -C d2/ -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' SRCS='' d; \
fi
- $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile
+ $(MAKE) -C d2/ -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile
clean:
- if [ -d $(VERSION_DIR) ]; then \
- $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' d_clean; \
+ if [ -d d2/ ]; then \
+ $(MAKE) -C d2/ -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' d_clean; \
fi
- test -f $(VERSION_DIR)runme.d || rm -rf $(VERSION_DIR) # Only delete dir if out of source
+ test -f d2/runme.d || rm -rf d2/ # Only delete dir if out of source
diff --git a/Examples/d/extend/d1/runme.d b/Examples/d/extend/d1/runme.d
deleted file mode 100644
index 058432096..000000000
--- a/Examples/d/extend/d1/runme.d
+++ /dev/null
@@ -1,75 +0,0 @@
-/// This file illustrates the cross language polymorphism using directors.
-module runme;
-
-import example;
-import tango.io.Stdout;
-
-// CEO class, which overrides Employee.getPosition().
-class CEO : Manager {
-public:
- this( char[] name ) {
- super( name );
- }
-
- override char[] getPosition() {
- return "CEO";
- }
-
- // Public method to stop the SWIG proxy base class from thinking it owns the underlying C++ memory.
- void disownMemory() {
- swigCMemOwn = false;
- }
-}
-
-void main() {
- // Create an instance of CEO, a class derived from the D proxy of the
- // underlying C++ class. The calls to getName() and getPosition() are standard,
- // the call to getTitle() uses the director wrappers to call CEO.getPosition().
-
- auto e = new CEO( "Alice" );
- Stdout.formatln( "{} is a {}.", e.getName(), e.getPosition() );
- Stdout.formatln( "Just call her '{}'.", e.getTitle() );
- Stdout( "----------------------" ).newline;
-
- {
- // Create a new EmployeeList instance. This class does not have a C++
- // director wrapper, but can be used freely with other classes that do.
- scope auto list = new EmployeeList();
-
- // EmployeeList owns its items, so we must surrender ownership of objects we add.
- e.disownMemory();
- list.addEmployee(e);
- Stdout( "----------------------" ).newline;
-
- // Now we access the first four items in list (three are C++ objects that
- // EmployeeList's constructor adds, the last is our CEO). The virtual
- // methods of all these instances are treated the same. For items 0, 1, and
- // 2, all methods resolve in C++. For item 3, our CEO, getTitle calls
- // getPosition which resolves in D. The call to getPosition is
- // slightly different, however, because of the overridden getPosition() call, since
- // now the object reference has been "laundered" by passing through
- // EmployeeList as an Employee*. Previously, D resolved the call
- // immediately in CEO, but now D thinks the object is an instance of
- // class Employee. So the call passes through the
- // Employee proxy class and on to the C wrappers and C++ director,
- // eventually ending up back at the D CEO implementation of getPosition().
- // The call to getTitle() for item 3 runs the C++ Employee::getTitle()
- // method, which in turn calls getPosition(). This virtual method call
- // passes down through the C++ director class to the D implementation
- // in CEO. All this routing takes place transparently.
-
- Stdout( "(position, title) for items 0-3:" ).newline;
- Stdout.formatln( " {}, '{}'", list.getItem(0).getPosition(), list.getItem(0).getTitle() );
- Stdout.formatln( " {}, '{}'", list.getItem(1).getPosition(), list.getItem(1).getTitle() );
- Stdout.formatln( " {}, '{}'", list.getItem(2).getPosition(), list.getItem(2).getTitle() );
- Stdout.formatln( " {}, '{}'", list.getItem(3).getPosition(), list.getItem(3).getTitle() );
- Stdout( "----------------------" ).newline;
-
- // All Employees will be destroyed when the EmployeeList goes out of scope,
- // including the CEO instance.
- }
- Stdout( "----------------------" ).newline;
-
- // All done.
- Stdout( "Exiting cleanly from D code." ).newline;
-}
diff --git a/Examples/d/funcptr/d1/runme.d b/Examples/d/funcptr/d1/runme.d
deleted file mode 100644
index 1461c1546..000000000
--- a/Examples/d/funcptr/d1/runme.d
+++ /dev/null
@@ -1,42 +0,0 @@
-module runme;
-
-import tango.io.Stdout;
-static import example;
-
-extern(C) int add(int a, int b) {
- return a + b;
-}
-
-extern(C) int sub(int a, int b) {
- return a - b;
-}
-
-extern(C) int mul(int a, int b) {
- return a * b;
-}
-
-void main() {
- int a = 37;
- int b = 42;
-
- Stdout( "a = " )( a ).newline;
- Stdout( "b = " )( b ).newline;
-
- Stdout( "Trying some C callback functions:" ).newline;
- Stdout( " ADD(a,b) = " )( example.do_op( a, b, example.ADD ) ).newline;
- Stdout( " SUB(a,b) = " )( example.do_op( a, b, example.SUB ) ).newline;
- Stdout( " MUL(a,b) = " )( example.do_op( a, b, example.MUL ) ).newline;
-
- version (LDC) {
- // Currently, there is no way to specify the calling convention for
- // function pointer parameters in D, but LDC does strict typechecking for
- // them (which is reasonable, but not covered by the language spec yet).
- // As a result, there is no way to make the code below compile with LDC at
- // the moment, so just skip it.
- } else {
- Stdout( "Now the same with callback functions defined in D:" ).newline;
- Stdout( " add(a,b) = " )( example.do_op( a, b, &add ) ).newline;
- Stdout( " sub(a,b) = " )( example.do_op( a, b, &sub ) ).newline;
- Stdout( " mul(a,b) = " )( example.do_op( a, b, &mul ) ).newline;
- }
-}
diff --git a/Examples/d/simple/d1/runme.d b/Examples/d/simple/d1/runme.d
deleted file mode 100644
index 1293f1839..000000000
--- a/Examples/d/simple/d1/runme.d
+++ /dev/null
@@ -1,27 +0,0 @@
-module runme;
-
-import tango.io.Stdout;
-static import example;
-
-void main() {
- /*
- * Call our gcd() function.
- */
- int x = 42;
- int y = 105;
- int g = example.gcd( x, y );
- Stdout.format( "The gcd of {} and {} is {}.", x, y, g ).newline;
-
- /*
- * Manipulate the Foo global variable.
- */
-
- // Output its current value
- Stdout.format( "Foo = {}", example.Foo ).newline;
-
- // Change its value
- example.Foo = 3.1415926;
-
- // See if the change took effect
- Stdout.format( "Foo = {}", example.Foo ).newline;
-}
diff --git a/Examples/d/variables/d1/runme.d b/Examples/d/variables/d1/runme.d
deleted file mode 100644
index 35c896bdc..000000000
--- a/Examples/d/variables/d1/runme.d
+++ /dev/null
@@ -1,71 +0,0 @@
-// This example illustrates global variable access from C#.
-module runme;
-
-import tango.io.Stdout;
-static import example;
-
-void main() {
- // Try to set the values of some global variables
- example.ivar = 42;
- example.svar = -31000;
- example.lvar = 65537;
- example.uivar = 123456;
- example.usvar = 61000;
- example.ulvar = 654321;
- example.scvar = -13;
- example.ucvar = 251;
- example.cvar = 'S';
- example.fvar = 3.14159f;
- example.dvar = 2.1828;
- example.strvar = "Hello World";
- example.iptrvar = example.new_int(37);
- example.ptptr = example.new_Point(37,42);
- example.name = "Bill";
-
- // Now print out the values of the variables
- Stdout.formatln( "Variables (printed from D):" );
- Stdout.formatln( "ivar = {}", example.ivar );
- Stdout.formatln( "svar = {}", example.svar );
- Stdout.formatln( "lvar = {}", example.lvar );
- Stdout.formatln( "uivar = {}", example.uivar );
- Stdout.formatln( "usvar = {}", example.usvar );
- Stdout.formatln( "ulvar = {}", example.ulvar );
- Stdout.formatln( "scvar = {}", example.scvar );
- Stdout.formatln( "ucvar = {}", example.ucvar );
- Stdout.formatln( "fvar = {}", example.fvar );
- Stdout.formatln( "dvar = {}", example.dvar );
- Stdout.formatln( "cvar = {}", example.cvar );
- Stdout.formatln( "strvar = {}", example.strvar );
- Stdout.formatln( "cstrvar = {}", example.cstrvar );
- Stdout.formatln( "iptrvar = {}", example.iptrvar );
- Stdout.formatln( "name = {}", example.name );
- Stdout.formatln( "ptptr = {} {}", example.ptptr, example.Point_print(example.ptptr) );
- Stdout.formatln( "pt = {} {}", example.pt, example.Point_print(example.pt) );
- Stdout.formatln( "status = {}", example.status );
-
- Stdout.formatln( "\nVariables (printed from the C library):" );
- example.print_vars();
-
- Stdout.formatln( "\nNow I'm going to try and modify some read only variables:" );
- Stdout.formatln( "Checking that the read only variables are readonly..." );
-
- Stdout( " 'path'..." );
- static if ( is( typeof( example.path = "a" ) ) )
- Stdout.formatln("Oh dear, this variable is not read only!");
- else
- Stdout.formatln("Good.");
-
- Stdout( " 'status'..." );
- static if ( is( typeof( example.status = 2 ) ) )
- Stdout.formatln("Oh dear, this variable is not read only!");
- else
- Stdout.formatln("Good.");
-
- Stdout.formatln( "\nI'm going to try and update a structure variable:" );
-
- example.pt = example.ptptr;
-
- Stdout( "The new value is " ).flush;
- example.pt_print();
- Stdout.formatln( "You should see the value {}", example.Point_print(example.ptptr) );
-}
diff --git a/Examples/test-suite/d/Makefile.in b/Examples/test-suite/d/Makefile.in
index d6486845c..8e8003dcd 100644
--- a/Examples/test-suite/d/Makefile.in
+++ b/Examples/test-suite/d/Makefile.in
@@ -12,18 +12,6 @@ srcdir = @srcdir@
top_srcdir = ../@top_srcdir@
top_builddir = ../@top_builddir@
-ifeq (,$(D_VERSION))
- D_VERSION = @DDEFAULTVERSION@
-endif
-
-ifeq (2,$(D_VERSION))
- VERSIONSUFFIX = .2
-else
- VERSIONSUFFIX = .1
-endif
-
-SCRIPTSUFFIX = _runme$(VERSIONSUFFIX).d
-
CPP_TEST_CASES = \
d_nativepointers \
exception_partial_info
@@ -44,44 +32,44 @@ SWIGOPT+=-splitproxy -package $*
# Rules for the different types of tests
%.cpptest:
$(setup)
- +(cd $*$(VERSIONSUFFIX) && $(swig_and_compile_cpp))
+ +(cd $*.2 && $(swig_and_compile_cpp))
+$(run_testcase)
%.ctest:
$(setup)
- +(cd $*$(VERSIONSUFFIX) && $(swig_and_compile_c))
+ +(cd $*.2 && $(swig_and_compile_c))
+$(run_testcase)
%.multicpptest:
$(setup)
- +(cd $*$(VERSIONSUFFIX) && $(swig_and_compile_multi_cpp))
+ +(cd $*.2 && $(swig_and_compile_multi_cpp))
+$(run_testcase)
# Makes a directory for the testcase if it does not exist
setup = \
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*_runme.2.d ]; then \
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
fi; \
- if [ ! -d $*$(VERSIONSUFFIX) ]; then \
- mkdir $*$(VERSIONSUFFIX); \
+ if [ ! -d $*.2 ]; then \
+ mkdir $*.2; \
fi; \
- if [ ! -d $*$(VERSIONSUFFIX)/$* ]; then \
- mkdir $*$(VERSIONSUFFIX)/$*; \
+ if [ ! -d $*.2/$* ]; then \
+ mkdir $*.2/$*; \
fi
# Compiles D files then runs the testcase. A testcase is only run if
# a file is found which has _runme.d appended after the testcase name.
run_testcase = \
- if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- cd $*$(VERSIONSUFFIX) && \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*_runme.2.d ]; then \
+ cd $*.2 && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
DFLAGS='-of$*_runme' \
- DSRCS='../$(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) `find $* -name *.d`' d_compile && \
+ DSRCS='../$(SCRIPTDIR)/$(SCRIPTPREFIX)$*_runme.2.d `find $* -name *.d`' d_compile && \
env LD_LIBRARY_PATH=".:$$LD_LIBRARY_PATH" $(RUNTOOL) ./$*_runme; \
else \
- cd $*$(VERSIONSUFFIX) && \
+ cd $*.2 && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
DFLAGS='-c' \
DSRCS='`find $* -name *.d`' d_compile && cd .. ; \
@@ -89,6 +77,6 @@ run_testcase = \
# Clean: remove testcase directories
%.clean:
- @if [ -d $*$(VERSIONSUFFIX) ]; then \
- rm -rf $*$(VERSIONSUFFIX); \
+ @if [ -d $*.2 ]; then \
+ rm -rf $*.2; \
fi
diff --git a/Examples/test-suite/d/aggregate_runme.1.d b/Examples/test-suite/d/aggregate_runme.1.d
deleted file mode 100644
index a00d34c25..000000000
--- a/Examples/test-suite/d/aggregate_runme.1.d
+++ /dev/null
@@ -1,25 +0,0 @@
-module aggregate_runme;
-
-import aggregate.aggregate;
-
-void main() {
- // Confirm that move() returns correct results under normal use.
- int result = move(UP);
- if (result != UP) throw new Exception("UP failed");
-
- result = move(DOWN);
- if (result != DOWN) throw new Exception("DOWN failed");
-
- result = move(LEFT);
- if (result != LEFT) throw new Exception("LEFT failed");
-
- result = move(RIGHT);
- if (result != RIGHT) throw new Exception("RIGHT failed");
-
- // Confirm that move() raises an exception when the contract is violated.
- try {
- move(0);
- throw new Exception("0 test failed");
- }
- catch (Exception e) {}
-}
diff --git a/Examples/test-suite/d/allprotected_runme.1.d b/Examples/test-suite/d/allprotected_runme.1.d
deleted file mode 100644
index 82a180e66..000000000
--- a/Examples/test-suite/d/allprotected_runme.1.d
+++ /dev/null
@@ -1,65 +0,0 @@
-module allprotected_runme;
-
-import allprotected.Klass;
-import allprotected.ProtectedBase;
-
-void main() {
- auto mpb = new MyProtectedBase("MyProtectedBase");
- mpb.accessProtected();
-}
-
-class MyProtectedBase : ProtectedBase {
-public:
- this(char[] name) {
- super(name);
- }
-
- void accessProtected() {
- char[] s = virtualMethod();
- if (s != "ProtectedBase")
- throw new Exception("Failed");
-
- Klass k = instanceMethod(new Klass("xyz"));
- if (k.getName() != "xyz")
- throw new Exception("Failed");
-
- k = instanceOverloaded(new Klass("xyz"));
- if (k.getName() != "xyz")
- throw new Exception("Failed");
-
- k = instanceOverloaded(new Klass("xyz"), "abc");
- if (k.getName() != "abc")
- throw new Exception("Failed");
-
- k = staticMethod(new Klass("abc"));
- if (k.getName() != "abc")
- throw new Exception("Failed");
-
- k = staticOverloaded(new Klass("xyz"));
- if (k.getName() != "xyz")
- throw new Exception("Failed");
-
- k = staticOverloaded(new Klass("xyz"), "abc");
- if (k.getName() != "abc")
- throw new Exception("Failed");
-
- instanceMemberVariable = 30;
- int i = instanceMemberVariable;
- if (i != 30)
- throw new Exception("Failed");
-
- staticMemberVariable = 40;
- i = staticMemberVariable;
- if (i != 40)
- throw new Exception("Failed");
-
- i = staticConstMemberVariable;
- if (i != 20)
- throw new Exception("Failed");
-
- anEnum = ProtectedBase.AnEnum.EnumVal1;
- ProtectedBase.AnEnum ae = anEnum;
- if (ae != ProtectedBase.AnEnum.EnumVal1)
- throw new Exception("Failed");
- }
-}
diff --git a/Examples/test-suite/d/apply_strings_runme.1.d b/Examples/test-suite/d/apply_strings_runme.1.d
deleted file mode 100644
index 960caa4ca..000000000
--- a/Examples/test-suite/d/apply_strings_runme.1.d
+++ /dev/null
@@ -1,12 +0,0 @@
-module apply_strings_runme;
-
-import apply_strings.apply_strings;
-
-const char[] TEST_MESSAGE = "A message from target language to the C++ world and back again.";
-
-void main() {
- if (UCharFunction(TEST_MESSAGE) != TEST_MESSAGE) throw new Exception("UCharFunction failed");
- if (SCharFunction(TEST_MESSAGE) != TEST_MESSAGE) throw new Exception("SCharFunction failed");
- auto pChar = CharFunction(null);
- if (pChar !is null) throw new Exception("CharFunction failed");
-}
diff --git a/Examples/test-suite/d/bools_runme.1.d b/Examples/test-suite/d/bools_runme.1.d
deleted file mode 100644
index f501b0762..000000000
--- a/Examples/test-suite/d/bools_runme.1.d
+++ /dev/null
@@ -1,20 +0,0 @@
-/// This is the bool runtime testcase. It checks that the C++ bool type works.
-module bools_runme;
-
-import bools.bools;
-
-void main() {
- bool t = true;
- bool f = false;
-
- check_bo(f);
- check_bo(t);
-}
-
-void check_bo(bool input) {
- for (int i = 0; i < 1000; ++i) {
- if (bo(input) != input) {
- throw new Exception("Runtime test check_bo failed.");
- }
- }
-}
diff --git a/Examples/test-suite/d/catches_runme.1.d b/Examples/test-suite/d/catches_runme.1.d
deleted file mode 100644
index 55b18132d..000000000
--- a/Examples/test-suite/d/catches_runme.1.d
+++ /dev/null
@@ -1,33 +0,0 @@
-module catches_runme;
-
-import catches.catches;
-
-void main() {
- test({ test_catches(1); }, "C++ int exception thrown, value: 1");
- test({ test_catches(2); }, "two");
- test({ test_catches(3); }, "C++ ThreeException const & exception thrown");
-
- test({ test_exception_specification(1); }, "C++ int exception thrown, value: 1");
- test({ test_exception_specification(2); }, "unknown exception");
- test({ test_exception_specification(3); }, "unknown exception");
-
- test({ test_catches_all(1); }, "unknown exception");
-}
-
-void test(void delegate() command, char[] expectedMessage) {
- bool didntThrow;
- try {
- command();
- didntThrow = true;
- } catch (Exception e) {
- if (e.msg != expectedMessage) {
- throw new Exception("Failed to propagate C++ exception. Expected '" ~
- expectedMessage ~ "', but received '" ~ e.msg ~ "'.");
- }
- }
-
- if (didntThrow) {
- throw new Exception("Failed to propagate C++ exception. Expected '" ~
- expectedMessage ~ "', but no exception was thrown.");
- }
-}
diff --git a/Examples/test-suite/d/catches_strings_runme.1.d b/Examples/test-suite/d/catches_strings_runme.1.d
deleted file mode 100644
index 89108355b..000000000
--- a/Examples/test-suite/d/catches_strings_runme.1.d
+++ /dev/null
@@ -1,32 +0,0 @@
-module catches_strings_runme;
-
-import catches_strings.catches_strings;
-import catches_strings.StringsThrower;
-import std.algorithm;
-
-void main() {
- {
- bool exception_thrown = false;
- try {
- StringsThrower.charstring();
- } catch (Exception e) {
- if (!canFind(e.msg, "charstring message"))
- throw new Exception("incorrect exception message:" ~ e.msg);
- exception_thrown = true;
- }
- if (!exception_thrown)
- throw new Exception("Should have thrown an exception");
- }
- {
- bool exception_thrown = false;
- try {
- StringsThrower.stdstring();
- } catch (Exception e) {
- if (!canFind(e.msg, "stdstring message"))
- throw new Exception("incorrect exception message:" ~ e.msg);
- exception_thrown = true;
- }
- if (!exception_thrown)
- throw new Exception("Should have thrown an exception");
- }
-}
diff --git a/Examples/test-suite/d/char_strings_runme.1.d b/Examples/test-suite/d/char_strings_runme.1.d
deleted file mode 100644
index cde6fe0f7..000000000
--- a/Examples/test-suite/d/char_strings_runme.1.d
+++ /dev/null
@@ -1,151 +0,0 @@
-module char_strings_runme;
-
-import tango.text.convert.Integer;
-import char_strings.char_strings;
-
-const char[] CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible.";
-const char[] OTHERLAND_MSG = "Little message from the safe world.";
-
-void main() {
- const uint count = 10000;
- uint i = 0;
-
- // get functions
- for (i=0; i<count; i++) {
- char[] str = GetCharHeapString();
- if (str != CPLUSPLUS_MSG)
- throw new Exception("Test char get 1 failed, iteration " ~ toString(i));
- DeleteCharHeapString();
- }
-
- for (i=0; i<count; i++) {
- char[] str = GetConstCharProgramCodeString();
- if (str != CPLUSPLUS_MSG)
- throw new Exception("Test char get 2 failed, iteration " ~ toString(i));
- DeleteCharHeapString();
- }
-
- for (i=0; i<count; i++) {
- char[] str = GetCharStaticString();
- if (str != CPLUSPLUS_MSG)
- throw new Exception("Test char get 3 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- char[] str = GetCharStaticStringFixed();
- if (str != CPLUSPLUS_MSG)
- throw new Exception("Test char get 4 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- char[] str = GetConstCharStaticStringFixed();
- if (str != CPLUSPLUS_MSG)
- throw new Exception("Test char get 5 failed, iteration " ~ toString(i));
- }
-
- // set functions
- for (i=0; i<count; i++) {
- if (!SetCharHeapString(OTHERLAND_MSG ~ toString(i), i))
- throw new Exception("Test char set 1 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (!SetCharStaticString(OTHERLAND_MSG ~ toString(i), i))
- throw new Exception("Test char set 2 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (!SetCharArrayStaticString(OTHERLAND_MSG ~ toString(i), i))
- throw new Exception("Test char set 3 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (!SetConstCharHeapString(OTHERLAND_MSG ~ toString(i), i))
- throw new Exception("Test char set 4 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (!SetConstCharStaticString(OTHERLAND_MSG ~ toString(i), i))
- throw new Exception("Test char set 5 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (!SetConstCharArrayStaticString(OTHERLAND_MSG ~ toString(i), i))
- throw new Exception("Test char set 6 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (!SetCharConstStaticString(OTHERLAND_MSG ~ toString(i), i))
- throw new Exception("Test char set 7 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (!SetConstCharConstStaticString(OTHERLAND_MSG ~ toString(i), i))
- throw new Exception("Test char set 8 failed, iteration " ~ toString(i));
- }
-
- // get set function
- for (i=0; i<count*10; i++) {
- char[] ping = OTHERLAND_MSG ~ toString(i);
- char[] pong = CharPingPong(ping);
- if (ping != pong)
- throw new Exception("Test PingPong 1 failed.\nExpected:" ~ ping ~ "\nReceived:" ~ pong);
- }
-
- // variables
- for (i=0; i<count; i++) {
- global_char = OTHERLAND_MSG ~ toString(i);
- if (global_char != OTHERLAND_MSG ~ toString(i))
- throw new Exception("Test variables 1 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- global_char_array1 = OTHERLAND_MSG ~ toString(i);
- if (global_char_array1 != OTHERLAND_MSG ~ toString(i))
- throw new Exception("Test variables 2 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- global_char_array2 = OTHERLAND_MSG ~ toString(i);
- if (global_char_array2 != OTHERLAND_MSG ~ toString(i))
- throw new Exception("Test variables 3 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (global_const_char != CPLUSPLUS_MSG)
- throw new Exception("Test variables 4 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (global_const_char_array1 != CPLUSPLUS_MSG)
- throw new Exception("Test variables 5 failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (global_const_char_array2 != CPLUSPLUS_MSG)
- throw new Exception("Test variables 6 failed, iteration " ~ toString(i));
- }
-
- // char *& tests
- for (i=0; i<count; i++) {
- char[] str = GetCharPointerRef();
- if (str != CPLUSPLUS_MSG)
- throw new Exception("Test char pointer ref get failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (!SetCharPointerRef(OTHERLAND_MSG ~ toString(i), i))
- throw new Exception("Test char pointer ref set failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- char[] str = GetConstCharPointerRef();
- if (str != CPLUSPLUS_MSG)
- throw new Exception("Test const char pointer ref get failed, iteration " ~ toString(i));
- }
-
- for (i=0; i<count; i++) {
- if (!SetConstCharPointerRef(OTHERLAND_MSG ~ toString(i), i))
- throw new Exception("Test const char pointer ref set failed, iteration " ~ toString(i));
- }
-}
diff --git a/Examples/test-suite/d/constover_runme.1.d b/Examples/test-suite/d/constover_runme.1.d
deleted file mode 100644
index ead67319e..000000000
--- a/Examples/test-suite/d/constover_runme.1.d
+++ /dev/null
@@ -1,31 +0,0 @@
-module constover_runme;
-
-import constover.constover;
-import constover.Foo;
-
-void main() {
- char[] p = test("test");
- if (p != "test")
- throw new Exception("test failed!");
-
- p = test_pconst("test");
- if (p != "test_pconst")
- throw new Exception("test_pconst failed!");
-
- auto f = new Foo();
- p = f.test("test");
- if (p != "test")
- throw new Exception("member-test failed!");
-
- p = f.test_pconst("test");
- if (p != "test_pconst")
- throw new Exception("member-test_pconst failed!");
-
- p = f.test_constm("test");
- if (p != "test_constmethod")
- throw new Exception("member-test_constm failed!");
-
- p = f.test_pconstm("test");
- if (p != "test_pconstmethod")
- throw new Exception("member-test_pconstm failed!");
-}
diff --git a/Examples/test-suite/d/cpp11_move_typemaps_runme.1.d b/Examples/test-suite/d/cpp11_move_typemaps_runme.1.d
deleted file mode 100644
index 29561cde3..000000000
--- a/Examples/test-suite/d/cpp11_move_typemaps_runme.1.d
+++ /dev/null
@@ -1,42 +0,0 @@
-module cpp11_move_typemaps_runme;
-
-import cpp11_move_typemaps.Counter;
-import cpp11_move_typemaps.MoveOnly;
-import cpp11_move_typemaps.MovableCopyable;
-import std.conv;
-import std.algorithm;
-
-void main() {
- {
- Counter.reset_counts();
- scope MoveOnly mo = new MoveOnly(111);
- Counter.check_counts(1, 0, 0, 0, 0, 0);
- MoveOnly.take(mo);
- Counter.check_counts(1, 0, 0, 1, 0, 2);
- }
- Counter.check_counts(1, 0, 0, 1, 0, 2);
-
- {
- Counter.reset_counts();
- scope MovableCopyable mo = new MovableCopyable(111);
- Counter.check_counts(1, 0, 0, 0, 0, 0);
- MovableCopyable.take(mo);
- Counter.check_counts(1, 0, 0, 1, 0, 2);
- }
- Counter.check_counts(1, 0, 0, 1, 0, 2);
-
- {
- scope MoveOnly mo = new MoveOnly(222);
- MoveOnly.take(mo);
- bool exception_thrown = false;
- try {
- MoveOnly.take(mo);
- } catch (Exception e) {
- if (!canFind(e.msg, "Cannot release ownership as memory is not owned"))
- throw new Exception("incorrect exception message: " ~ e.msg);
- exception_thrown = true;
- }
- if (!exception_thrown)
- throw new Exception("double usage of take should have been an error");
- }
-}
diff --git a/Examples/test-suite/d/cpp11_rvalue_reference_move_runme.1.d b/Examples/test-suite/d/cpp11_rvalue_reference_move_runme.1.d
deleted file mode 100644
index da1d0da32..000000000
--- a/Examples/test-suite/d/cpp11_rvalue_reference_move_runme.1.d
+++ /dev/null
@@ -1,86 +0,0 @@
-module cpp11_rvalue_reference_move_runme;
-
-import cpp11_rvalue_reference_move.Counter;
-import cpp11_rvalue_reference_move.MovableCopyable;
-
-void main() {
- {
- // Function containing rvalue reference parameter
- Counter.reset_counts();
- scope MovableCopyable mo = new 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))
- throw new Exception("is_nullptr failed");
- mo.dispose();
- Counter.check_counts(1, 0, 0, 1, 0, 2);
- }
-
- {
- // Move constructor test
- Counter.reset_counts();
- scope MovableCopyable mo = new MovableCopyable(222);
- Counter.check_counts(1, 0, 0, 0, 0, 0);
- MovableCopyable mo_moved = new MovableCopyable(mo);
- Counter.check_counts(1, 0, 0, 1, 0, 1);
- if (!MovableCopyable.is_nullptr(mo))
- throw new Exception("is_nullptr failed");
- mo.dispose();
- Counter.check_counts(1, 0, 0, 1, 0, 1);
- mo_moved.dispose();
- Counter.check_counts(1, 0, 0, 1, 0, 2);
- }
-
- {
- // Move assignment operator test
- Counter.reset_counts();
- scope MovableCopyable mo111 = new MovableCopyable(111);
- scope MovableCopyable mo222 = new 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))
- throw new Exception("is_nullptr failed");
- mo222.dispose();
- Counter.check_counts(2, 0, 0, 0, 1, 1);
- mo111.dispose();
- Counter.check_counts(2, 0, 0, 0, 1, 2);
- }
-
- {
- // null check
- Counter.reset_counts();
- bool exception_thrown = false;
- try {
- MovableCopyable.movein(null);
- } catch (Exception e) {
- if (!canFind(e.msg, "MovableCopyable && is null"))
- throw new Exception("incorrect exception message:" ~ e.msg);
- exception_thrown = true;
- }
- if (!exception_thrown)
- throw new Exception("Should have thrown null error");
- Counter.check_counts(0, 0, 0, 0, 0, 0);
- }
-
- {
- // output
- Counter.reset_counts();
- MovableCopyable mc = MovableCopyable.moveout(1234);
- Counter.check_counts(2, 0, 0, 0, 1, 1);
- MovableCopyable.check_numbers_match(mc, 1234);
-
- bool exception_thrown = false;
- try {
- MovableCopyable.movein(mc);
- } catch (Exception e) {
- if (!canFind(e.msg, "Cannot release ownership as memory is not owned"))
- throw new Exception("incorrect exception message: " ~ e.msg);
- exception_thrown = true;
- }
- if (!exception_thrown)
- throw new Exception("Should have thrown 'Cannot release ownership as memory is not owned' error");
- Counter.check_counts(2, 0, 0, 0, 1, 1);
- }
-}
diff --git a/Examples/test-suite/d/cpp11_std_unique_ptr_runme.1.d b/Examples/test-suite/d/cpp11_std_unique_ptr_runme.1.d
deleted file mode 100644
index b8e466414..000000000
--- a/Examples/test-suite/d/cpp11_std_unique_ptr_runme.1.d
+++ /dev/null
@@ -1,123 +0,0 @@
-module cpp11_std_unique_ptr_runme;
-
-import cpp11_std_unique_ptr.cpp11_std_unique_ptr;
-import cpp11_std_unique_ptr.Klass;
-import cpp11_std_unique_ptr.KlassInheritance;
-import std.conv;
-import std.algorithm;
-
-void checkCount(int expected_count) {
- int actual_count = Klass.getTotal_count();
- if (actual_count != expected_count)
- throw new Exception("Counts incorrect, expected:" ~ to!string(expected_count) ~ " actual:" ~ to!string(actual_count));
-}
-
-void main() {
- // Test raw pointer handling involving virtual inheritance
- {
- scope KlassInheritance kini = new KlassInheritance("KlassInheritanceInput");
- checkCount(1);
- string s = useKlassRawPtr(kini);
- if (s != "KlassInheritanceInput")
- throw new Exception("Incorrect string: " ~ s);
- }
- checkCount(0);
-
- // unique_ptr as input
- {
- scope Klass kin = new Klass("KlassInput");
- checkCount(1);
- string s = takeKlassUniquePtr(kin);
- checkCount(0);
- if (s != "KlassInput")
- throw new Exception("Incorrect string: " ~ s);
- if (!is_nullptr(kin))
- throw new Exception("is_nullptr failed");
- } // dispose should not fail, even though already deleted
- checkCount(0);
-
- {
- scope Klass kin = new Klass("KlassInput");
- checkCount(1);
- string s = takeKlassUniquePtr(kin);
- checkCount(0);
- if (s != "KlassInput")
- throw new Exception("Incorrect string: " ~ s);
- if (!is_nullptr(kin))
- throw new Exception("is_nullptr failed");
- bool exception_thrown = false;
- try {
- takeKlassUniquePtr(kin);
- } catch (Exception e) {
- if (!canFind(e.msg, "Cannot release ownership as memory is not owned"))
- throw new Exception("incorrect exception message: " ~ e.msg);
- exception_thrown = true;
- }
- if (!exception_thrown)
- throw new Exception("double usage of takeKlassUniquePtr should have been an error");
- } // dispose should not fail, even though already deleted
- checkCount(0);
-
- {
- scope Klass kin = new Klass("KlassInput");
- bool exception_thrown = false;
- Klass notowned = get_not_owned_ptr(kin);
- try {
- takeKlassUniquePtr(notowned);
- } catch (Exception e) {
- if (!canFind(e.msg, "Cannot release ownership as memory is not owned"))
- throw new Exception("incorrect exception message: " ~ e.msg);
- exception_thrown = true;
- }
- if (!exception_thrown)
- throw new Exception("Should have thrown 'Cannot release ownership as memory is not owned' error");
- checkCount(1);
- }
- checkCount(0);
-
- {
- scope KlassInheritance kini = new KlassInheritance("KlassInheritanceInput");
- checkCount(1);
- string s = takeKlassUniquePtr(kini);
- checkCount(0);
- if (s != "KlassInheritanceInput")
- throw new Exception("Incorrect string: " ~ s);
- if (!is_nullptr(kini))
- throw new Exception("is_nullptr failed");
- } // dispose should not fail, even though already deleted
- checkCount(0);
-
- takeKlassUniquePtr(null);
- takeKlassUniquePtr(make_null());
- checkCount(0);
-
- // overloaded parameters
- if (overloadTest() != 0)
- throw new Exception("overloadTest failed");
- if (overloadTest(null) != 1)
- throw new Exception("overloadTest failed");
- if (overloadTest(new Klass("over")) != 1)
- throw new Exception("overloadTest failed");
- checkCount(0);
-
-
- // unique_ptr as output
- Klass k1 = makeKlassUniquePtr("first");
- if (k1.getLabel() != "first")
- throw new Exception("wrong object label");
-
- Klass k2 = makeKlassUniquePtr("second");
- checkCount(2);
-
- k1.dispose();
- checkCount(1);
-
- if (k2.getLabel() != "second")
- throw new Exception("wrong object label");
-
- k2.dispose();
- checkCount(0);
-
- if (makeNullUniquePtr() !is null)
- throw new Exception("null failure");
-}
diff --git a/Examples/test-suite/d/d_nativepointers_runme.1.d b/Examples/test-suite/d/d_nativepointers_runme.1.d
deleted file mode 100644
index dfafacca4..000000000
--- a/Examples/test-suite/d/d_nativepointers_runme.1.d
+++ /dev/null
@@ -1,38 +0,0 @@
-module d_nativepointers_runnme;
-
-import d_nativepointers.d_nativepointers;
-import d_nativepointers.SomeClass;
-import d_nativepointers.SWIGTYPE_p_OpaqueClass;
-import d_nativepointers.SWIGTYPE_p_p_SomeClass;
-import d_nativepointers.SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void;
-
-extern(C) alias void function(int**, char***) GType;
-
-void main() {
- check!(a, int*);
- check!(b, float**);
- check!(c, char***);
- check!(d, SomeClass);
- check!(e, SWIGTYPE_p_p_SomeClass);
- check!(f, SWIGTYPE_p_OpaqueClass);
- check!(g, GType);
- check!(h, SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void);
-
- {
- static assert(is(int* function(int*) == typeof(&refA)));
- int v = 2;
- assert(*refA(&v) == 2);
- }
-
- {
- static assert(is(float** function(float**) == typeof(&refB)));
- float v = 1.0;
- float* p = &v;
- assert(**refB(&p) == 1.0);
- }
-}
-
-void check(alias F, T)() {
- static assert(is(T function(T) == typeof(&F)));
- assert(F(null) is null);
-}
diff --git a/Examples/test-suite/d/default_args_runme.1.d b/Examples/test-suite/d/default_args_runme.1.d
deleted file mode 100644
index 0ad63b7c2..000000000
--- a/Examples/test-suite/d/default_args_runme.1.d
+++ /dev/null
@@ -1,127 +0,0 @@
-module default_args_runme;
-
-import default_args.default_args;
-import default_args.ConstMethods;
-import default_args.EnumClass;
-import default_args.Except;
-import default_args.Foo;
-import default_args.Klass;
-import default_args.Statics;
-import default_args.Tricky;
-
-void main() {
- if (anonymous() != 7771)
- throw new Exception("anonymous (1) failed");
- if (anonymous(1234) != 1234)
- throw new Exception("anonymous (2) failed");
-
- if (booltest() != true)
- throw new Exception("booltest (1) failed");
- if (booltest(true) != true)
- throw new Exception("booltest (2) failed");
- if (booltest(false) != false)
- throw new Exception("booltest (3) failed");
-
- auto ec = new EnumClass();
- if (ec.blah() != true)
- throw new Exception("EnumClass failed");
-
- if (casts1() != null)
- throw new Exception("casts1 failed");
-
- if (casts2() != "Hello")
- throw new Exception("casts2 failed");
-
- if (casts1("Ciao") != "Ciao")
- throw new Exception("casts1 not default failed");
-
- if (chartest1() != 'x')
- throw new Exception("chartest1 failed");
-
- if (chartest2() != '\0')
- throw new Exception("chartest2 failed");
-
- if (chartest1('y') != 'y')
- throw new Exception("chartest1 not default failed");
-
- if (chartest1('y') != 'y')
- throw new Exception("chartest1 not default failed");
-
- if (reftest1() != 42)
- throw new Exception("reftest1 failed");
-
- if (reftest1(400) != 400)
- throw new Exception("reftest1 not default failed");
-
- if (reftest2() != "hello")
- throw new Exception("reftest2 failed");
-
- // rename
- auto foo = new Foo();
- foo.newname();
- foo.newname(10);
- foo.renamed3arg(10, 10.0);
- foo.renamed2arg(10);
- foo.renamed1arg();
-
- // exception specifications
- testException( { exceptionspec(); }, "exceptionspec 1" );
- testException( { exceptionspec(-1); }, "exceptionspec 2" );
- testException( { exceptionspec(100); }, "exceptionspec 3" );
-
- auto ex = new Except(false);
- testException( { ex.exspec(); }, "exspec 1" );
- testException( { ex.exspec(-1); }, "exspec 2" );
- testException( { ex.exspec(100); }, "exspec 3" );
- testException( { ex = new Except(true); }, "Except constructor 1" );
- testException( { ex = new Except(true, -2); }, "Except constructor 2" );
-
- // Default parameters in static class methods
- if (Statics.staticmethod() != 10+20+30)
- throw new Exception("staticmethod 1 failed");
- if (Statics.staticmethod(100) != 100+20+30)
- throw new Exception("staticmethod 2 failed");
- if (Statics.staticmethod(100,200,300) != 100+200+300)
- throw new Exception("staticmethod 3 failed");
-
-
- auto tricky = new Tricky();
- if (tricky.privatedefault() != 200)
- throw new Exception("privatedefault failed");
- if (tricky.protectedint() != 2000)
- throw new Exception("protectedint failed");
- if (tricky.protecteddouble() != 987.654)
- throw new Exception("protecteddouble failed");
- if (tricky.functiondefault() != 500)
- throw new Exception("functiondefault failed");
- if (tricky.contrived() != 'X')
- throw new Exception("contrived failed");
-
- if (constructorcall().val != -1)
- throw new Exception("constructorcall test 1 failed");
-
- if (constructorcall(new Klass(2222)).val != 2222)
- throw new Exception("constructorcall test 2 failed");
-
- if (constructorcall(new Klass()).val != -1)
- throw new Exception("constructorcall test 3 failed");
-
- // const methods
- auto cm = new ConstMethods();
- if (cm.coo() != 20)
- throw new Exception("coo test 1 failed");
- if (cm.coo(1.0) != 20)
- throw new Exception("coo test 2 failed");
-}
-
-void testException(void delegate() command, char[] testName) {
- bool didntThrow;
- try {
- command();
- didntThrow = true;
- } catch (Exception e) {}
-
- if (didntThrow) {
- throw new Exception(testName ~ " failed");
- }
-}
diff --git a/Examples/test-suite/d/default_constructor_runme.1.d b/Examples/test-suite/d/default_constructor_runme.1.d
deleted file mode 100644
index bd79cdf99..000000000
--- a/Examples/test-suite/d/default_constructor_runme.1.d
+++ /dev/null
@@ -1,17 +0,0 @@
-module default_constructor_runme;
-
-import default_constructor.G;
-
-void main() {
- // Protected destructor test.
- try {
- {
- scope g = new G();
- }
- throw new Exception("Protected destructor exception should have been thrown");
- } catch (Exception e) {
- if (e.msg != "C++ destructor does not have public access") {
- throw e;
- }
- }
-}
diff --git a/Examples/test-suite/d/director_alternating_runme.1.d b/Examples/test-suite/d/director_alternating_runme.1.d
deleted file mode 100644
index 27bd262fd..000000000
--- a/Examples/test-suite/d/director_alternating_runme.1.d
+++ /dev/null
@@ -1,7 +0,0 @@
-module director_alternating_runme;
-
-import director_alternating.director_alternating;
-
-void main() {
- assert(getBar().id() == idFromGetBar());
-}
diff --git a/Examples/test-suite/d/director_basic_runme.1.d b/Examples/test-suite/d/director_basic_runme.1.d
deleted file mode 100644
index 58a54835e..000000000
--- a/Examples/test-suite/d/director_basic_runme.1.d
+++ /dev/null
@@ -1,59 +0,0 @@
-module director_basic_runme;
-
-import director_basic.A1;
-import director_basic.Bar;
-import director_basic.Foo;
-import director_basic.MyClass;
-
-void main() {
- auto a = new director_basic_MyFoo();
- if (a.ping() != "director_basic_MyFoo::ping()") {
- throw new Exception("a.ping()");
- }
- if (a.pong() != "Foo::pong();director_basic_MyFoo::ping()") {
- throw new Exception("a.pong()");
- }
-
- auto b = new Foo();
- if (b.ping() != "Foo::ping()") {
- throw new Exception("b.ping()");
- }
- if (b.pong() != "Foo::pong();Foo::ping()") {
- throw new Exception("b.pong()");
- }
-
- {
- scope a1 = new A1(1, false);
- }
-
- {
- auto my = new MyOverriddenClass();
-
- my.expectNull = true;
- if (MyClass.call_pmethod(my, null) !is null)
- throw new Exception("null pointer conversion problem");
-
- auto myBar = new Bar();
- my.expectNull = false;
- auto myNewBar = MyClass.call_pmethod(my, myBar);
- if (myNewBar is null)
- throw new Exception("non-null pointer conversion problem");
- myNewBar.x = 10;
- }
-}
-
-class director_basic_MyFoo : Foo {
- public override char[] ping() {
- return "director_basic_MyFoo::ping()";
- }
-}
-
-class MyOverriddenClass : MyClass {
- public bool expectNull = false;
- public bool nonNullReceived = false;
- public override Bar pmethod(Bar b) {
- if (expectNull && (b !is null))
- throw new Exception("null not received as expected");
- return b;
- }
-}
diff --git a/Examples/test-suite/d/director_classes_runme.1.d b/Examples/test-suite/d/director_classes_runme.1.d
deleted file mode 100644
index e753f5f6d..000000000
--- a/Examples/test-suite/d/director_classes_runme.1.d
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
- * This test demonstrates director classes when the types are classes. Shown are
- * virtual function calls which use classes passed by
- * - Value
- * - Reference
- * - Pointer
- * as both parameters and return values
- *
- * The test also demonstrates directors used with:
- * - method overloading
- * - default parameters
- *
- * Note: Methods with default parameters that call up from C++ cannot call the
- * overloaded D methods, see DefaultParms method.
-
- * Expected output if PrintDebug enabled:
- * ------------ Start ------------
- * Base - Val(444.555)
- * Base - Ref(444.555)
- * Base - Ptr(444.555)
- * Base - ConstPtrRef(444.555)
- * Base - FullyOverloaded(int 10)
- * Base - FullyOverloaded(bool 1)
- * Base - SemiOverloaded(int -678)
- * Base - SemiOverloaded(bool 1)
- * Base - DefaultParms(10, 2.2)
- * Base - DefaultParms(10, 1.1)
- * --------------------------------
- * Derived - Val(444.555)
- * Derived - Ref(444.555)
- * Derived - Ptr(444.555)
- * Derived - ConstPtrRef(444.555)
- * Derived - FullyOverloaded(int 10)
- * Derived - FullyOverloaded(bool 1)
- * Derived - SemiOverloaded(int -678)
- * Base - SemiOverloaded(bool 1)
- * Derived - DefaultParms(10, 2.2)
- * Derived - DefaultParms(10, 1.1)
- * --------------------------------
- * DDerived - Val(444.555)
- * DDerived - Ref(444.555)
- * DDerived - Ptr(444.555)
- * DDerived - ConstPtrRef(444.555)
- * DDerived - FullyOverloaded(int 10)
- * DDerived - FullyOverloaded(bool True)
- * DDerived - SemiOverloaded(-678)
- * Base - SemiOverloaded(bool 1)
- * DDerived - DefaultParms(10, 2.2)
- * DDerived - DefaultParms(10, 1.1)
- * ------------ Finish ------------
- */
-module director_classes_runme;
-
-import tango.io.Stdout;
-import tango.text.Util;
-import director_classes.director_classes;
-import director_classes.Caller;
-import director_classes.Base;
-import director_classes.Derived;
-import director_classes.DoubleHolder;
-
-void main() {
- if (PrintDebug) Stdout.formatln("------------ Start ------------");
-
- auto myCaller = new Caller();
-
- // Test C++ base class.
- {
- scope myBase = new Base(100.0);
- makeCalls(myCaller, myBase);
- }
-
- if (PrintDebug) Stdout.formatln("--------------------------------");
-
- // Test vanilla C++ wrapped derived class.
- {
- scope myBase = new Derived(200.0);
- makeCalls(myCaller, myBase);
- }
-
- if (PrintDebug) Stdout.formatln("--------------------------------");
-
- // Test director / D derived class.
- {
- scope myBase = new DDerived(300.0);
- makeCalls(myCaller, myBase);
- }
-
- if (PrintDebug) Stdout.formatln("------------ Finish ------------");
-}
-
-void makeCalls(Caller myCaller, Base myBase) {
- char[] myBaseType = myBase.classinfo.name.split(".")[$-1];
- myCaller.set(myBase);
-
- DoubleHolder dh = new DoubleHolder(444.555);
-
- // Class pointer, reference and pass by value tests
- if (myCaller.ValCall(dh).val != dh.val) throw new Exception("[1] failed");
- if (myCaller.RefCall(dh).val != dh.val) throw new Exception("[2] failed");
- if (myCaller.PtrCall(dh).val != dh.val) throw new Exception("[3] failed");
- if (myCaller.ConstPtrRefCall(dh).val != dh.val) throw new Exception("[3] failed");
-
- // Fully overloaded method test (all methods in base class are overloaded)
- if (myCaller.FullyOverloadedCall(10) != myBaseType ~ "::FullyOverloaded(int)") throw new Exception("[4] failed");
- if (myCaller.FullyOverloadedCall(true) != myBaseType ~ "::FullyOverloaded(bool)") throw new Exception("[5] failed");
-
- // Semi overloaded method test (some methods in base class are overloaded)
- if (myCaller.SemiOverloadedCall(-678) != myBaseType ~ "::SemiOverloaded(int)") throw new Exception("[6] failed");
- if (myCaller.SemiOverloadedCall(true) != "Base" ~ "::SemiOverloaded(bool)") throw new Exception("[7] failed");
-
- // Default parameters methods test
- if (myCaller.DefaultParmsCall(10, 2.2) != myBaseType ~ "::DefaultParms(int, double)") throw new Exception("[8] failed");
- if (myBase.classinfo == DDerived.classinfo) { // special handling for D derived classes, there is no way to do this any other way
- if (myCaller.DefaultParmsCall(10) != myBaseType ~ "::DefaultParms(int, double)") throw new Exception("[9] failed");
- } else {
- if (myCaller.DefaultParmsCall(10) != myBaseType ~ "::DefaultParms(int)") throw new Exception("[10] failed");
- }
-
- myCaller.reset();
-}
-
-public class DDerived : Base {
- public this(double dd) {
- super(dd);
- }
-
- public override DoubleHolder Val(DoubleHolder x) {
- if (PrintDebug) Stdout.formatln("DDerived - Val({0:d3})", x.val);
- return x;
- }
-
- public override DoubleHolder Ref(DoubleHolder x) {
- if (PrintDebug) Stdout.formatln("DDerived - Ref({0:d3})", x.val);
- return x;
- }
-
- public override DoubleHolder Ptr(DoubleHolder x) {
- if (PrintDebug) Stdout.formatln("DDerived - Ptr({0:d3})", x.val);
- return x;
- }
-
- public override DoubleHolder ConstPtrRef(DoubleHolder x) {
- if (PrintDebug) Stdout.formatln("DDerived - ConstPtrRef({0:d3})", x.val);
- return x;
- }
-
- public override char[] FullyOverloaded(int x) {
- if (PrintDebug) Stdout.formatln("DDerived - FullyOverloaded(int {0})", x);
- return "DDerived::FullyOverloaded(int)";
- }
-
- public override char[] FullyOverloaded(bool x) {
- if (PrintDebug) Stdout.formatln("DDerived - FullyOverloaded(bool {0})", x);
- return "DDerived::FullyOverloaded(bool)";
- }
-
- public override char[] SemiOverloaded(int x) {
- char[] ret = "DDerived::SemiOverloaded(int)";
- if (PrintDebug) Stdout.formatln("DDerived - SemiOverloaded({0})", x);
- return ret;
- }
- alias Base.SemiOverloaded SemiOverloaded; // Alias in SemiOverloaded(bool x).
-
- public override char[] DefaultParms(int x, double y) {
- char[] ret = "DDerived::DefaultParms(int, double)";
- if (PrintDebug) Stdout.formatln("DDerived - DefaultParms({0}, {1:d1})", x, y);
- return ret;
- }
- // This method will never be called from C++ code because the two-parameter
- // DefaultParams() has a default value for the second parameter there. It is
- // only here to ensure consistent behavior for calls from C++ and D code.
- public override char[] DefaultParms(int x) {
- if (PrintDebug) Stdout.formatln("DDerived - DefaultParms({0})", x);
- return DefaultParms(x, 1.1/*use C++ default here*/);
- }
-}
diff --git a/Examples/test-suite/d/director_classic_runme.1.d b/Examples/test-suite/d/director_classic_runme.1.d
deleted file mode 100644
index 33be80618..000000000
--- a/Examples/test-suite/d/director_classic_runme.1.d
+++ /dev/null
@@ -1,207 +0,0 @@
-module director_classic_runme;
-
-import tango.io.Stdout;
-import director_classic.Caller;
-import director_classic.Person;
-import director_classic.Child;
-import director_classic.GrandChild;
-import director_classic.OrphanPerson;
-import director_classic.OrphanChild;
-
-const bool TRACE = false;
-
-void main() {
- {
- scope person = new Person();
- check(person, "Person");
- }
- {
- scope person = new Child();
- check(person, "Child");
- }
- {
- scope person = new GrandChild();
- check(person, "GrandChild");
- }
- {
- scope person = new TargetLangPerson();
- check(person, "TargetLangPerson");
- }
- {
- scope person = new TargetLangChild();
- check(person, "TargetLangChild");
- }
- {
- scope person = new TargetLangGrandChild();
- check(person, "TargetLangGrandChild");
- }
-
- // Semis - don't override id() in target language
- {
- scope person = new TargetLangSemiPerson();
- check(person, "Person");
- }
- {
- scope person = new TargetLangSemiChild();
- check(person, "Child");
- }
- {
- scope person = new TargetLangSemiGrandChild();
- check(person, "GrandChild");
- }
-
- // Orphans - don't override id() in C++
- {
- scope person = new OrphanPerson();
- check(person, "Person");
- }
- {
- scope person = new OrphanChild();
- check(person, "Child");
- }
- {
- scope person = new TargetLangOrphanPerson();
- check(person, "TargetLangOrphanPerson");
- }
- {
- scope person = new TargetLangOrphanChild();
- check(person, "TargetLangOrphanChild");
- }
-
- // Duals - id() makes an upcall to the base id()
- {
- scope person = new TargetLangDualPerson();
- check(person, "TargetLangDualPerson + Person");
- }
- {
- scope person = new TargetLangDualChild();
- check(person, "TargetLangDualChild + Child");
- }
- {
- scope person = new TargetLangDualGrandChild();
- check(person, "TargetLangDualGrandChild + GrandChild");
- }
-
- // Mix Orphans and Duals
- {
- scope person = new TargetLangDualOrphanPerson();
- check(person, "TargetLangDualOrphanPerson + Person");
- }
- {
- scope person = new TargetLangDualOrphanChild();
- check(person, "TargetLangDualOrphanChild + Child");
- }
-}
-
-void check(Person person, char[] expected) {
- char[] ret;
- // Normal D polymorphic call.
- ret = person.id();
- if (TRACE)
- Stdout(ret).newline;
- if (ret != expected)
- throw new Exception("Failed. Received: " ~ ret ~ " Expected: " ~ expected);
-
- // Polymorphic call from C++.
- Caller caller = new Caller();
- caller.setCallback(person);
- ret = caller.call();
- if (TRACE)
- Stdout(ret).newline;
- if (ret != expected)
- throw new Exception("Failed. Received: " ~ ret ~ " Expected: " ~ expected);
-
- // Polymorphic call of object created in D and passed to C++ and back again.
- Person baseclass = caller.baseClass();
- ret = baseclass.id();
- if (TRACE)
- Stdout(ret).newline;
- if (ret != expected)
- throw new Exception("Failed. Received: " ~ ret ~ " Expected: " ~ expected);
-
- caller.resetCallback();
- if (TRACE)
- Stdout("----------------------------------------").newline;
-}
-
-
-// »Full« target language persons.
-class TargetLangPerson : Person {
- public override char[] id() {
- return "TargetLangPerson";
- }
-}
-
-class TargetLangChild : Child {
- public override char[] id() {
- return "TargetLangChild";
- }
-}
-
-class TargetLangGrandChild : GrandChild {
- public override char[] id() {
- return "TargetLangGrandChild";
- }
-}
-
-
-// Semis - don't override id() in target language
-class TargetLangSemiPerson : Person {
- // No id() override
-}
-
-class TargetLangSemiChild : Child {
- // No id() override
-}
-
-class TargetLangSemiGrandChild : GrandChild {
- // No id() override
-}
-
-
-// Orphans - don't override id() in C++
-class TargetLangOrphanPerson : OrphanPerson {
- public override char[] id() {
- return "TargetLangOrphanPerson";
- }
-}
-
-class TargetLangOrphanChild : OrphanChild {
- public override char[] id() {
- return "TargetLangOrphanChild";
- }
-}
-
-
-// Duals - id() makes an upcall to the base id()
-class TargetLangDualPerson : Person {
- public override char[] id() {
- return "TargetLangDualPerson + " ~ super.id();
- }
-}
-
-class TargetLangDualChild : Child {
- public override char[] id() {
- return "TargetLangDualChild + " ~ super.id();
- }
-}
-
-class TargetLangDualGrandChild : GrandChild {
- public override char[] id() {
- return "TargetLangDualGrandChild + " ~ super.id();
- }
-}
-
-
-// Mix Orphans and Duals
-class TargetLangDualOrphanPerson : OrphanPerson {
- public override char[] id() {
- return "TargetLangDualOrphanPerson + " ~ super.id();
- }
-}
-
-class TargetLangDualOrphanChild : OrphanChild {
- public override char[] id() {
- return "TargetLangDualOrphanChild + " ~ super.id();
- }
-}
diff --git a/Examples/test-suite/d/director_ignore_runme.1.d b/Examples/test-suite/d/director_ignore_runme.1.d
deleted file mode 100644
index 797d2fddf..000000000
--- a/Examples/test-suite/d/director_ignore_runme.1.d
+++ /dev/null
@@ -1,39 +0,0 @@
-module director_ignore_runme;
-
-import director_ignore.DIgnores;
-import director_ignore.DAbstractIgnores;
-
-void main() {
- // Just check the classes can be instantiated and other methods work as expected
- auto a = new DIgnoresDerived();
- if (a.Triple(5) != 15)
- throw new Exception("Triple failed");
-
- auto b = new DAbstractIgnoresDerived();
- if (b.Quadruple(5) != 20)
- throw new Exception("Quadruple failed");
-}
-
-class DIgnoresDerived : DIgnores {
-public:
- // These will give a warning if the %ignore is not working
- int OverloadedMethod(int n, int xoffset, int yoffset) { return 0; }
- int OverloadedMethod(int n, int xoffset) { return 0; }
- int OverloadedMethod(int n) { return 0; }
-
- int OverloadedProtectedMethod(int n, int xoffset, int yoffset) { return 0; }
- int OverloadedProtectedMethod(int n, int xoffset) { return 0; }
- int OverloadedProtectedMethod(int n) { return 0; }
-}
-
-class DAbstractIgnoresDerived : DAbstractIgnores {
-public:
- // These will give a warning if the %ignore is not working
- int OverloadedMethod(int n, int xoffset, int yoffset) { return 0; }
- int OverloadedMethod(int n, int xoffset) { return 0; }
- int OverloadedMethod(int n) { return 0; }
-
- int OverloadedProtectedMethod(int n, int xoffset, int yoffset) { return 0; }
- int OverloadedProtectedMethod(int n, int xoffset) { return 0; }
- int OverloadedProtectedMethod(int n) { return 0; }
-}
diff --git a/Examples/test-suite/d/director_primitives_runme.1.d b/Examples/test-suite/d/director_primitives_runme.1.d
deleted file mode 100644
index f19e86f59..000000000
--- a/Examples/test-suite/d/director_primitives_runme.1.d
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * This test program shows a D class DDerived inheriting from Base.
- *
- * Three types of classes are created and the virtual methods called to
- * demonstrate:
- * - Wide variety of primitive types
- * - Calling methods with zero, one or more parameters
- * - Director methods that are not overridden in D
- * - Director classes that are not overridden at all in D, i.e. non-director
- * behaviour is as expected for director classes
- * - Inheritance hierarchy using director methods
- * - Return types working as well as parameters
- *
- * The Caller class is a tester class which calls the virtual functions from C++.
- */
-module director_primitives_runme;
-
-import tango.io.Stdout;
-import director_primitives.director_primitives;
-import director_primitives.Base;
-import director_primitives.Caller;
-import director_primitives.Derived;
-import director_primitives.HShadowMode;
-
-void main() {
- PrintDebug = false;
- if (PrintDebug) Stdout("------------ Start ------------ ").newline;
-
- Caller myCaller = new Caller();
-
- // Test C++ base class.
- {
- scope myBase = new Base(100.0);
- makeCalls(myCaller, myBase);
- }
-
- if (PrintDebug) Stdout("--------------------------------").newline;
-
- // Test vanilla C++ wrapped derived class.
- {
- scope Base myBase = new Derived(100.0);
- makeCalls(myCaller, myBase);
- }
-
- if (PrintDebug) Stdout("--------------------------------").newline;
-
- // Test director/D derived class.
- {
- scope Base myBase = new DDerived(300.0);
- makeCalls(myCaller, myBase);
- }
-
- if (PrintDebug) Stdout("------------ Finish ------------ ").newline;
-}
-
-void makeCalls(Caller myCaller, Base myBase) {
- myCaller.set(myBase);
-
- myCaller.NoParmsMethodCall();
- if (myCaller.BoolMethodCall(true) != true) throw new Exception("failed");
- if (myCaller.BoolMethodCall(false) != false) throw new Exception("failed");
- if (myCaller.IntMethodCall(-123) != -123) throw new Exception("failed");
- if (myCaller.UIntMethodCall(123) != 123) throw new Exception("failed");
- if (myCaller.FloatMethodCall(-123.456f) != -123.456f) throw new Exception("failed");
- if (myCaller.CharPtrMethodCall("test string") != "test string") throw new Exception("failed");
- if (myCaller.ConstCharPtrMethodCall("another string") != "another string") throw new Exception("failed");
- if (myCaller.EnumMethodCall(HShadowMode.HShadowHard) != HShadowMode.HShadowHard) throw new Exception("failed");
- myCaller.ManyParmsMethodCall(true, -123, 123, 123.456f, "test string", "another string", HShadowMode.HShadowHard);
- myCaller.NotOverriddenMethodCall();
-
- myCaller.reset();
-}
-
-class DDerived : Base {
-public:
- this(double dd) {
- super(dd);
- }
-
- override void NoParmsMethod() {
- if (PrintDebug) Stdout("DDerived - NoParmsMethod()").newline;
- }
-
- override bool BoolMethod(bool x) {
- if (PrintDebug) Stdout.formatln("DDerived - BoolMethod({0})", x);
- return x;
- }
-
- override int IntMethod(int x) {
- if (PrintDebug) Stdout.formatln("DDerived - IntMethod({0})", x);
- return x;
- }
-
- override uint UIntMethod(uint x) {
- if (PrintDebug) Stdout.formatln("DDerived - UIntMethod({0})", x);
- return x;
- }
-
- override float FloatMethod(float x) {
- if (PrintDebug) Stdout.formatln("DDerived - FloatMethod({0})", x);
- return x;
- }
-
- override char[] CharPtrMethod(char[] x) {
- if (PrintDebug) Stdout.formatln("DDerived - CharPtrMethod({0})", x);
- return x;
- }
-
- override char[] ConstCharPtrMethod(char[] x) {
- if (PrintDebug) Stdout.formatln("DDerived - ConstCharPtrMethod({0})", x);
- return x;
- }
-
- override HShadowMode EnumMethod(HShadowMode x) {
- if (PrintDebug) Stdout.formatln("DDerived - EnumMethod({0})", x);
- return x;
- }
-
- override void ManyParmsMethod(bool b, int i, uint u, float f, char[] c, char[] cc, HShadowMode h) {
- if (PrintDebug) Stdout.formatln("DDerived - ManyParmsMethod({0}, {1}, {2}, {3:d3}, {4}, {5}, {6})", b, i, u, f, c, cc, h);
- }
-}
diff --git a/Examples/test-suite/d/director_protected_runme.1.d b/Examples/test-suite/d/director_protected_runme.1.d
deleted file mode 100644
index 81447b73b..000000000
--- a/Examples/test-suite/d/director_protected_runme.1.d
+++ /dev/null
@@ -1,50 +0,0 @@
-module director_protected_runme;
-
-import director_protected.Foo;
-import director_protected.Bar;
-
-void main() {
- Bar b = new Bar();
- Foo f = b.create();
- auto fb = new FooBar();
- auto fb2 = new FooBar2();
-
- char[] s;
- s = fb.used();
- if ( s != ("Foo::pang();Bar::pong();Foo::pong();FooBar::ping();"))
- throw new Exception("bad FooBar::used" ~ " - " ~ s);
-
- s = fb2.used();
- if ( s != ("FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();"))
- throw new Exception("bad FooBar2::used");
-
- s = b.pong();
- if ( s != ("Bar::pong();Foo::pong();Bar::ping();"))
- throw new Exception("bad Bar::pong");
-
- s = f.pong();
- if ( s != ("Bar::pong();Foo::pong();Bar::ping();"))
- throw new Exception("bad Foo::pong");
-
- s = fb.pong();
- if ( s != ("Bar::pong();Foo::pong();FooBar::ping();"))
- throw new Exception("bad FooBar::pong");
-}
-
-class FooBar : Bar {
-protected:
- override char[] ping() {
- return "FooBar::ping();";
- }
-}
-
-class FooBar2 : Bar{
-protected:
- override char[] ping() {
- return "FooBar2::ping();";
- }
-
- override char[] pang() {
- return "FooBar2::pang();";
- }
-}
diff --git a/Examples/test-suite/d/director_string_runme.1.d b/Examples/test-suite/d/director_string_runme.1.d
deleted file mode 100644
index 4e750791a..000000000
--- a/Examples/test-suite/d/director_string_runme.1.d
+++ /dev/null
@@ -1,46 +0,0 @@
-module director_string_runme;
-
-import Integer = tango.text.convert.Integer;
-import director_string.A;
-
-void main() {
- char[] s;
-
- auto c = new director_string_A("hi");
- for (int i=0; i<3; ++i) {
- s = c.call_get(i);
- if (s != Integer.toString(i)) throw new Exception("director_string_A.get(" ~ Integer.toString(i) ~ ") failed. Got:" ~ s);
- }
-
- auto b = new director_string_B("hello");
-
- s = b.call_get_first();
- if (s != "director_string_B.get_first") throw new Exception("call_get_first() failed");
-
- s = b.call_get(0);
- if (s != "director_string_B.get: hello") throw new Exception("get(0) failed");
-}
-
-class director_string_B : A {
-public:
- this(char[] first) {
- super(first);
- }
- override char[] get_first() {
- return "director_string_B.get_first";
- }
-
- override char[] get(int n) {
- return "director_string_B.get: " ~ super.get(n);
- }
-}
-
-class director_string_A : A {
-public:
- this(char[] first) {
- super(first);
- }
- override char[] get(int n) {
- return Integer.toString(n);
- }
-}
diff --git a/Examples/test-suite/d/enum_thorough_runme.1.d b/Examples/test-suite/d/enum_thorough_runme.1.d
deleted file mode 100644
index b318bc092..000000000
--- a/Examples/test-suite/d/enum_thorough_runme.1.d
+++ /dev/null
@@ -1,447 +0,0 @@
-module enum_thorough_runme;
-
-import enum_thorough.enum_thorough;
-import enum_thorough.AnonStruct;
-import enum_thorough.colour;
-import enum_thorough.DifferentTypes;
-import enum_thorough.FirStruct;
-import enum_thorough.HairStruct;
-import enum_thorough.IgnoreTest;
-import enum_thorough.Instances;
-import enum_thorough.namedanon;
-import enum_thorough.namedanonspace;
-import enum_thorough.newname;
-import enum_thorough.NewNameStruct;
-import enum_thorough.repeat;
-import enum_thorough.SpeedClass;
-import enum_thorough.TClassInt;
-import enum_thorough.TemplateClassInt;
-import enum_thorough.TreesClass;
-import enum_thorough.twonames;
-import enum_thorough.TwoNamesStruct;
-
-void main() {
- {
- // Anonymous enums
- int i = AnonEnum1;
- if (ReallyAnInteger != 200) throw new Exception("Test Anon 1 failed");
- i += AnonSpaceEnum1;
- i += AnonStruct.AnonStructEnum1;
- }
- {
- auto red = colour.red;
- colourTest1(red);
- colourTest2(red);
- colourTest3(red);
- colourTest4(red);
- myColour = red;
- }
- {
- auto s = new SpeedClass();
- auto speed = SpeedClass.speed.slow;
- if (s.speedTest1(speed) != speed) throw new Exception("speedTest 1 failed");
- if (s.speedTest2(speed) != speed) throw new Exception("speedTest 2 failed");
- if (s.speedTest3(speed) != speed) throw new Exception("speedTest 3 failed");
- if (s.speedTest4(speed) != speed) throw new Exception("speedTest 4 failed");
- if (s.speedTest5(speed) != speed) throw new Exception("speedTest 5 failed");
- if (s.speedTest6(speed) != speed) throw new Exception("speedTest 6 failed");
- if (s.speedTest7(speed) != speed) throw new Exception("speedTest 7 failed");
- if (s.speedTest8(speed) != speed) throw new Exception("speedTest 8 failed");
-
- if (speedTest1(speed) != speed) throw new Exception("speedTest Global 1 failed");
- if (speedTest2(speed) != speed) throw new Exception("speedTest Global 2 failed");
- if (speedTest3(speed) != speed) throw new Exception("speedTest Global 3 failed");
- if (speedTest4(speed) != speed) throw new Exception("speedTest Global 4 failed");
- if (speedTest5(speed) != speed) throw new Exception("speedTest Global 5 failed");
- }
- {
- auto s = new SpeedClass();
- auto slow = SpeedClass.speed.slow;
- auto lightning = SpeedClass.speed.lightning;
-
- if (s.mySpeedtd1 != slow) throw new Exception("mySpeedtd1 1 failed");
- if (cast(int)s.mySpeedtd1 != 10) throw new Exception("mySpeedtd1 2 failed");
-
- s.mySpeedtd1 = lightning;
- if (s.mySpeedtd1 != lightning) throw new Exception("mySpeedtd1 3 failed");
- if (cast(int)s.mySpeedtd1 != 31) throw new Exception("mySpeedtd1 4 failed");
- }
- {
- if (namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new Exception("namedanonTest 1 failed");
- }
- {
- auto val = twonames.TwoNames2;
- if (twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed");
- if (twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed");
- if (twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed");
- }
- {
- auto t = new TwoNamesStruct();
- auto val = TwoNamesStruct.twonames.TwoNamesStruct1;
- if (t.twonamesTest1(val) != val) throw new Exception("twonamesTest 1 failed");
- if (t.twonamesTest2(val) != val) throw new Exception("twonamesTest 2 failed");
- if (t.twonamesTest3(val) != val) throw new Exception("twonamesTest 3 failed");
- }
- {
- auto val = namedanonspace.NamedAnonSpace2;
- if (namedanonspaceTest1(val) != val) throw new Exception("namedanonspaceTest 1 failed");
- if (namedanonspaceTest2(val) != val) throw new Exception("namedanonspaceTest 2 failed");
- if (namedanonspaceTest3(val) != val) throw new Exception("namedanonspaceTest 3 failed");
- if (namedanonspaceTest4(val) != val) throw new Exception("namedanonspaceTest 4 failed");
- }
- {
- auto t = new TemplateClassInt();
- auto galileo = TemplateClassInt.scientists.galileo;
- if (t.scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest 1 failed");
- if (t.scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest 2 failed");
- if (t.scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest 3 failed");
- if (t.scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest 4 failed");
- if (t.scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest 5 failed");
- if (t.scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest 6 failed");
- if (t.scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest 7 failed");
- if (t.scientistsTest8(galileo) != galileo) throw new Exception("scientistsTest 8 failed");
- if (t.scientistsTest9(galileo) != galileo) throw new Exception("scientistsTest 9 failed");
-// if (t.scientistsTestA(galileo) != galileo) throw new Exception("scientistsTest A failed");
- if (t.scientistsTestB(galileo) != galileo) throw new Exception("scientistsTest B failed");
-// if (t.scientistsTestC(galileo) != galileo) throw new Exception("scientistsTest C failed");
- if (t.scientistsTestD(galileo) != galileo) throw new Exception("scientistsTest D failed");
- if (t.scientistsTestE(galileo) != galileo) throw new Exception("scientistsTest E failed");
- if (t.scientistsTestF(galileo) != galileo) throw new Exception("scientistsTest F failed");
- if (t.scientistsTestG(galileo) != galileo) throw new Exception("scientistsTest G failed");
- if (t.scientistsTestH(galileo) != galileo) throw new Exception("scientistsTest H failed");
- if (t.scientistsTestI(galileo) != galileo) throw new Exception("scientistsTest I failed");
- if (t.scientistsTestJ(galileo) != galileo) throw new Exception("scientistsTest J failed");
-
- if (scientistsTest1(galileo) != galileo) throw new Exception("scientistsTest Global 1 failed");
- if (scientistsTest2(galileo) != galileo) throw new Exception("scientistsTest Global 2 failed");
- if (scientistsTest3(galileo) != galileo) throw new Exception("scientistsTest Global 3 failed");
- if (scientistsTest4(galileo) != galileo) throw new Exception("scientistsTest Global 4 failed");
- if (scientistsTest5(galileo) != galileo) throw new Exception("scientistsTest Global 5 failed");
- if (scientistsTest6(galileo) != galileo) throw new Exception("scientistsTest Global 6 failed");
- if (scientistsTest7(galileo) != galileo) throw new Exception("scientistsTest Global 7 failed");
- if (scientistsTest8(galileo) != galileo) throw new Exception("scientistsTest Global 8 failed");
- }
- {
- auto t = new TClassInt();
- auto bell = TClassInt.scientists.bell;
- auto galileo = TemplateClassInt.scientists.galileo;
- if (t.scientistsNameTest1(bell) != bell) throw new Exception("scientistsNameTest 1 failed");
- if (t.scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest 2 failed");
- if (t.scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest 3 failed");
- if (t.scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest 4 failed");
- if (t.scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest 5 failed");
- if (t.scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest 6 failed");
- if (t.scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest 7 failed");
- if (t.scientistsNameTest8(bell) != bell) throw new Exception("scientistsNameTest 8 failed");
- if (t.scientistsNameTest9(bell) != bell) throw new Exception("scientistsNameTest 9 failed");
-// if (t.scientistsNameTestA(bell) != bell) throw new Exception("scientistsNameTest A failed");
- if (t.scientistsNameTestB(bell) != bell) throw new Exception("scientistsNameTest B failed");
-// if (t.scientistsNameTestC(bell) != bell) throw new Exception("scientistsNameTest C failed");
- if (t.scientistsNameTestD(bell) != bell) throw new Exception("scientistsNameTest D failed");
- if (t.scientistsNameTestE(bell) != bell) throw new Exception("scientistsNameTest E failed");
- if (t.scientistsNameTestF(bell) != bell) throw new Exception("scientistsNameTest F failed");
- if (t.scientistsNameTestG(bell) != bell) throw new Exception("scientistsNameTest G failed");
- if (t.scientistsNameTestH(bell) != bell) throw new Exception("scientistsNameTest H failed");
- if (t.scientistsNameTestI(bell) != bell) throw new Exception("scientistsNameTest I failed");
-
- if (t.scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest 1 failed");
- if (t.scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest 2 failed");
- if (t.scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest 3 failed");
- if (t.scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest 4 failed");
- if (t.scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest 5 failed");
- if (t.scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest 6 failed");
- if (t.scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest 7 failed");
-
- if (t.scientistsOtherTest1(galileo) != galileo) throw new Exception("scientistsOtherTest 1 failed");
- if (t.scientistsOtherTest2(galileo) != galileo) throw new Exception("scientistsOtherTest 2 failed");
- if (t.scientistsOtherTest3(galileo) != galileo) throw new Exception("scientistsOtherTest 3 failed");
- if (t.scientistsOtherTest4(galileo) != galileo) throw new Exception("scientistsOtherTest 4 failed");
- if (t.scientistsOtherTest5(galileo) != galileo) throw new Exception("scientistsOtherTest 5 failed");
- if (t.scientistsOtherTest6(galileo) != galileo) throw new Exception("scientistsOtherTest 6 failed");
- if (t.scientistsOtherTest7(galileo) != galileo) throw new Exception("scientistsOtherTest 7 failed");
-
- if (scientistsNameTest1(bell) != bell) throw new Exception("scientistsNameTest Global 1 failed");
- if (scientistsNameTest2(bell) != bell) throw new Exception("scientistsNameTest Global 2 failed");
- if (scientistsNameTest3(bell) != bell) throw new Exception("scientistsNameTest Global 3 failed");
- if (scientistsNameTest4(bell) != bell) throw new Exception("scientistsNameTest Global 4 failed");
- if (scientistsNameTest5(bell) != bell) throw new Exception("scientistsNameTest Global 5 failed");
- if (scientistsNameTest6(bell) != bell) throw new Exception("scientistsNameTest Global 6 failed");
- if (scientistsNameTest7(bell) != bell) throw new Exception("scientistsNameTest Global 7 failed");
-
- if (scientistsNameSpaceTest1(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 1 failed");
- if (scientistsNameSpaceTest2(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 2 failed");
- if (scientistsNameSpaceTest3(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 3 failed");
- if (scientistsNameSpaceTest4(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 4 failed");
- if (scientistsNameSpaceTest5(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 5 failed");
- if (scientistsNameSpaceTest6(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 6 failed");
- if (scientistsNameSpaceTest7(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 7 failed");
-
- if (scientistsNameSpaceTest8(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 8 failed");
- if (scientistsNameSpaceTest9(bell) != bell) throw new Exception("scientistsNameSpaceTest Global 9 failed");
- if (scientistsNameSpaceTestA(bell) != bell) throw new Exception("scientistsNameSpaceTest Global A failed");
- if (scientistsNameSpaceTestB(bell) != bell) throw new Exception("scientistsNameSpaceTest Global B failed");
- if (scientistsNameSpaceTestC(bell) != bell) throw new Exception("scientistsNameSpaceTest Global C failed");
- if (scientistsNameSpaceTestD(bell) != bell) throw new Exception("scientistsNameSpaceTest Global D failed");
- if (scientistsNameSpaceTestE(bell) != bell) throw new Exception("scientistsNameSpaceTest Global E failed");
-
- if (scientistsNameSpaceTestF(bell) != bell) throw new Exception("scientistsNameSpaceTest Global F failed");
- if (scientistsNameSpaceTestG(bell) != bell) throw new Exception("scientistsNameSpaceTest Global G failed");
- if (scientistsNameSpaceTestH(bell) != bell) throw new Exception("scientistsNameSpaceTest Global H failed");
- if (scientistsNameSpaceTestI(bell) != bell) throw new Exception("scientistsNameSpaceTest Global I failed");
- if (scientistsNameSpaceTestJ(bell) != bell) throw new Exception("scientistsNameSpaceTest Global J failed");
- if (scientistsNameSpaceTestK(bell) != bell) throw new Exception("scientistsNameSpaceTest Global K failed");
- if (scientistsNameSpaceTestL(bell) != bell) throw new Exception("scientistsNameSpaceTest Global L failed");
- }
- {
- auto val = newname.argh;
- if (renameTest1(val) != val) throw new Exception("renameTest Global 1 failed");
- if (renameTest2(val) != val) throw new Exception("renameTest Global 2 failed");
- }
- {
- auto n = new NewNameStruct();
- if (n.renameTest1(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest 1 failed");
- if (n.renameTest2(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest 2 failed");
- if (n.renameTest3(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new Exception("renameTest 3 failed");
- if (n.renameTest4(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest 4 failed");
- if (n.renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest 5 failed");
- if (n.renameTest6(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new Exception("renameTest 6 failed");
- }
- {
- if (renameTest3(NewNameStruct.enumeration.bang) != NewNameStruct.enumeration.bang) throw new Exception("renameTest Global 3 failed");
- if (renameTest4(NewNameStruct.simplerenamed.simple1) != NewNameStruct.simplerenamed.simple1) throw new Exception("renameTest Global 4 failed");
- if (renameTest5(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest Global 5 failed");
- if (renameTest6(NewNameStruct.doublenamerenamed.doublename1) != NewNameStruct.doublenamerenamed.doublename1) throw new Exception("renameTest Global 6 failed");
- if (renameTest7(NewNameStruct.singlenamerenamed.singlename1) != NewNameStruct.singlenamerenamed.singlename1) throw new Exception("renameTest Global 7 failed");
- }
- {
- auto t = new TreesClass();
- auto pine = TreesClass.trees.pine;
-
- if (t.treesTest1(pine) != pine) throw new Exception("treesTest 1 failed");
- if (t.treesTest2(pine) != pine) throw new Exception("treesTest 2 failed");
- if (t.treesTest3(pine) != pine) throw new Exception("treesTest 3 failed");
- if (t.treesTest4(pine) != pine) throw new Exception("treesTest 4 failed");
- if (t.treesTest5(pine) != pine) throw new Exception("treesTest 5 failed");
- if (t.treesTest6(pine) != pine) throw new Exception("treesTest 6 failed");
- if (t.treesTest7(pine) != pine) throw new Exception("treesTest 7 failed");
- if (t.treesTest8(pine) != pine) throw new Exception("treesTest 8 failed");
- if (t.treesTest9(pine) != pine) throw new Exception("treesTest 9 failed");
- if (t.treesTestA(pine) != pine) throw new Exception("treesTest A failed");
- if (t.treesTestB(pine) != pine) throw new Exception("treesTest B failed");
- if (t.treesTestC(pine) != pine) throw new Exception("treesTest C failed");
- if (t.treesTestD(pine) != pine) throw new Exception("treesTest D failed");
- if (t.treesTestE(pine) != pine) throw new Exception("treesTest E failed");
- if (t.treesTestF(pine) != pine) throw new Exception("treesTest F failed");
- if (t.treesTestG(pine) != pine) throw new Exception("treesTest G failed");
- if (t.treesTestH(pine) != pine) throw new Exception("treesTest H failed");
- if (t.treesTestI(pine) != pine) throw new Exception("treesTest I failed");
- if (t.treesTestJ(pine) != pine) throw new Exception("treesTest J failed");
- if (t.treesTestK(pine) != pine) throw new Exception("treesTest K failed");
- if (t.treesTestL(pine) != pine) throw new Exception("treesTest L failed");
- if (t.treesTestM(pine) != pine) throw new Exception("treesTest M failed");
- if (t.treesTestN(pine) != pine) throw new Exception("treesTest N failed");
- if (t.treesTestO(pine) != pine) throw new Exception("treesTest O failed");
-
- if (treesTest1(pine) != pine) throw new Exception("treesTest Global 1 failed");
- if (treesTest2(pine) != pine) throw new Exception("treesTest Global 2 failed");
- if (treesTest3(pine) != pine) throw new Exception("treesTest Global 3 failed");
- if (treesTest4(pine) != pine) throw new Exception("treesTest Global 4 failed");
- if (treesTest5(pine) != pine) throw new Exception("treesTest Global 5 failed");
- if (treesTest6(pine) != pine) throw new Exception("treesTest Global 6 failed");
- if (treesTest7(pine) != pine) throw new Exception("treesTest Global 7 failed");
- if (treesTest8(pine) != pine) throw new Exception("treesTest Global 8 failed");
- if (treesTest9(pine) != pine) throw new Exception("treesTest Global 9 failed");
- if (treesTestA(pine) != pine) throw new Exception("treesTest Global A failed");
- if (treesTestB(pine) != pine) throw new Exception("treesTest Global B failed");
- if (treesTestC(pine) != pine) throw new Exception("treesTest Global C failed");
- if (treesTestD(pine) != pine) throw new Exception("treesTest Global D failed");
- if (treesTestE(pine) != pine) throw new Exception("treesTest Global E failed");
- if (treesTestF(pine) != pine) throw new Exception("treesTest Global F failed");
- if (treesTestG(pine) != pine) throw new Exception("treesTest Global G failed");
- if (treesTestH(pine) != pine) throw new Exception("treesTest Global H failed");
- if (treesTestI(pine) != pine) throw new Exception("treesTest Global I failed");
- if (treesTestJ(pine) != pine) throw new Exception("treesTest Global J failed");
- if (treesTestK(pine) != pine) throw new Exception("treesTest Global K failed");
- if (treesTestL(pine) != pine) throw new Exception("treesTest Global L failed");
- if (treesTestM(pine) != pine) throw new Exception("treesTest Global M failed");
-// if (treesTestN(pine) != pine) throw new Exception("treesTest Global N failed");
- if (treesTestO(pine) != pine) throw new Exception("treesTest Global O failed");
- if (treesTestP(pine) != pine) throw new Exception("treesTest Global P failed");
- if (treesTestQ(pine) != pine) throw new Exception("treesTest Global Q failed");
- if (treesTestR(pine) != pine) throw new Exception("treesTest Global R failed");
- }
- {
- auto h = new HairStruct();
- auto ginger = HairStruct.hair.ginger;
-
- if (h.hairTest1(ginger) != ginger) throw new Exception("hairTest 1 failed");
- if (h.hairTest2(ginger) != ginger) throw new Exception("hairTest 2 failed");
- if (h.hairTest3(ginger) != ginger) throw new Exception("hairTest 3 failed");
- if (h.hairTest4(ginger) != ginger) throw new Exception("hairTest 4 failed");
- if (h.hairTest5(ginger) != ginger) throw new Exception("hairTest 5 failed");
- if (h.hairTest6(ginger) != ginger) throw new Exception("hairTest 6 failed");
- if (h.hairTest7(ginger) != ginger) throw new Exception("hairTest 7 failed");
- if (h.hairTest8(ginger) != ginger) throw new Exception("hairTest 8 failed");
- if (h.hairTest9(ginger) != ginger) throw new Exception("hairTest 9 failed");
- if (h.hairTestA(ginger) != ginger) throw new Exception("hairTest A failed");
- if (h.hairTestB(ginger) != ginger) throw new Exception("hairTest B failed");
-
- auto red = colour.red;
- if (h.colourTest1(red) != red) throw new Exception("colourTest HairStruct 1 failed");
- if (h.colourTest2(red) != red) throw new Exception("colourTest HairStruct 2 failed");
- if (h.namedanonTest1(namedanon.NamedAnon2) != namedanon.NamedAnon2) throw new Exception("namedanonTest HairStruct 1 failed");
- if (h.namedanonspaceTest1(namedanonspace.NamedAnonSpace2) != namedanonspace.NamedAnonSpace2) throw new Exception("namedanonspaceTest HairStruct 1 failed");
-
- auto fir = TreesClass.trees.fir;
- if (h.treesGlobalTest1(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 1 failed");
- if (h.treesGlobalTest2(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 2 failed");
- if (h.treesGlobalTest3(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 3 failed");
- if (h.treesGlobalTest4(fir) != fir) throw new Exception("treesGlobalTest1 HairStruct 4 failed");
- }
- {
- auto blonde = HairStruct.hair.blonde;
- if (hairTest1(blonde) != blonde) throw new Exception("hairTest Global 1 failed");
- if (hairTest2(blonde) != blonde) throw new Exception("hairTest Global 2 failed");
- if (hairTest3(blonde) != blonde) throw new Exception("hairTest Global 3 failed");
- if (hairTest4(blonde) != blonde) throw new Exception("hairTest Global 4 failed");
- if (hairTest5(blonde) != blonde) throw new Exception("hairTest Global 5 failed");
- if (hairTest6(blonde) != blonde) throw new Exception("hairTest Global 6 failed");
- if (hairTest7(blonde) != blonde) throw new Exception("hairTest Global 7 failed");
- if (hairTest8(blonde) != blonde) throw new Exception("hairTest Global 8 failed");
- if (hairTest9(blonde) != blonde) throw new Exception("hairTest Global 9 failed");
- if (hairTestA(blonde) != blonde) throw new Exception("hairTest Global A failed");
- if (hairTestB(blonde) != blonde) throw new Exception("hairTest Global B failed");
- if (hairTestC(blonde) != blonde) throw new Exception("hairTest Global C failed");
-
- if (hairTestA1(blonde) != blonde) throw new Exception("hairTest Global A1 failed");
- if (hairTestA2(blonde) != blonde) throw new Exception("hairTest Global A2 failed");
- if (hairTestA3(blonde) != blonde) throw new Exception("hairTest Global A3 failed");
- if (hairTestA4(blonde) != blonde) throw new Exception("hairTest Global A4 failed");
- if (hairTestA5(blonde) != blonde) throw new Exception("hairTest Global A5 failed");
- if (hairTestA6(blonde) != blonde) throw new Exception("hairTest Global A6 failed");
- if (hairTestA7(blonde) != blonde) throw new Exception("hairTest Global A7 failed");
- if (hairTestA8(blonde) != blonde) throw new Exception("hairTest Global A8 failed");
- if (hairTestA9(blonde) != blonde) throw new Exception("hairTest Global A9 failed");
- if (hairTestAA(blonde) != blonde) throw new Exception("hairTest Global AA failed");
- if (hairTestAB(blonde) != blonde) throw new Exception("hairTest Global AB failed");
- if (hairTestAC(blonde) != blonde) throw new Exception("hairTest Global AC failed");
-
- if (hairTestB1(blonde) != blonde) throw new Exception("hairTest Global B1 failed");
- if (hairTestB2(blonde) != blonde) throw new Exception("hairTest Global B2 failed");
- if (hairTestB3(blonde) != blonde) throw new Exception("hairTest Global B3 failed");
- if (hairTestB4(blonde) != blonde) throw new Exception("hairTest Global B4 failed");
- if (hairTestB5(blonde) != blonde) throw new Exception("hairTest Global B5 failed");
- if (hairTestB6(blonde) != blonde) throw new Exception("hairTest Global B6 failed");
- if (hairTestB7(blonde) != blonde) throw new Exception("hairTest Global B7 failed");
- if (hairTestB8(blonde) != blonde) throw new Exception("hairTest Global B8 failed");
- if (hairTestB9(blonde) != blonde) throw new Exception("hairTest Global B9 failed");
- if (hairTestBA(blonde) != blonde) throw new Exception("hairTest Global BA failed");
- if (hairTestBB(blonde) != blonde) throw new Exception("hairTest Global BB failed");
- if (hairTestBC(blonde) != blonde) throw new Exception("hairTest Global BC failed");
-
- if (hairTestC1(blonde) != blonde) throw new Exception("hairTest Global C1 failed");
- if (hairTestC2(blonde) != blonde) throw new Exception("hairTest Global C2 failed");
- if (hairTestC3(blonde) != blonde) throw new Exception("hairTest Global C3 failed");
- if (hairTestC4(blonde) != blonde) throw new Exception("hairTest Global C4 failed");
- if (hairTestC5(blonde) != blonde) throw new Exception("hairTest Global C5 failed");
- if (hairTestC6(blonde) != blonde) throw new Exception("hairTest Global C6 failed");
- if (hairTestC7(blonde) != blonde) throw new Exception("hairTest Global C7 failed");
- if (hairTestC8(blonde) != blonde) throw new Exception("hairTest Global C8 failed");
- if (hairTestC9(blonde) != blonde) throw new Exception("hairTest Global C9 failed");
- if (hairTestCA(blonde) != blonde) throw new Exception("hairTest Global CA failed");
- if (hairTestCB(blonde) != blonde) throw new Exception("hairTest Global CB failed");
- if (hairTestCC(blonde) != blonde) throw new Exception("hairTest Global CC failed");
- }
- {
- auto f = new FirStruct();
- auto blonde = HairStruct.hair.blonde;
-
- if (f.hairTestFir1(blonde) != blonde) throw new Exception("hairTestFir 1 failed");
- if (f.hairTestFir2(blonde) != blonde) throw new Exception("hairTestFir 2 failed");
- if (f.hairTestFir3(blonde) != blonde) throw new Exception("hairTestFir 3 failed");
- if (f.hairTestFir4(blonde) != blonde) throw new Exception("hairTestFir 4 failed");
- if (f.hairTestFir5(blonde) != blonde) throw new Exception("hairTestFir 5 failed");
- if (f.hairTestFir6(blonde) != blonde) throw new Exception("hairTestFir 6 failed");
- if (f.hairTestFir7(blonde) != blonde) throw new Exception("hairTestFir 7 failed");
- if (f.hairTestFir8(blonde) != blonde) throw new Exception("hairTestFir 8 failed");
- if (f.hairTestFir9(blonde) != blonde) throw new Exception("hairTestFir 9 failed");
- if (f.hairTestFirA(blonde) != blonde) throw new Exception("hairTestFir A failed");
- }
- {
- GlobalInstance = globalinstance2;
- if (GlobalInstance != globalinstance2) throw new Exception("GlobalInstance 1 failed");
-
- auto i = new Instances();
- i.MemberInstance = Instances.memberinstance3;
- if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
- }
- // ignore enum item tests start
- {
- if (cast(int)ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero) != 0) throw new Exception("ignoreATest 0 failed");
- if (cast(int)ignoreATest(IgnoreTest.IgnoreA.ignoreA_three) != 3) throw new Exception("ignoreATest 3 failed");
- if (cast(int)ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten) != 10) throw new Exception("ignoreATest 10 failed");
- if (cast(int)ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven) != 11) throw new Exception("ignoreATest 11 failed");
- if (cast(int)ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen) != 13) throw new Exception("ignoreATest 13 failed");
- if (cast(int)ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen) != 14) throw new Exception("ignoreATest 14 failed");
- if (cast(int)ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty) != 20) throw new Exception("ignoreATest 20 failed");
- if (cast(int)ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty) != 30) throw new Exception("ignoreATest 30 failed");
- if (cast(int)ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two) != 32) throw new Exception("ignoreATest 32 failed");
- if (cast(int)ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three) != 33) throw new Exception("ignoreATest 33 failed");
- }
- {
- if (cast(int)ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven) != 11) throw new Exception("ignoreBTest 11 failed");
- if (cast(int)ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve) != 12) throw new Exception("ignoreBTest 12 failed");
- if (cast(int)ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one) != 31) throw new Exception("ignoreBTest 31 failed");
- if (cast(int)ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two) != 32) throw new Exception("ignoreBTest 32 failed");
- if (cast(int)ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one) != 41) throw new Exception("ignoreBTest 41 failed");
- if (cast(int)ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two) != 42) throw new Exception("ignoreBTest 42 failed");
- }
- {
- if (cast(int)ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten) != 10) throw new Exception("ignoreCTest 10 failed");
- if (cast(int)ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve) != 12) throw new Exception("ignoreCTest 12 failed");
- if (cast(int)ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty) != 30) throw new Exception("ignoreCTest 30 failed");
- if (cast(int)ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two) != 32) throw new Exception("ignoreCTest 32 failed");
- if (cast(int)ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty) != 40) throw new Exception("ignoreCTest 40 failed");
- if (cast(int)ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two) != 42) throw new Exception("ignoreCTest 42 failed");
- }
- {
- if (cast(int)ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one) != 21) throw new Exception("ignoreDTest 21 failed");
- if (cast(int)ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two) != 22) throw new Exception("ignoreDTest 22 failed");
- }
- {
- if (cast(int)ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero) != 0) throw new Exception("ignoreETest 0 failed");
- if (cast(int)ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one) != 21) throw new Exception("ignoreETest 21 failed");
- if (cast(int)ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two) != 22) throw new Exception("ignoreETest 22 failed");
- }
- // ignore enum item tests end
- {
- if (cast(int)repeatTest(repeat.one) != 1) throw new Exception("repeatTest 1 failed");
- if (cast(int)repeatTest(repeat.initial) != 1) throw new Exception("repeatTest 2 failed");
- if (cast(int)repeatTest(repeat.two) != 2) throw new Exception("repeatTest 3 failed");
- if (cast(int)repeatTest(repeat.three) != 3) throw new Exception("repeatTest 4 failed");
- if (cast(int)repeatTest(repeat.llast) != 3) throw new Exception("repeatTest 5 failed");
- if (cast(int)repeatTest(repeat.end) != 3) throw new Exception("repeatTest 6 failed");
- }
- // different types
- {
- if (cast(int)differentTypesTest(DifferentTypes.typeint) != 10) throw new Exception("differentTypes 1 failed");
- if (cast(int)differentTypesTest(DifferentTypes.typeboolfalse) != 0) throw new Exception("differentTypes 2 failed");
- if (cast(int)differentTypesTest(DifferentTypes.typebooltrue) != 1) throw new Exception("differentTypes 3 failed");
- if (cast(int)differentTypesTest(DifferentTypes.typebooltwo) != 2) throw new Exception("differentTypes 4 failed");
- if (cast(int)differentTypesTest(DifferentTypes.typechar) != 'C') throw new Exception("differentTypes 5 failed");
- if (cast(int)differentTypesTest(DifferentTypes.typedefaultint) != 'D') throw new Exception("differentTypes 6 failed");
-
- int global_enum = global_typeint;
- if (cast(int)globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
- global_enum = global_typeboolfalse;
- if (cast(int)globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
- global_enum = global_typebooltrue;
- if (cast(int)globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
- global_enum = global_typebooltwo;
- if (cast(int)globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
- global_enum = global_typechar;
- if (cast(int)globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
- global_enum = global_typedefaultint;
- if (cast(int)globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
- }
-}
diff --git a/Examples/test-suite/d/inherit_target_language_runme.1.d b/Examples/test-suite/d/inherit_target_language_runme.1.d
deleted file mode 100644
index 8a13caca4..000000000
--- a/Examples/test-suite/d/inherit_target_language_runme.1.d
+++ /dev/null
@@ -1,29 +0,0 @@
-module inherit_target_language_runme;
-
-import inherit_target_language.BaseX;
-import inherit_target_language.Derived1;
-import inherit_target_language.Derived2;
-import inherit_target_language.DerivedX;
-import inherit_target_language.MultipleDerived1;
-import inherit_target_language.MultipleDerived2;
-import inherit_target_language.MultipleDerived3;
-import inherit_target_language.MultipleDerived4;
-
-void main() {
- (new Derived1()).targetLanguageBaseMethod();
- (new Derived2()).targetLanguageBaseMethod();
-
- (new MultipleDerived1()).targetLanguageBaseMethod();
- (new MultipleDerived2()).targetLanguageBaseMethod();
- (new MultipleDerived3()).f();
- (new MultipleDerived4()).g();
-
- auto baseX = new BaseX();
- baseX.basex();
- baseX.targetLanguageBase2Method();
-
- auto derivedX = new DerivedX();
- derivedX.basex();
- derivedX.derivedx();
- derivedX.targetLanguageBase2Method();
-}
diff --git a/Examples/test-suite/d/li_attribute_runme.1.d b/Examples/test-suite/d/li_attribute_runme.1.d
deleted file mode 100644
index ada3ed8d8..000000000
--- a/Examples/test-suite/d/li_attribute_runme.1.d
+++ /dev/null
@@ -1,75 +0,0 @@
-module li_attribute_runme;
-
-import li_attribute.A;
-import li_attribute.B;
-import li_attribute.MyClass;
-import li_attribute.MyClassVal;
-import li_attribute.MyStringyClass;
-import li_attribute.MyFoo;
-import li_attribute.Param_i;
-
-void main() {
- auto aa = new A(1,2,3);
-
- if (aa.a != 1)
- throw new Exception("error");
- aa.a = 3;
- if (aa.a != 3)
- throw new Exception("error");
-
- if (aa.b != 2)
- throw new Exception("error");
- aa.b = 5;
- if (aa.b != 5)
- throw new Exception("error");
-
- if (aa.d != aa.b)
- throw new Exception("error");
-
- if (aa.c != 3)
- throw new Exception("error");
-
- auto pi = new Param_i(7);
- if (pi.value != 7)
- throw new Exception("error");
-
- pi.value=3;
- if (pi.value != 3)
- throw new Exception("error");
-
- auto b = new B(aa);
- if (b.a.c != 3)
- throw new Exception("error");
-
- // class/struct attribute with get/set methods using return/pass by reference
- auto myFoo = new MyFoo();
- myFoo.x = 8;
- auto myClass = new MyClass();
- myClass.Foo = myFoo;
- if (myClass.Foo.x != 8)
- throw new Exception("error");
-
- // class/struct attribute with get/set methods using return/pass by value
- auto myClassVal = new MyClassVal();
- if (myClassVal.ReadWriteFoo.x != -1)
- throw new Exception("error");
- if (myClassVal.ReadOnlyFoo.x != -1)
- throw new Exception("error");
- myClassVal.ReadWriteFoo = myFoo;
- if (myClassVal.ReadWriteFoo.x != 8)
- throw new Exception("error");
- if (myClassVal.ReadOnlyFoo.x != 8)
- throw new Exception("error");
-
- // string attribute with get/set methods using return/pass by value
- auto myStringClass = new MyStringyClass("initial string");
- if (myStringClass.ReadWriteString != "initial string")
- throw new Exception("error");
- if (myStringClass.ReadOnlyString != "initial string")
- throw new Exception("error");
- myStringClass.ReadWriteString = "changed string";
- if (myStringClass.ReadWriteString != "changed string")
- throw new Exception("error");
- if (myStringClass.ReadOnlyString != "changed string")
- throw new Exception("error");
-}
diff --git a/Examples/test-suite/d/li_boost_shared_ptr_bits_runme.1.d b/Examples/test-suite/d/li_boost_shared_ptr_bits_runme.1.d
deleted file mode 100644
index 098570b95..000000000
--- a/Examples/test-suite/d/li_boost_shared_ptr_bits_runme.1.d
+++ /dev/null
@@ -1,21 +0,0 @@
-module li_boost_shared_ptr_runme_bits;
-
-import li_boost_shared_ptr_bits.li_boost_shared_ptr_bits;
-import li_boost_shared_ptr_bits.HiddenDestructor;
-import li_boost_shared_ptr_bits.IntHolder;
-import li_boost_shared_ptr_bits.VectorIntHolder;
-
-void main() {
- auto v = new VectorIntHolder();
- v ~= new IntHolder(11);
- v ~= new IntHolder(22);
- v ~= new IntHolder(33);
-
- if (sum(v) != 66) {
- throw new Exception("sum is wrong");
- }
-
- {
- scope hidden = HiddenDestructor.create();
- }
-}
diff --git a/Examples/test-suite/d/li_boost_shared_ptr_runme.1.d b/Examples/test-suite/d/li_boost_shared_ptr_runme.1.d
deleted file mode 100644
index ed55cd302..000000000
--- a/Examples/test-suite/d/li_boost_shared_ptr_runme.1.d
+++ /dev/null
@@ -1,604 +0,0 @@
-module li_boost_shared_ptr_runme;
-
-import tango.io.Stdout;
-import tango.core.Exception;
-import tango.core.Memory;
-import tango.core.Thread;
-import tango.text.convert.Integer;
-import li_boost_shared_ptr.li_boost_shared_ptr;
-import li_boost_shared_ptr.Klass;
-import li_boost_shared_ptr.KlassDerived;
-import li_boost_shared_ptr.Klass3rdDerived;
-import li_boost_shared_ptr.MemberVariables;
-import li_boost_shared_ptr.PairIntDouble;
-
-// Debugging flag
-const bool TRACE = false;
-
-void main() {
- if (TRACE)
- Stdout("---> STARTED <---").newline;
-
- debug_shared=TRACE;
-
- // Change loop count to run for a long time to monitor memory
- const int LOOP_COUNT = 1; // 50000;
- for (int i = 0; i < LOOP_COUNT; ++i) {
- runTest();
- GC.collect();
- }
-
- if (TRACE)
- Stdout("---> NEARLY FINISHED <---").newline;
-
- // Try to get the GC to collect everything not referenced anymore.
- int countdown = 100;
- while (--countdown) {
- GC.collect();
- if (Klass.getTotal_count() == 1)
- break;
- Thread.sleep(0.01);
- }
-
- // A single remaining instance expected: the global variable (GlobalValue).
- if (Klass.getTotal_count() != 1)
- throw new Exception("Klass.total_count=" ~ toString(Klass.getTotal_count()));
-
- // A single remaining instance expected: the global variable (GlobalSmartValue).
- int wrapper_count = shared_ptr_wrapper_count();
- if (wrapper_count != NOT_COUNTING)
- if (wrapper_count != 1)
- throw new Exception("shared_ptr wrapper count=" ~ toString(wrapper_count));
-
- if (TRACE)
- Stdout("---> FINISHED <---").newline;
-}
-
-void runTest() {
- // simple shared_ptr usage - created in C++
- {
- auto k = new Klass("me oh my");
- char[] val = k.getValue();
- verifyValue("me oh my", val);
- verifyCount(1, k);
- }
-
- // simple shared_ptr usage - not created in C++
- {
- auto k = factorycreate();
- char[] val = k.getValue();
- verifyValue("factorycreate", val);
- verifyCount(1, k);
- }
-
- // pass by shared_ptr
- {
- auto k = new Klass("me oh my");
- auto kret = smartpointertest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my smartpointertest", val);
- verifyCount(2, k);
- verifyCount(2, kret);
- }
-
- // pass by shared_ptr pointer
- {
- auto k = new Klass("me oh my");
- auto kret = smartpointerpointertest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my smartpointerpointertest", val);
- verifyCount(2, k);
- verifyCount(2, kret);
- }
-
- // pass by shared_ptr reference
- {
- auto k = new Klass("me oh my");
- auto kret = smartpointerreftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my smartpointerreftest", val);
- verifyCount(2, k);
- verifyCount(2, kret);
- }
-
- // pass by shared_ptr pointer reference
- {
- auto k = new Klass("me oh my");
- auto kret = smartpointerpointerreftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my smartpointerpointerreftest", val);
- verifyCount(2, k);
- verifyCount(2, kret);
- }
-
- // const pass by shared_ptr
- {
- auto k = new Klass("me oh my");
- auto kret = constsmartpointertest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my", val);
- verifyCount(2, k);
- verifyCount(2, kret);
- }
-
- // const pass by shared_ptr pointer
- {
- auto k = new Klass("me oh my");
- auto kret = constsmartpointerpointertest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my", val);
- verifyCount(2, k);
- verifyCount(2, kret);
- }
-
- // const pass by shared_ptr reference
- {
- auto k = new Klass("me oh my");
- auto kret = constsmartpointerreftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my", val);
- verifyCount(2, k);
- verifyCount(2, kret);
- }
-
- // pass by value
- {
- auto k = new Klass("me oh my");
- auto kret = valuetest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my valuetest", val);
- verifyCount(1, k);
- verifyCount(1, kret);
- }
-
- // pass by pointer
- {
- auto k = new Klass("me oh my");
- auto kret = pointertest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my pointertest", val);
- verifyCount(1, k);
- verifyCount(1, kret);
- }
-
- // pass by reference
- {
- auto k = new Klass("me oh my");
- auto kret = reftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my reftest", val);
- verifyCount(1, k);
- verifyCount(1, kret);
- }
-
- // pass by pointer reference
- {
- auto k = new Klass("me oh my");
- auto kret = pointerreftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my pointerreftest", val);
- verifyCount(1, k);
- verifyCount(1, kret);
- }
-
- // null tests
- {
- Klass k = null;
-
- // TODO: add in const versions too
- if (smartpointertest(k) !is null)
- throw new Exception("return was not null");
-
- if (smartpointerpointertest(k) !is null)
- throw new Exception("return was not null");
-
- if (smartpointerreftest(k) !is null)
- throw new Exception("return was not null");
-
- if (smartpointerpointerreftest(k) !is null)
- throw new Exception("return was not null");
-
- if (nullsmartpointerpointertest(null) != "null pointer")
- throw new Exception("not null smartpointer pointer");
-
- try { valuetest(k); throw new Exception("Failed to catch null pointer"); } catch (IllegalArgumentException) {}
-
- if (pointertest(k) !is null)
- throw new Exception("return was not null");
-
- try { reftest(k); throw new Exception("Failed to catch null pointer"); } catch (IllegalArgumentException) {}
- }
-
- // $owner
- {
- auto k = pointerownertest();
- char[] val = k.getValue();
- verifyValue("pointerownertest", val);
- verifyCount(1, k);
- }
- {
- auto k = smartpointerpointerownertest();
- char[] val = k.getValue();
- verifyValue("smartpointerpointerownertest", val);
- verifyCount(1, k);
- }
-
- ////////////////////////////////// Derived classes ////////////////////////////////////////
- // derived pass by shared_ptr
- {
- auto k = new KlassDerived("me oh my");
- auto kret = derivedsmartptrtest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my derivedsmartptrtest-Derived", val);
- verifyCount(4, k); // includes two extra references for upcasts in the proxy classes
- verifyCount(4, kret);
- }
- // derived pass by shared_ptr pointer
- {
- auto k = new KlassDerived("me oh my");
- auto kret = derivedsmartptrpointertest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my derivedsmartptrpointertest-Derived", val);
- verifyCount(4, k); // includes two extra references for upcasts in the proxy classes
- verifyCount(4, kret);
- }
- // derived pass by shared_ptr ref
- {
- auto k = new KlassDerived("me oh my");
- auto kret = derivedsmartptrreftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my derivedsmartptrreftest-Derived", val);
- verifyCount(4, k); // includes two extra references for upcasts in the proxy classes
- verifyCount(4, kret);
- }
- // derived pass by shared_ptr pointer ref
- {
- auto k = new KlassDerived("me oh my");
- auto kret = derivedsmartptrpointerreftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my derivedsmartptrpointerreftest-Derived", val);
- verifyCount(4, k); // includes two extra references for upcasts in the proxy classes
- verifyCount(4, kret);
- }
- // derived pass by pointer
- {
- auto k = new KlassDerived("me oh my");
- auto kret = derivedpointertest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my derivedpointertest-Derived", val);
- verifyCount(2, k); // includes an extra reference for the upcast in the proxy class
- verifyCount(2, kret);
- }
- // derived pass by ref
- {
- auto k = new KlassDerived("me oh my");
- auto kret = derivedreftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my derivedreftest-Derived", val);
- verifyCount(2, k); // includes an extra reference for the upcast in the proxy class
- verifyCount(2, kret);
- }
-
- ////////////////////////////////// Derived and base class mixed ////////////////////////////////////////
- // pass by shared_ptr (mixed)
- {
- auto k = new KlassDerived("me oh my");
- auto kret = smartpointertest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my smartpointertest-Derived", val);
- verifyCount(3, k); // an extra reference for the upcast in the proxy class
- verifyCount(3, kret);
- }
-
- // pass by shared_ptr pointer (mixed)
- {
- auto k = new KlassDerived("me oh my");
- auto kret = smartpointerpointertest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my smartpointerpointertest-Derived", val);
- verifyCount(3, k); // an extra reference for the upcast in the proxy class
- verifyCount(3, kret);
- }
-
- // pass by shared_ptr reference (mixed)
- {
- auto k = new KlassDerived("me oh my");
- auto kret = smartpointerreftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my smartpointerreftest-Derived", val);
- verifyCount(3, k); // an extra reference for the upcast in the proxy class
- verifyCount(3, kret);
- }
-
- // pass by shared_ptr pointer reference (mixed)
- {
- auto k = new KlassDerived("me oh my");
- auto kret = smartpointerpointerreftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my smartpointerpointerreftest-Derived", val);
- verifyCount(3, k); // an extra reference for the upcast in the proxy class
- verifyCount(3, kret);
- }
-
- // pass by value (mixed)
- {
- auto k = new KlassDerived("me oh my");
- auto kret = valuetest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my valuetest", val); // note slicing
- verifyCount(2, k); // an extra reference for the upcast in the proxy class
- verifyCount(1, kret);
- }
-
- // pass by pointer (mixed)
- {
- auto k = new KlassDerived("me oh my");
- auto kret = pointertest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my pointertest-Derived", val);
- verifyCount(2, k); // an extra reference for the upcast in the proxy class
- verifyCount(1, kret);
- }
-
- // pass by ref (mixed)
- {
- auto k = new KlassDerived("me oh my");
- auto kret = reftest(k);
- char[] val = kret.getValue();
- verifyValue("me oh my reftest-Derived", val);
- verifyCount(2, k); // an extra reference for the upcast in the proxy class
- verifyCount(1, kret);
- }
-
- // 3rd derived class
- {
- auto k = new Klass3rdDerived("me oh my");
- char[] val = k.getValue();
- verifyValue("me oh my-3rdDerived", val);
- verifyCount(3, k); // 3 classes in inheritance chain == 3 swigCPtr values
- val = test3rdupcast(k);
- verifyValue("me oh my-3rdDerived", val);
- verifyCount(3, k);
- }
-
- ////////////////////////////////// Member variables ////////////////////////////////////////
- // smart pointer by value
- {
- auto m = new MemberVariables();
- auto k = new Klass("smart member value");
- m.SmartMemberValue = k;
- char[] val = k.getValue();
- verifyValue("smart member value", val);
- verifyCount(2, k);
-
- auto kmember = m.SmartMemberValue;
- val = kmember.getValue();
- verifyValue("smart member value", val);
- verifyCount(3, kmember);
- verifyCount(3, k);
-
- delete m;
-
- verifyCount(2, kmember);
- verifyCount(2, k);
- }
- // smart pointer by pointer
- {
- auto m = new MemberVariables();
- auto k = new Klass("smart member pointer");
- m.SmartMemberPointer = k;
- char[] val = k.getValue();
- verifyValue("smart member pointer", val);
- verifyCount(1, k);
-
- auto kmember = m.SmartMemberPointer;
- val = kmember.getValue();
- verifyValue("smart member pointer", val);
- verifyCount(2, kmember);
- verifyCount(2, k);
-
- delete m;
-
- verifyCount(2, kmember);
- verifyCount(2, k);
- }
- // smart pointer by reference
- {
- auto m = new MemberVariables();
- auto k = new Klass("smart member reference");
- m.SmartMemberReference = k;
- char[] val = k.getValue();
- verifyValue("smart member reference", val);
- verifyCount(2, k);
-
- auto kmember = m.SmartMemberReference;
- val = kmember.getValue();
- verifyValue("smart member reference", val);
- verifyCount(3, kmember);
- verifyCount(3, k);
-
- // The C++ reference refers to SmartMemberValue...
- auto kmemberVal = m.SmartMemberValue;
- val = kmember.getValue();
- verifyValue("smart member reference", val);
- verifyCount(4, kmemberVal);
- verifyCount(4, kmember);
- verifyCount(4, k);
-
- delete m;
-
- verifyCount(3, kmember);
- verifyCount(3, k);
- }
- // plain by value
- {
- auto m = new MemberVariables();
- auto k = new Klass("plain member value");
- m.MemberValue = k;
- char[] val = k.getValue();
- verifyValue("plain member value", val);
- verifyCount(1, k);
-
- auto kmember = m.MemberValue;
- val = kmember.getValue();
- verifyValue("plain member value", val);
- verifyCount(1, kmember);
- verifyCount(1, k);
-
- delete m;
-
- verifyCount(1, kmember);
- verifyCount(1, k);
- }
- // plain by pointer
- {
- auto m = new MemberVariables();
- auto k = new Klass("plain member pointer");
- m.MemberPointer = k;
- char[] val = k.getValue();
- verifyValue("plain member pointer", val);
- verifyCount(1, k);
-
- auto kmember = m.MemberPointer;
- val = kmember.getValue();
- verifyValue("plain member pointer", val);
- verifyCount(1, kmember);
- verifyCount(1, k);
-
- delete m;
-
- verifyCount(1, kmember);
- verifyCount(1, k);
- }
- // plain by reference
- {
- auto m = new MemberVariables();
- auto k = new Klass("plain member reference");
- m.MemberReference = k;
- char[] val = k.getValue();
- verifyValue("plain member reference", val);
- verifyCount(1, k);
-
- auto kmember = m.MemberReference;
- val = kmember.getValue();
- verifyValue("plain member reference", val);
- verifyCount(1, kmember);
- verifyCount(1, k);
-
- delete m;
-
- verifyCount(1, kmember);
- verifyCount(1, k);
- }
-
- // null member variables
- {
- auto m = new MemberVariables();
-
- // shared_ptr by value
- auto k = m.SmartMemberValue;
- if (k !is null)
- throw new Exception("expected null");
- m.SmartMemberValue = null;
- k = m.SmartMemberValue;
- if (k !is null)
- throw new Exception("expected null");
- verifyCount(0, k);
-
- // plain by value
- try { m.MemberValue = null; throw new Exception("Failed to catch null pointer"); } catch (IllegalArgumentException) {}
- }
-
- ////////////////////////////////// Global variables ////////////////////////////////////////
- // smart pointer
- {
- auto kglobal = GlobalSmartValue;
- if (kglobal !is null)
- throw new Exception("expected null");
-
- auto k = new Klass("smart global value");
- GlobalSmartValue = k;
- verifyCount(2, k);
-
- kglobal = GlobalSmartValue;
- char[] val = kglobal.getValue();
- verifyValue("smart global value", val);
- verifyCount(3, kglobal);
- verifyCount(3, k);
- verifyValue("smart global value", GlobalSmartValue.getValue());
- GlobalSmartValue = null;
- }
- // plain value
- {
- Klass kglobal;
-
- auto k = new Klass("global value");
- GlobalValue = k;
- verifyCount(1, k);
-
- kglobal = GlobalValue;
- char[] val = kglobal.getValue();
- verifyValue("global value", val);
- verifyCount(1, kglobal);
- verifyCount(1, k);
- verifyValue("global value", GlobalValue.getValue());
-
- try { GlobalValue = null; throw new Exception("Failed to catch null pointer"); } catch (IllegalArgumentException) {}
- }
- // plain pointer
- {
- auto kglobal = GlobalPointer;
- if (kglobal !is null)
- throw new Exception("expected null");
-
- auto k = new Klass("global pointer");
- GlobalPointer = k;
- verifyCount(1, k);
-
- kglobal = GlobalPointer;
- char[] val = kglobal.getValue();
- verifyValue("global pointer", val);
- verifyCount(1, kglobal);
- verifyCount(1, k);
- GlobalPointer = null;
- }
- // plain reference
- {
- Klass kglobal;
-
- auto k = new Klass("global reference");
- GlobalReference = k;
- verifyCount(1, k);
-
- kglobal = GlobalReference;
- char[] val = kglobal.getValue();
- verifyValue("global reference", val);
- verifyCount(1, kglobal);
- verifyCount(1, k);
-
- try { GlobalReference = null; throw new Exception("Failed to catch null pointer"); } catch (IllegalArgumentException) {}
- }
-
- ////////////////////////////////// Templates ////////////////////////////////////////
- {
- PairIntDouble pid = new PairIntDouble(10, 20.2);
- if (pid.baseVal1 != 20 || pid.baseVal2 != 40.4)
- throw new Exception("Base values wrong");
- if (pid.val1 != 10 || pid.val2 != 20.2)
- throw new Exception("Derived Values wrong");
- }
-}
-
-private void verifyValue(char[] expected, char[] got) {
- if (expected != got)
- throw new Exception("verify value failed. Expected: " ~ expected ~ " Got: " ~ got);
-}
-
-private void verifyCount(int expected, Klass k) {
- // We deliberately call the use_count(Klass) overload also for objects which
- // are instances of a subclass of Klass (due to static dispatch); things still
- // have to work.
- int got = use_count(k);
- if (expected != got)
- throw new Exception("verify use_count failed. Expected: " ~ toString(expected) ~ " Got: " ~ toString(got));
-}
diff --git a/Examples/test-suite/d/li_std_auto_ptr_runme.1.d b/Examples/test-suite/d/li_std_auto_ptr_runme.1.d
deleted file mode 100644
index 86fac68b5..000000000
--- a/Examples/test-suite/d/li_std_auto_ptr_runme.1.d
+++ /dev/null
@@ -1,123 +0,0 @@
-module li_std_auto_ptr_runme;
-
-import li_std_auto_ptr.li_std_auto_ptr;
-import li_std_auto_ptr.Klass;
-import li_std_auto_ptr.KlassInheritance;
-import std.conv;
-import std.algorithm;
-
-void checkCount(int expected_count) {
- int actual_count = Klass.getTotal_count();
- if (actual_count != expected_count)
- throw new Exception("Counts incorrect, expected:" ~ to!string(expected_count) ~ " actual:" ~ to!string(actual_count));
-}
-
-void main() {
- // Test raw pointer handling involving virtual inheritance
- {
- scope KlassInheritance kini = new KlassInheritance("KlassInheritanceInput");
- checkCount(1);
- string s = useKlassRawPtr(kini);
- if (s != "KlassInheritanceInput")
- throw new Exception("Incorrect string: " ~ s);
- }
- checkCount(0);
-
- // auto_ptr as input
- {
- scope Klass kin = new Klass("KlassInput");
- checkCount(1);
- string s = takeKlassAutoPtr(kin);
- checkCount(0);
- if (s != "KlassInput")
- throw new Exception("Incorrect string: " ~ s);
- if (!is_nullptr(kin))
- throw new Exception("is_nullptr failed");
- } // dispose should not fail, even though already deleted
- checkCount(0);
-
- {
- scope Klass kin = new Klass("KlassInput");
- checkCount(1);
- string s = takeKlassAutoPtr(kin);
- checkCount(0);
- if (s != "KlassInput")
- throw new Exception("Incorrect string: " ~ s);
- if (!is_nullptr(kin))
- throw new Exception("is_nullptr failed");
- bool exception_thrown = false;
- try {
- takeKlassAutoPtr(kin);
- } catch (Exception e) {
- if (!canFind(e.msg, "Cannot release ownership as memory is not owned"))
- throw new Exception("incorrect exception message: " ~ e.msg);
- exception_thrown = true;
- }
- if (!exception_thrown)
- throw new Exception("double usage of takeKlassAutoPtr should have been an error");
- } // dispose should not fail, even though already deleted
- checkCount(0);
-
- {
- scope Klass kin = new Klass("KlassInput");
- bool exception_thrown = false;
- Klass notowned = get_not_owned_ptr(kin);
- try {
- takeKlassAutoPtr(notowned);
- } catch (Exception e) {
- if (!canFind(e.msg, "Cannot release ownership as memory is not owned"))
- throw new Exception("incorrect exception message: " ~ e.msg);
- exception_thrown = true;
- }
- if (!exception_thrown)
- throw new Exception("Should have thrown 'Cannot release ownership as memory is not owned' error");
- checkCount(1);
- }
- checkCount(0);
-
- {
- scope KlassInheritance kini = new KlassInheritance("KlassInheritanceInput");
- checkCount(1);
- string s = takeKlassAutoPtr(kini);
- checkCount(0);
- if (s != "KlassInheritanceInput")
- throw new Exception("Incorrect string: " ~ s);
- if (!is_nullptr(kini))
- throw new Exception("is_nullptr failed");
- } // dispose should not fail, even though already deleted
- checkCount(0);
-
- takeKlassAutoPtr(null);
- takeKlassAutoPtr(make_null());
- checkCount(0);
-
- // overloaded parameters
- if (overloadTest() != 0)
- throw new Exception("overloadTest failed");
- if (overloadTest(null) != 1)
- throw new Exception("overloadTest failed");
- if (overloadTest(new Klass("over")) != 1)
- throw new Exception("overloadTest failed");
- checkCount(0);
-
-
- // auto_ptr as output
- Klass k1 = makeKlassAutoPtr("first");
- if (k1.getLabel() != "first")
- throw new Exception("wrong object label");
-
- Klass k2 = makeKlassAutoPtr("second");
- checkCount(2);
-
- k1.dispose();
- checkCount(1);
-
- if (k2.getLabel() != "second")
- throw new Exception("wrong object label");
-
- k2.dispose();
- checkCount(0);
-
- if (makeNullAutoPtr() !is null)
- throw new Exception("null failure");
-}
diff --git a/Examples/test-suite/d/li_std_except_runme.1.d b/Examples/test-suite/d/li_std_except_runme.1.d
deleted file mode 100644
index 39f3bb202..000000000
--- a/Examples/test-suite/d/li_std_except_runme.1.d
+++ /dev/null
@@ -1,40 +0,0 @@
-module li_std_except_runme;
-
-import tango.core.Exception;
-import tango.io.Console;
-import li_std_except.Test;
-
-void main() {
- with (new Test()) {
- mixin(test("Exception", "throw_bad_exception"));
- mixin(test("Exception", "throw_domain_error"));
- mixin(test("Exception", "throw_exception"));
- mixin(test("IllegalArgumentException", "throw_invalid_argument"));
- mixin(test("NoSuchElementException", "throw_length_error"));
- mixin(test("Exception", "throw_logic_error"));
- mixin(test("NoSuchElementException", "throw_out_of_range"));
- mixin(test("Exception", "throw_overflow_error"));
- mixin(test("Exception", "throw_range_error"));
- mixin(test("Exception", "throw_runtime_error"));
- mixin(test("Exception", "throw_underflow_error"));
- }
-}
-
-char[] test(char[] e, char[] f) {
- return "if (!works!(" ~ e ~ ")(&" ~ f ~ ")) {\n" ~
- "throw new Exception(\"" ~ f ~ " failed\");\n" ~
- "}";
-}
-
-bool works(alias E, F)(F f) {
- try {
- try {
- f();
- } catch(E) {
- return true;
- }
- } catch(Exception e) {
- Cerr( "Received wrong exception: " ~ e.classinfo.name ).newline;
- }
- return false;
-}
diff --git a/Examples/test-suite/d/li_std_string_runme.1.d b/Examples/test-suite/d/li_std_string_runme.1.d
deleted file mode 100644
index b5bbb51c0..000000000
--- a/Examples/test-suite/d/li_std_string_runme.1.d
+++ /dev/null
@@ -1,97 +0,0 @@
-module li_std_string_runme;
-
-import tango.core.Exception;
-import li_std_string.li_std_string;
-import li_std_string.Structure;
-import li_std_string.SWIGTYPE_p_std__string;
-
-
-void main() {
- // Checking expected use of %typemap(in) std::string {}
- test_value("Fee");
-
- // Checking expected result of %typemap(out) std::string {}
- if (test_value("Fi") != "Fi")
- throw new Exception("Test 1 failed");
-
- // Verify type-checking for %typemap(in) std::string {}
- try {
- test_value(null);
- throw new Exception("Test 2 failed");
- } catch (IllegalArgumentException) {
- }
-
- // Checking expected use of %typemap(in) const std::string & {}
- test_const_reference("Fo");
-
- // Checking expected result of %typemap(out) const std::string& {}
- if (test_const_reference("Fum") != "Fum")
- throw new Exception("Test 3 failed");
-
- // Verify type-checking for %typemap(in) const std::string & {}
- try {
- test_const_reference(null);
- throw new Exception("Test 4 failed");
- } catch (IllegalArgumentException) {
- }
-
- // Input and output typemaps for pointers and non-const references to
- // std::string are *not* supported; the following tests confirm
- // that none of these cases are slipping through.
-
- SWIGTYPE_p_std__string stringPtr = null;
-
- stringPtr = test_pointer_out();
- test_pointer(stringPtr);
-
- stringPtr = test_const_pointer_out();
- test_const_pointer(stringPtr);
-
- stringPtr = test_reference_out();
- test_reference(stringPtr);
-
- // Check throw exception specification
- try {
- test_throw();
- throw new Exception("test 5 failed!");
- } catch (Exception e) {
- if (e.msg != "test_throw message")
- throw new Exception("Test 5 string check: " ~ e.msg);
- }
- try {
- test_const_reference_throw();
- throw new Exception("test 6 failed!");
- } catch (Exception e) {
- if (e.msg != "test_const_reference_throw message")
- throw new Exception("Test 6 string check: " ~ e.msg);
- }
-
- // Global variables.
- const char[] s = "initial string";
- if (GlobalString2 != "global string 2")
- throw new Exception("GlobalString2 test 1");
- GlobalString2 = s;
- if (GlobalString2 != s)
- throw new Exception("GlobalString2 test 2");
- if (ConstGlobalString != "const global string")
- throw new Exception("ConstGlobalString test");
-
- // Member variables.
- auto myStructure = new Structure();
- if (myStructure.MemberString2 != "member string 2")
- throw new Exception("MemberString2 test 1");
- myStructure.MemberString2 = s;
- if (myStructure.MemberString2 != s)
- throw new Exception("MemberString2 test 2");
- if (myStructure.ConstMemberString != "const member string")
- throw new Exception("ConstMemberString test");
-
- // Static member variables.
- if (Structure.StaticMemberString2 != "static member string 2")
- throw new Exception("StaticMemberString2 test 1");
- Structure.StaticMemberString2 = s;
- if (Structure.StaticMemberString2 != s)
- throw new Exception("StaticMemberString2 test 2");
- if (Structure.ConstStaticMemberString != "const static member string")
- throw new Exception("ConstStaticMemberString test");
-}
diff --git a/Examples/test-suite/d/li_std_vector_runme.1.d b/Examples/test-suite/d/li_std_vector_runme.1.d
deleted file mode 100644
index 895fb450f..000000000
--- a/Examples/test-suite/d/li_std_vector_runme.1.d
+++ /dev/null
@@ -1,219 +0,0 @@
-module li_std_vector_runme;
-
-import tango.core.Exception;
-import tango.io.Stdout;
-import Integer = tango.text.convert.Integer;
-import li_std_vector.li_std_vector;
-import li_std_vector.DoubleVector;
-import li_std_vector.IntVector;
-import li_std_vector.IntPtrVector;
-import li_std_vector.IntConstPtrVector;
-import li_std_vector.RealVector;
-import li_std_vector.Struct;
-import li_std_vector.StructVector;
-import li_std_vector.StructPtrVector;
-import li_std_vector.StructConstPtrVector;
-
-const size_t SIZE = 20;
-
-void main() {
- // Basic functionality tests.
- {
- auto vector = new IntVector();
- for (size_t i = 0; i < SIZE; ++i) {
- vector ~= i * 10;
- }
-
- if (vector.length != SIZE) {
- throw new Exception("length test failed.");
- }
-
- vector[0] = 200;
- if (vector[0] != 200) {
- throw new Exception("indexing test failed");
- }
- vector[0] = 0 * 10;
-
- try {
- vector[vector.length] = 777;
- throw new Exception("out of range test failed");
- } catch (NoSuchElementException) {
- }
-
- foreach (i, value; vector) {
- if (value != (i * 10)) {
- throw new Exception("foreach test failed, i: " ~ Integer.toString(i));
- }
- }
-
- vector.clear();
- if (vector.size != 0) {
- throw new Exception("clear test failed");
- }
- }
-
- // Slice tests.
- {
- auto dVector = new DoubleVector();
- for (size_t i = 0; i < SIZE; ++i) {
- dVector ~= i * 10.1f;
- }
-
- double[] dArray = dVector[];
- foreach (i, value; dArray) {
- if (dVector[i] != value) {
- throw new Exception("slice test 1 failed, i: " ~ Integer.toString(i));
- }
- }
-
-
- auto sVector = new StructVector();
- for (size_t i = 0; i < SIZE; i++) {
- sVector ~= new Struct(i / 10.0);
- }
-
- Struct[] array = sVector[];
-
- for (size_t i = 0; i < SIZE; i++) {
- // Make sure that a shallow copy has been made.
- void* aPtr = Struct.swigGetCPtr(array[i]);
- void* vPtr = Struct.swigGetCPtr(sVector[i]);
- if (aPtr != vPtr) {
- throw new Exception("slice test 2 failed, i: " ~
- Integer.toString(i));
- }
- }
- }
-
- // remove() tests.
- {
- auto iVector = new IntVector();
- for (int i = 0; i < SIZE; i++) {
- iVector ~= i;
- }
-
- iVector.remove(iVector.length - 1);
- iVector.remove(SIZE / 2);
- iVector.remove(0);
-
- try {
- iVector.remove(iVector.size);
- throw new Exception("remove test failed");
- } catch (NoSuchElementException) {
- }
- }
-
- // Capacity tests.
- {
- auto dv = new DoubleVector(10);
- if ((dv.capacity != 10) || (dv.length != 0)) {
- throw new Exception("constructor setting capacity test failed");
- }
-
- // TODO: Is this really required (and spec'ed) behavior?
- dv.capacity = 20;
- if (dv.capacity != 20) {
- throw new Exception("capacity test 1 failed");
- }
-
- dv ~= 1.11;
- try {
- dv.capacity = dv.length - 1;
- throw new Exception("capacity test 2 failed");
- } catch (IllegalArgumentException) {
- }
- }
-
- // Test the methods being wrapped.
- {
- auto iv = new IntVector();
- for (int i=0; i<4; i++) {
- iv ~= i;
- }
-
- double x = average(iv);
- x += average(new IntVector([1, 2, 3, 4]));
- RealVector rv = half(new RealVector([10.0f, 10.5f, 11.0f, 11.5f]));
-
- auto dv = new DoubleVector();
- for (size_t i = 0; i < SIZE; i++) {
- dv ~= i / 2.0;
- }
- halve_in_place(dv);
-
- RealVector v0 = vecreal(new RealVector());
- float flo = 123.456f;
- v0 ~= flo;
- flo = v0[0];
-
- IntVector v1 = vecintptr(new IntVector());
- IntPtrVector v2 = vecintptr(new IntPtrVector());
- IntConstPtrVector v3 = vecintconstptr(new IntConstPtrVector());
-
- v1 ~= 123;
- v2.clear();
- v3.clear();
-
- StructVector v4 = vecstruct(new StructVector());
- StructPtrVector v5 = vecstructptr(new StructPtrVector());
- StructConstPtrVector v6 = vecstructconstptr(new StructConstPtrVector());
-
- v4 ~= new Struct(123);
- v5 ~= new Struct(123);
- v6 ~= new Struct(123);
- }
-
- // Test vectors of pointers.
- {
- auto vector = new StructPtrVector();
- for (size_t i = 0; i < SIZE; i++) {
- vector ~= new Struct(i / 10.0);
- }
-
- Struct[] array = vector[];
-
- for (size_t i = 0; i < SIZE; i++) {
- // Make sure that a shallow copy has been made.
- void* aPtr = Struct.swigGetCPtr(array[i]);
- void* vPtr = Struct.swigGetCPtr(vector[i]);
- if (aPtr != vPtr) {
- throw new Exception("StructPtrVector test 1 failed, i: " ~
- Integer.toString(i));
- }
- }
- }
-
- // Test vectors of const pointers.
- {
- auto vector = new StructConstPtrVector();
- for (size_t i = 0; i < SIZE; i++) {
- vector ~= new Struct(i / 10.0);
- }
-
- Struct[] array = vector[];
-
- for (size_t i = 0; i < SIZE; i++) {
- // Make sure that a shallow copy has been made.
- void* aPtr = Struct.swigGetCPtr(array[i]);
- void* vPtr = Struct.swigGetCPtr(vector[i]);
- if (aPtr != vPtr) {
- throw new Exception("StructConstPtrVector test 1 failed, i: " ~
- Integer.toString(i));
- }
- }
- }
-
- // Test vectors destroyed via dispose().
- {
- {
- scope vector = new StructVector();
- vector ~= new Struct(0.0);
- vector ~= new Struct(11.1);
- }
- {
- scope vector = new DoubleVector();
- vector ~= 0.0;
- vector ~= 11.1;
- }
- }
-}
diff --git a/Examples/test-suite/d/li_typemaps_runme.1.d b/Examples/test-suite/d/li_typemaps_runme.1.d
deleted file mode 100644
index e37b12bc2..000000000
--- a/Examples/test-suite/d/li_typemaps_runme.1.d
+++ /dev/null
@@ -1,94 +0,0 @@
-/// Tests correct handling of a few INPUT/OUTPUT/INOUT-typemapped functions.
-module li_typemaps_runme;
-
-import li_typemaps.li_typemaps;
-
-void main() {
- // Check double INPUT typemaps
- if (in_double(22.22) != 22.22) raiseError("in_double");
- if (inr_double(22.22) != 22.22) raiseError("inr_double");
-
- // Check double OUTPUT typemaps
- {
- double var = 44.44;
- out_double(22.22, var);
- if (var != 22.22) raiseError("out_double");
- }
- {
- double var = 44.44;
- outr_double(22.22, var);
- if (var != 22.22) raiseError("outr_double");
- }
-
- // Check double INOUT typemaps
- {
- double var = 44.44;
- inout_double(var);
- if (var != 44.44) raiseError("inout_double");
- }
- {
- double var = 44.44;
- inoutr_double(var);
- if (var != 44.44) raiseError("inoutr_double");
- }
-
- // Check unsigned long long INPUT typemaps
- if (in_ulonglong(20) != 20) raiseError("in_ulonglong");
- if (inr_ulonglong(20) != 20) raiseError("inr_ulonglong");
-
- // Check unsigned long long OUTPUT typemaps
- {
- ulong var = 40;
- out_ulonglong(20, var);
- if (var != 20) raiseError("out_ulonglong");
- }
- {
- ulong var = 40;
- outr_ulonglong(20, var);
- if (var != 20) raiseError("outr_ulonglong");
- }
-
- // Check unsigned long long INOUT typemaps
- {
- ulong var = 40;
- inout_ulonglong(var);
- if (var != 40) raiseError("inout_ulonglong");
- }
- {
- ulong var = 40;
- inoutr_ulonglong(var);
- if (var != 40) raiseError("inoutr_ulonglong");
- }
-
- // Check unsigned bool INPUT typemaps
- if (in_bool(false) != false) raiseError("in_bool");
- if (inr_bool(false) != false) raiseError("inr_bool");
-
- // Check unsigned bool OUTPUT typemaps
- {
- bool var = false;
- out_bool(true, var);
- if (var != true) raiseError("out_bool");
- }
- {
- bool var = false;
- outr_bool(true, var);
- if (var != true) raiseError("outr_bool");
- }
-
- // Check unsigned bool INOUT typemaps
- {
- bool var = false;
- inout_bool(var);
- if (var != false) raiseError("inout_bool");
- }
- {
- bool var = false;
- inoutr_bool(var);
- if (var != false) raiseError("inoutr_bool");
- }
-}
-
-void raiseError(char[] funcName) {
- throw new Exception("Test FAILED for function " ~ funcName);
-}
diff --git a/Examples/test-suite/d/long_long_runme.1.d b/Examples/test-suite/d/long_long_runme.1.d
deleted file mode 100644
index a6d5448bc..000000000
--- a/Examples/test-suite/d/long_long_runme.1.d
+++ /dev/null
@@ -1,35 +0,0 @@
-// Checks if the long long and unsigned long long types work.
-module long_long_runme;
-
-import Integer = tango.text.convert.Integer;
-import long_long.long_long;
-
-void main() {
- check_ll(0L);
- check_ll(0x7FFFFFFFFFFFFFFFL);
- check_ll(-10L);
-
- check_ull(0u);
- check_ull(127u);
- check_ull(128u);
- check_ull(9223372036854775807u); //0x7FFFFFFFFFFFFFFFL
- check_ull(18446744073709551615u); //0xFFFFFFFFFFFFFFFFL
-}
-
-void check_ll(long value) {
- ll = value;
- long value_check = ll;
- if (value != value_check) {
- throw new Exception("Runtime test using long long failed: expected: " ~
- Integer.toString(value) ~ ", got: " ~ Integer.toString(value_check));
- }
-}
-
-void check_ull(ulong value) {
- ull = value;
- ulong value_check = ull;
- if (value != value_check) {
- throw new Exception( "Runtime test using unsigned long long failed: expected: " ~
- Integer.toString(value) ~ ", ll_check=" ~ Integer.toString(value_check));
- }
-}
diff --git a/Examples/test-suite/d/member_pointer_runme.1.d b/Examples/test-suite/d/member_pointer_runme.1.d
deleted file mode 100644
index c1f8d33b8..000000000
--- a/Examples/test-suite/d/member_pointer_runme.1.d
+++ /dev/null
@@ -1,43 +0,0 @@
-module member_pointer_runme;
-
-import Float = tango.text.convert.Float;
-import member_pointer.member_pointer;
-import member_pointer.Square;
-import member_pointer.SWIGTYPE_m_Shape__f_void__double;
-
-void main() {
- auto s = new Square(10);
-
- // Do some calculations
- auto area_pt = areapt();
- auto perim_pt = perimeterpt();
- check("Square area ", 100.0, do_op(s, area_pt));
- check("Square perim", 40.0, do_op(s, perim_pt));
-
- SWIGTYPE_m_Shape__f_void__double memberPtr = null;
- memberPtr = areavar;
- memberPtr = perimetervar;
-
- // Try the variables
- check("Square area ", 100.0, do_op(s, areavar));
- check("Square perim", 40.0, do_op(s, perimetervar));
-
- // Modify one of the variables
- areavar = perim_pt;
- check("Square perimeter", 40.0, do_op(s,areavar));
-
- // Try the constants
- memberPtr = AREAPT;
- memberPtr = PERIMPT;
- memberPtr = NULLPT;
-
- check("Square area", 100.0, do_op(s, AREAPT));
- check("Square perim", 40.0, do_op(s, PERIMPT));
-}
-
-void check(char[] what, double expected, double actual) {
- if (expected != actual) {
- throw new Exception("Failed: " ~ what ~ ": expected "
- ~ Float.toString(expected) ~ ", but got " ~ Float.toString(actual));
- }
-}
diff --git a/Examples/test-suite/d/nspace_extend_runme.1.d b/Examples/test-suite/d/nspace_extend_runme.1.d
deleted file mode 100644
index 82ccfec90..000000000
--- a/Examples/test-suite/d/nspace_extend_runme.1.d
+++ /dev/null
@@ -1,32 +0,0 @@
-module nspace_extend_runme;
-
-static import oi1c = nspace_extend.Outer.Inner1.Color;
-static import oi2c = nspace_extend.Outer.Inner2.Color;
-
-void main() {
- {
- // constructors and destructors
- scope color1 = new oi1c.Color();
- scope color = new oi1c.Color(color1);
-
- // class methods
- color.colorInstanceMethod(20.0);
- oi1c.Color.colorStaticMethod(20.0);
- auto created = oi1c.Color.create();
- }
- {
- // constructors and destructors
- scope color2 = new oi2c.Color();
- scope color = new oi2c.Color(color2);
-
- // class methods
- color.colorInstanceMethod(20.0);
- oi2c.Color.colorStaticMethod(20.0);
- auto created = oi2c.Color.create();
-
- // Same class different namespaces
- auto col1 = new oi1c.Color();
- auto col2 = oi2c.Color.create();
- col2.colors(col1, col1, col2, col2, col2);
- }
-}
diff --git a/Examples/test-suite/d/nspace_runme.1.d b/Examples/test-suite/d/nspace_runme.1.d
deleted file mode 100644
index 8d3b81f76..000000000
--- a/Examples/test-suite/d/nspace_runme.1.d
+++ /dev/null
@@ -1,87 +0,0 @@
-module nspace_runme;
-
-import nspace.nspace;
-static import nspace.NoNSpacePlease;
-static import nspace.Outer.namespce;
-static import nspace.Outer.Inner1.Channel;
-static import oi1c = nspace.Outer.Inner1.Color;
-static import nspace.Outer.Inner2.Channel;
-static import nspace.Outer.Inner2.Color;
-static import nspace.Outer.Inner3.Blue;
-static import nspace.Outer.Inner4.Blue;
-static import nspace.Outer.SomeClass;
-
-void main() {
- // constructors and destructors
- auto color1 = new oi1c.Color();
- auto color = new oi1c.Color(color1);
-
- // class methods
- color.colorInstanceMethod(20.0);
- oi1c.Color.colorStaticMethod(20.0);
- auto created = oi1c.Color.create();
-
- // class enums
- auto someClass = new nspace.Outer.SomeClass.SomeClass();
- auto channel = someClass.GetInner1ColorChannel();
- if (channel != oi1c.Color.Channel.Transmission) {
- throw new Exception("Transmission wrong");
- }
-
- // class anonymous enums
- int val1 = oi1c.Color.ColorEnumVal1;
- int val2 = oi1c.Color.ColorEnumVal2;
- if (val1 != 0 || val2 != 0x22) {
- throw new Exception("ColorEnumVal wrong");
- }
-
- // instance member variables
- color.instanceMemberVariable = 123;
- if (color.instanceMemberVariable != 123) {
- throw new Exception("instance member variable failed");
- }
-
- // static member variables
- oi1c.Color.staticMemberVariable = 789;
- if (oi1c.Color.staticMemberVariable != 789) {
- throw new Exception("static member variable failed");
- }
- if (oi1c.Color.staticConstMemberVariable != 222) {
- throw new Exception("static const member variable failed");
- }
- if (oi1c.Color.staticConstEnumMemberVariable != oi1c.Color.Channel.Transmission) {
- throw new Exception("static const enum member variable failed");
- }
-
- // check globals in a namespace don't get mangled with the nspace option
- nspace.nspace.namespaceFunction(color);
- nspace.nspace.namespaceVar = 111;
- if (nspace.nspace.namespaceVar != 111) {
- throw new Exception("global var failed");
- }
-
- // Same class different namespaces
- auto col1 = new oi1c.Color();
- auto col2 = nspace.Outer.Inner2.Color.Color.create();
- col2.colors(col1, col1, col2, col2, col2);
-
- // global enums
- auto outerChannel1 = someClass.GetInner1Channel();
- if (outerChannel1 != nspace.Outer.Inner1.Channel.Channel.Transmission1) {
- throw new Exception("Transmission1 wrong");
- }
- auto outerChannel2 = someClass.GetInner2Channel();
- if (outerChannel2 != nspace.Outer.Inner2.Channel.Channel.Transmission2) {
- throw new Exception("Transmission2 wrong");
- }
-
- // turn feature off / ignoring
- auto ns = new nspace.Outer.namespce.namespce();
- auto nons = new nspace.NoNSpacePlease.NoNSpacePlease();
-
- // Derived class
- auto blue3 = new nspace.Outer.Inner3.Blue.Blue();
- blue3.blueInstanceMethod();
- auto blue4 = new nspace.Outer.Inner4.Blue.Blue();
- blue4.blueInstanceMethod();
-}
diff --git a/Examples/test-suite/d/operator_overload_runme.1.d b/Examples/test-suite/d/operator_overload_runme.1.d
deleted file mode 100644
index 18a24b91f..000000000
--- a/Examples/test-suite/d/operator_overload_runme.1.d
+++ /dev/null
@@ -1,89 +0,0 @@
-module operator_overload_runme;
-
-import operator_overload.Op;
-
-void main() {
- // Invoke the C++ sanity check first.
- Op.sanity_check();
-
- auto a = new Op();
- auto b = new Op(5);
- auto c = b;
- auto d = new Op(2);
- auto dd = d;
-
- // test equality
- assert(a != b);
- assert(b == c);
- assert(a != d);
- assert(d == dd);
-
- // test <
- assert(a < b);
- assert(a <= b);
- assert(b <= c);
- assert(b >= c);
- assert(b > d);
- assert(b >= d);
-
- // test +=
- auto e = new Op(3);
- e += d;
- assert(e == b);
- e -= c;
- assert(e == a);
- e = new Op(1);
- e *= b;
- assert(e == c);
- e /= d;
- assert(e == d);
- e %= c;
- assert(e == d);
-
- // test +
- auto f = new Op(1);
- auto g = new Op(1);
- assert(f + g == new Op(2));
- assert(f - g == new Op(0));
- assert(f * g == new Op(1));
- assert(f / g == new Op(1));
- assert(f % g == new Op(0));
-
- // test unary operators
- assert(-a == a);
- assert(-b == new Op(-5));
- // The unary ! operator is not overloadable in D1.
-
- // test []
- auto h = new Op(3);
- assert(h[0]==3);
- assert(h[1]==0);
- // Generation of opIndexAssign is not supported yet.
-
- // test ()
- auto i = new Op(3);
- assert(i()==3);
- assert(i(1)==4);
- assert(i(1,2)==6);
-
- // test ++ and --
- auto j = new Op(100);
- int original = j.i;
- {
- Op newOp = j++;
- int newInt = original++;
- assert(j.i == original);
- assert(newOp.i == newInt);
- }
- {
- Op newOp = j--;
- int newInt = original--;
- assert(j.i == original);
- assert(newOp.i == newInt);
- }
- // Prefix increment/decrement operators are lowered to (foo +=/-= 1) in D1,
- // but the test case does not define an integer overload for operator +=
- // respectively -=.
-
- // Implicit casting is not overloadable in D1.
-} \ No newline at end of file
diff --git a/Examples/test-suite/d/overload_complicated_runme.1.d b/Examples/test-suite/d/overload_complicated_runme.1.d
deleted file mode 100644
index 03d1bf1e6..000000000
--- a/Examples/test-suite/d/overload_complicated_runme.1.d
+++ /dev/null
@@ -1,50 +0,0 @@
-module overload_complicated_runme;
-
-import overload_complicated;
-
-void main() {
- SWIGTYPE_p_int pInt = null;
-
- // Check the correct constructors are available
- Pop p = new Pop(pInt);
-
- p = new Pop(pInt, false);
-
- // Check overloaded in const only and pointers/references which target languages cannot disambiguate
- if (p.hip(false) != 701)
- throw new Exception("Test 1 failed");
-
- if (p.hip(pInt) != 702)
- throw new Exception("Test 2 failed");
-
- // Reverse the order for the above
- if (p.hop(pInt) != 805)
- throw new Exception("Test 3 failed");
-
- if (p.hop(false) != 801)
- throw new Exception("Test 4 failed");
-
- // Few more variations and order shuffled
- if (p.pop(false) != 901)
- throw new Exception("Test 5 failed");
-
- if (p.pop(pInt) != 902)
- throw new Exception("Test 6 failed");
-
- if (p.pop() != 905)
- throw new Exception("Test 7 failed");
-
- // Overload on const only
- if (p.bop(pInt) != 1001)
- throw new Exception("Test 8 failed");
-
- if (p.bip(pInt) != 2001)
- throw new Exception("Test 9 failed");
-
- // Globals
- if (muzak(false) != 3001)
- throw new Exception("Test 10 failed");
-
- if (muzak(pInt) != 3002)
- throw new Exception("Test 11 failed");
-}
diff --git a/Examples/test-suite/d/overload_template_runme.1.d b/Examples/test-suite/d/overload_template_runme.1.d
deleted file mode 100644
index a1fe8012f..000000000
--- a/Examples/test-suite/d/overload_template_runme.1.d
+++ /dev/null
@@ -1,146 +0,0 @@
-module overload_template_runme;
-
-import overload_template.overload_template;
-import overload_template.Klass;
-
-void main() {
- int f = foo();
-
- f += maximum(3,4);
- double b = maximum(3.4,5.2);
- b++; // warning suppression
-
- // mix 1
- if (mix1("hi") != 101)
- throw new Exception ("mix1(const char*)");
-
- if (mix1(1.0, 1.0) != 102)
- throw new Exception ("mix1(double, const double &)");
-
- if (mix1(1.0) != 103)
- throw new Exception ("mix1(double)");
-
- // mix 2
- if (mix2("hi") != 101)
- throw new Exception ("mix2(const char*)");
-
- if (mix2(1.0, 1.0) != 102)
- throw new Exception ("mix2(double, const double &)");
-
- if (mix2(1.0) != 103)
- throw new Exception ("mix2(double)");
-
- // mix 3
- if (mix3("hi") != 101)
- throw new Exception ("mix3(const char*)");
-
- if (mix3(1.0, 1.0) != 102)
- throw new Exception ("mix3(double, const double &)");
-
- if (mix3(1.0) != 103)
- throw new Exception ("mix3(double)");
-
- // Combination 1
- if (overtparams1(100) != 10)
- throw new Exception ("overtparams1(int)");
-
- if (overtparams1(100.0, 100) != 20)
- throw new Exception ("overtparams1(double, int)");
-
- // Combination 2
- if (overtparams2(100.0, 100) != 40)
- throw new Exception ("overtparams2(double, int)");
-
- // Combination 3
- if (overloaded() != 60)
- throw new Exception ("overloaded()");
-
- if (overloaded(100.0, 100) != 70)
- throw new Exception ("overloaded(double, int)");
-
- // Combination 4
- if (overloadedagain("hello") != 80)
- throw new Exception ("overloadedagain(const char *)");
-
- if (overloadedagain() != 90)
- throw new Exception ("overloadedagain(double)");
-
- // specializations
- if (specialization(10) != 202)
- throw new Exception ("specialization(int)");
-
- if (specialization(10.0) != 203)
- throw new Exception ("specialization(double)");
-
- if (specialization(10, 10) != 204)
- throw new Exception ("specialization(int, int)");
-
- if (specialization(10.0, 10.0) != 205)
- throw new Exception ("specialization(double, double)");
-
- if (specialization("hi", "hi") != 201)
- throw new Exception ("specialization(const char *, const char *)");
-
- // simple specialization
- xyz();
- xyz_int();
- xyz_double();
-
- // a bit of everything
- if (overload("hi") != 0)
- throw new Exception ("overload()");
-
- if (overload(1) != 10)
- throw new Exception ("overload(int t)");
-
- if (overload(1, 1) != 20)
- throw new Exception ("overload(int t, const int &)");
-
- if (overload(1, "hello") != 30)
- throw new Exception ("overload(int t, const char *)");
-
- auto k = new Klass();
- if (overload(k) != 10)
- throw new Exception ("overload(Klass t)");
-
- if (overload(k, k) != 20)
- throw new Exception ("overload(Klass t, const Klass &)");
-
- if (overload(k, "hello") != 30)
- throw new Exception ("overload(Klass t, const char *)");
-
- if (overload(10.0, "hi") != 40)
- throw new Exception ("overload(double t, const char *)");
-
- if (overload() != 50)
- throw new Exception ("overload(const char *)");
-
-
- // everything put in a namespace
- if (nsoverload("hi") != 1000)
- throw new Exception ("nsoverload()");
-
- if (nsoverload(1) != 1010)
- throw new Exception ("nsoverload(int t)");
-
- if (nsoverload(1, 1) != 1020)
- throw new Exception ("nsoverload(int t, const int &)");
-
- if (nsoverload(1, "hello") != 1030)
- throw new Exception ("nsoverload(int t, const char *)");
-
- if (nsoverload(k) != 1010)
- throw new Exception ("nsoverload(Klass t)");
-
- if (nsoverload(k, k) != 1020)
- throw new Exception ("nsoverload(Klass t, const Klass &)");
-
- if (nsoverload(k, "hello") != 1030)
- throw new Exception ("nsoverload(Klass t, const char *)");
-
- if (nsoverload(10.0, "hi") != 1040)
- throw new Exception ("nsoverload(double t, const char *)");
-
- if (nsoverload() != 1050)
- throw new Exception ("nsoverload(const char *)");
-}
diff --git a/Examples/test-suite/d/pointer_reference_runme.1.d b/Examples/test-suite/d/pointer_reference_runme.1.d
deleted file mode 100644
index c593b939c..000000000
--- a/Examples/test-suite/d/pointer_reference_runme.1.d
+++ /dev/null
@@ -1,13 +0,0 @@
-module pointer_reference_runme;
-
-import pointer_reference.pointer_reference;
-import pointer_reference.Struct;
-
-void main() {
- Struct s = get();
- if (s.value != 10) throw new Exception("get test failed");
-
- Struct ss = new Struct(20);
- set(ss);
- if (Struct.instance.value != 20) throw new Exception("set test failed");
-}
diff --git a/Examples/test-suite/d/preproc_constants_c_runme.1.d b/Examples/test-suite/d/preproc_constants_c_runme.1.d
deleted file mode 100644
index f98f37b5f..000000000
--- a/Examples/test-suite/d/preproc_constants_c_runme.1.d
+++ /dev/null
@@ -1,69 +0,0 @@
-module preproc_constants_c_runme;
-
-import tango.stdc.config;
-import preproc_constants_c.preproc_constants_c;
-
-// Same as preproc_constants.i testcase, but bool types are int instead.
-void main() {
- static assert(is(int == typeof(CONST_INT1())));
- static assert(is(int == typeof(CONST_INT2())));
- static assert(is(uint == typeof(CONST_UINT1())));
- static assert(is(uint == typeof(CONST_UINT2())));
- static assert(is(uint == typeof(CONST_UINT3())));
- static assert(is(uint == typeof(CONST_UINT4())));
- static assert(is(c_long == typeof(CONST_LONG1())));
- static assert(is(c_long == typeof(CONST_LONG2())));
- static assert(is(c_long == typeof(CONST_LONG3())));
- static assert(is(c_long == typeof(CONST_LONG4())));
- static assert(is(long == typeof(CONST_LLONG1())));
- static assert(is(long == typeof(CONST_LLONG2())));
- static assert(is(long == typeof(CONST_LLONG3())));
- static assert(is(long == typeof(CONST_LLONG4())));
- static assert(is(ulong == typeof(CONST_ULLONG1())));
- static assert(is(ulong == typeof(CONST_ULLONG2())));
- static assert(is(ulong == typeof(CONST_ULLONG3())));
- static assert(is(ulong == typeof(CONST_ULLONG4())));
- static assert(is(double == typeof(CONST_DOUBLE1())));
- static assert(is(double == typeof(CONST_DOUBLE2())));
- static assert(is(double == typeof(CONST_DOUBLE3())));
- static assert(is(double == typeof(CONST_DOUBLE4())));
- static assert(is(double == typeof(CONST_DOUBLE5())));
- static assert(is(double == typeof(CONST_DOUBLE6())));
- static assert(is(int == typeof(CONST_BOOL1())));
- static assert(is(int == typeof(CONST_BOOL2())));
- static assert(is(char == typeof(CONST_CHAR())));
- static assert(is(char[] == typeof(CONST_STRING1())));
- static assert(is(char[] == typeof(CONST_STRING2())));
-
- static assert(is(int == typeof(INT_AND_BOOL())));
- static assert(is(int == typeof(INT_AND_CHAR())));
- static assert(is(int == typeof(INT_AND_INT())));
- static assert(is(uint == typeof(INT_AND_UINT())));
- static assert(is(c_long == typeof(INT_AND_LONG())));
- static assert(is(c_ulong == typeof(INT_AND_ULONG())));
- static assert(is(long == typeof(INT_AND_LLONG())));
- static assert(is(ulong == typeof(INT_AND_ULLONG())));
- static assert(is(int == typeof(BOOL_AND_BOOL())));
-
- static assert(is(int == typeof(EXPR_MULTIPLY())));
- static assert(is(int == typeof(EXPR_DIVIDE())));
- static assert(is(int == typeof(EXPR_PLUS())));
- static assert(is(int == typeof(EXPR_MINUS())));
- static assert(is(int == typeof(EXPR_LSHIFT())));
- static assert(is(int == typeof(EXPR_RSHIFT())));
- static assert(is(int == typeof(EXPR_LT())));
- static assert(is(int == typeof(EXPR_GT())));
- static assert(is(int == typeof(EXPR_LTE())));
- static assert(is(int == typeof(EXPR_GTE())));
- static assert(is(int == typeof(EXPR_INEQUALITY())));
- static assert(is(int == typeof(EXPR_EQUALITY())));
- static assert(is(int == typeof(EXPR_AND())));
- static assert(is(int == typeof(EXPR_XOR())));
- static assert(is(int == typeof(EXPR_OR())));
- static assert(is(int == typeof(EXPR_LAND())));
- static assert(is(int == typeof(EXPR_LOR())));
- static assert(is(double == typeof(EXPR_CONDITIONAL())));
- static assert(is(double == typeof(EXPR_MIXED1())));
- static assert(is(int == typeof(EXPR_WCHAR_MAX())));
- static assert(is(int == typeof(EXPR_WCHAR_MIN())));
-}
diff --git a/Examples/test-suite/d/preproc_constants_runme.1.d b/Examples/test-suite/d/preproc_constants_runme.1.d
deleted file mode 100644
index 95f3c4757..000000000
--- a/Examples/test-suite/d/preproc_constants_runme.1.d
+++ /dev/null
@@ -1,68 +0,0 @@
-module preproc_constants_runme;
-
-import tango.stdc.config;
-import preproc_constants.preproc_constants;
-
-void main() {
- static assert(is(int == typeof(CONST_INT1())));
- static assert(is(int == typeof(CONST_INT2())));
- static assert(is(uint == typeof(CONST_UINT1())));
- static assert(is(uint == typeof(CONST_UINT2())));
- static assert(is(uint == typeof(CONST_UINT3())));
- static assert(is(uint == typeof(CONST_UINT4())));
- static assert(is(c_long == typeof(CONST_LONG1())));
- static assert(is(c_long == typeof(CONST_LONG2())));
- static assert(is(c_long == typeof(CONST_LONG3())));
- static assert(is(c_long == typeof(CONST_LONG4())));
- static assert(is(long == typeof(CONST_LLONG1())));
- static assert(is(long == typeof(CONST_LLONG2())));
- static assert(is(long == typeof(CONST_LLONG3())));
- static assert(is(long == typeof(CONST_LLONG4())));
- static assert(is(ulong == typeof(CONST_ULLONG1())));
- static assert(is(ulong == typeof(CONST_ULLONG2())));
- static assert(is(ulong == typeof(CONST_ULLONG3())));
- static assert(is(ulong == typeof(CONST_ULLONG4())));
- static assert(is(double == typeof(CONST_DOUBLE1())));
- static assert(is(double == typeof(CONST_DOUBLE2())));
- static assert(is(double == typeof(CONST_DOUBLE3())));
- static assert(is(double == typeof(CONST_DOUBLE4())));
- static assert(is(double == typeof(CONST_DOUBLE5())));
- static assert(is(double == typeof(CONST_DOUBLE6())));
- static assert(is(bool == typeof(CONST_BOOL1())));
- static assert(is(bool == typeof(CONST_BOOL2())));
- static assert(is(char == typeof(CONST_CHAR())));
- static assert(is(char[] == typeof(CONST_STRING1())));
- static assert(is(char[] == typeof(CONST_STRING2())));
-
- static assert(is(int == typeof(INT_AND_BOOL())));
- static assert(is(int == typeof(INT_AND_CHAR())));
- static assert(is(int == typeof(INT_AND_INT())));
- static assert(is(uint == typeof(INT_AND_UINT())));
- static assert(is(c_long == typeof(INT_AND_LONG())));
- static assert(is(c_ulong == typeof(INT_AND_ULONG())));
- static assert(is(long == typeof(INT_AND_LLONG())));
- static assert(is(ulong == typeof(INT_AND_ULLONG())));
- static assert(is(int == typeof(BOOL_AND_BOOL())));
-
- static assert(is(int == typeof(EXPR_MULTIPLY())));
- static assert(is(int == typeof(EXPR_DIVIDE())));
- static assert(is(int == typeof(EXPR_PLUS())));
- static assert(is(int == typeof(EXPR_MINUS())));
- static assert(is(int == typeof(EXPR_LSHIFT())));
- static assert(is(int == typeof(EXPR_RSHIFT())));
- static assert(is(int == typeof(EXPR_LT())));
- static assert(is(int == typeof(EXPR_GT())));
- static assert(is(bool == typeof(EXPR_LTE())));
- static assert(is(bool == typeof(EXPR_GTE())));
- static assert(is(bool == typeof(EXPR_INEQUALITY())));
- static assert(is(bool == typeof(EXPR_EQUALITY())));
- static assert(is(int == typeof(EXPR_AND())));
- static assert(is(int == typeof(EXPR_XOR())));
- static assert(is(int == typeof(EXPR_OR())));
- static assert(is(bool == typeof(EXPR_LAND())));
- static assert(is(bool == typeof(EXPR_LOR())));
- static assert(is(double == typeof(EXPR_CONDITIONAL())));
- static assert(is(double == typeof(EXPR_MIXED1())));
- static assert(is(int == typeof(EXPR_WCHAR_MAX())));
- static assert(is(int == typeof(EXPR_WCHAR_MIN())));
-}
diff --git a/Examples/test-suite/d/sizet_runme.1.d b/Examples/test-suite/d/sizet_runme.1.d
deleted file mode 100644
index ae42e20e5..000000000
--- a/Examples/test-suite/d/sizet_runme.1.d
+++ /dev/null
@@ -1,15 +0,0 @@
-module sizet_runme;
-
-import sizet.sizet;
-
-void main() {
- size_t s = 2000;
- s = test1(s+1);
- s = test2(s+1);
- s = test3(s+1);
- s = test4(s+1);
-
- if (s != 2004) {
- throw new Exception("failed");
- }
-}
diff --git a/Examples/test-suite/d/sneaky1_runme.1.d b/Examples/test-suite/d/sneaky1_runme.1.d
deleted file mode 100644
index b293b4972..000000000
--- a/Examples/test-suite/d/sneaky1_runme.1.d
+++ /dev/null
@@ -1,21 +0,0 @@
-module sneaky1_runme;
-
-import sneaky1.sneaky1;
-
-void main() {
- if (add(30, 2) != 32) {
- throw new Exception("add test failed");
- }
-
- if (subtract(20, 2) != 18) {
- throw new Exception("subtract test failed");
- }
-
- if (mul(20, 2) != 40) {
- throw new Exception("mul test failed");
- }
-
- if (divide(20, 2) != 10) {
- throw new Exception("div test failed");
- }
-}
diff --git a/Examples/test-suite/d/special_variable_macros_runme.1.d b/Examples/test-suite/d/special_variable_macros_runme.1.d
deleted file mode 100644
index eab0331cc..000000000
--- a/Examples/test-suite/d/special_variable_macros_runme.1.d
+++ /dev/null
@@ -1,43 +0,0 @@
-module special_variable_macros_runme;
-
-import special_variable_macros.special_variable_macros;
-import special_variable_macros.Name;
-import special_variable_macros.NewName;
-import special_variable_macros.PairIntBool;
-
-void main() {
- auto name = new Name();
-
- if (testFred(name) != "none") {
- throw new Exception("test failed");
- }
-
- if (testJack(name) != "$specialname") {
- throw new Exception("test failed");
- }
-
- if (testJill(name) != "jilly") {
- throw new Exception("test failed");
- }
-
- if (testMary(name) != "SWIGTYPE_p_NameWrap") {
- throw new Exception("test failed");
- }
-
- if (testJames(name) != "SWIGTYPE_Name") {
- throw new Exception("test failed");
- }
-
- if (testJim(name) != "multiname num") {
- throw new Exception("test failed");
- }
-
- if (testJohn(new PairIntBool(10, false)) != 123) {
- throw new Exception("test failed");
- }
-
- auto newName = NewName.factory("factoryname");
- if (newName.getStoredName().getName() != "factoryname") {
- throw new Exception("test failed");
- }
-}
diff --git a/Examples/test-suite/d/threads_runme.1.d b/Examples/test-suite/d/threads_runme.1.d
deleted file mode 100644
index 206875824..000000000
--- a/Examples/test-suite/d/threads_runme.1.d
+++ /dev/null
@@ -1,70 +0,0 @@
-module threads_runme;
-
-import tango.core.Thread;
-import tango.io.Console;
-import Integer = tango.text.convert.Integer;
-import threads.Kerfuffle;
-
-// Spawn 8 threads.
-const uint NUM_THREADS = 8;
-
-// Run test for a few seconds on a 1GHz machine.
-const uint WORKER_LOOP_PASSES = 30000;
-
-void main() {
- auto kerf = new Kerfuffle();
- TestThread[] threads;
-
- // Invoke the threads.
- for (uint i = 0; i < NUM_THREADS; i++) {
- auto thread = new TestThread(kerf);
- threads ~= thread;
- thread.name = Integer.toString(i);
- thread.start();
- }
-
- // Wait for the threads to finish.
- foreach(thread; threads) {
- thread.join();
- }
-
- // Check if any thread has failed.
- foreach(thread; threads) {
- if (thread.failed) throw new Exception("Test failed.");
- }
-}
-
-class TestThread : Thread {
-public:
- this(Kerfuffle kerf) {
- super(&run);
- m_kerf = kerf;
- }
-
- void run() {
- failed = false;
- try {
- for (uint i = 0; i < WORKER_LOOP_PASSES; i++) {
- char[] given = "This is the test char[] that should come back. A number: " ~ Integer.toString(i);
- char[] received = m_kerf.StdString(given);
- if (received != given) {
- throw new Exception("StdString char[] does not match. Received: '" ~ received ~ "'. Expected: '" ~ given ~ "'.");
- }
- }
- for (uint i = 0; i < WORKER_LOOP_PASSES; i++) {
- char[] given = "This is the test char[] that should come back. A number: " ~ Integer.toString(i);
- char[] received = m_kerf.CharString(given);
- if (received != given) {
- throw new Exception("StdString char[] does not match. Received: '" ~ received ~ "'. Expected: '" ~ given ~ "'.");
- }
- }
- } catch (Exception e) {
- Cerr("Test failed (thread " ~ name() ~ "): " ~ e.msg).newline;
- failed = true;
- }
- }
-
- bool failed;
-private:
- Kerfuffle m_kerf;
-}
diff --git a/Examples/test-suite/d/throw_exception_runme.1.d b/Examples/test-suite/d/throw_exception_runme.1.d
deleted file mode 100644
index f2397a202..000000000
--- a/Examples/test-suite/d/throw_exception_runme.1.d
+++ /dev/null
@@ -1,30 +0,0 @@
-module throw_exception_runme;
-
-import throw_exception.Foo;
-
-void main() {
- test!("test_int");
- test!("test_msg");
- test!("test_cls");
- test!("test_cls_ptr");
- test!("test_cls_ref");
- test!("test_cls_td");
- test!("test_cls_ptr_td");
- test!("test_cls_ref_td");
- test!("test_array");
- test!("test_enum");
-}
-
-void test(char[] methodName)() {
- auto foo = new Foo();
-
- bool didntThrow;
- try {
- mixin("foo." ~ methodName ~ "();");
- didntThrow = true;
- } catch (Exception) {}
-
- if (didntThrow) {
- throw new Exception(methodName ~ " failed");
- }
-}
diff --git a/Examples/test-suite/d/typemap_namespace_runme.1.d b/Examples/test-suite/d/typemap_namespace_runme.1.d
deleted file mode 100644
index 3a5ca1a9f..000000000
--- a/Examples/test-suite/d/typemap_namespace_runme.1.d
+++ /dev/null
@@ -1,13 +0,0 @@
-module typemap_namespace_runme;
-
-import typemap_namespace.typemap_namespace;
-
-void main() {
- if (test1("hello") != "hello") {
- throw new Exception("test1 failed");
- }
-
- if (test2("hello") != "hello") {
- throw new Exception("test2 failed");
- }
-}
diff --git a/Examples/test-suite/d/typemap_out_optimal_runme.1.d b/Examples/test-suite/d/typemap_out_optimal_runme.1.d
deleted file mode 100644
index 1267197e2..000000000
--- a/Examples/test-suite/d/typemap_out_optimal_runme.1.d
+++ /dev/null
@@ -1,10 +0,0 @@
-module typemap_out_optimal_runme;
-
-import typemap_out_optimal.XX;
-
-void main() {
- XX x;
- XX.trace = false;
- x = XX.create();
- x = XX.createConst();
-}
diff --git a/Examples/test-suite/d/varargs_runme.1.d b/Examples/test-suite/d/varargs_runme.1.d
deleted file mode 100644
index 53f76d075..000000000
--- a/Examples/test-suite/d/varargs_runme.1.d
+++ /dev/null
@@ -1,20 +0,0 @@
-module varargs_runme;
-
-import varargs.varargs;
-import varargs.Foo;
-
-void main() {
- if (test("Hello") != "Hello") {
- throw new Exception("Test 1 failed");
- }
-
- auto f = new Foo("Greetings");
-
- if (f.str != "Greetings") {
- throw new Exception("Test 2 failed");
- }
-
- if (f.test("Hello") != "Hello") {
- throw new Exception("Test 3 failed");
- }
-}
diff --git a/Examples/test-suite/d/virtual_poly_runme.1.d b/Examples/test-suite/d/virtual_poly_runme.1.d
deleted file mode 100644
index fb2e7814d..000000000
--- a/Examples/test-suite/d/virtual_poly_runme.1.d
+++ /dev/null
@@ -1,27 +0,0 @@
-module virtual_poly_runme;
-
-import virtual_poly.NDouble;
-import virtual_poly.NInt;
-import virtual_poly.NNumber;
-
-void main() {
- // D supports covariant (polymorphic) return types, so this should work like
- // in C++.
- auto d = new NDouble(3.5);
- NDouble dc = d.copy();
- if (d.get() != dc.get()) {
- throw new Exception("Test 1 failed.");
- }
-
- auto i = new NInt(2);
- NInt ic = i.copy();
- if (i.get() != ic.get()) {
- throw new Exception("Test 2 failed.");
- }
-
- NNumber n = d;
- auto nd = cast(NDouble) n.copy();
- if (nd.get() != d.get()) {
- throw new Exception("Test 3 failed.");
- }
-}
diff --git a/Examples/test-suite/special_variable_macros.i b/Examples/test-suite/special_variable_macros.i
index d1878e71b..ed6e048ac 100644
--- a/Examples/test-suite/special_variable_macros.i
+++ b/Examples/test-suite/special_variable_macros.i
@@ -209,20 +209,12 @@ namespace Space {
}
%}
#elif defined(SWIGD)
-#if (SWIG_D_VERSION == 1)
-%typemap(dcode) Space::RenameMe %{
- public static NewName factory(char[] s) {
- return new $typemap(dtype, Space::RenameMe)( new $typemap(dtype, Name)(s) );
- }
-%}
-#else
%typemap(dcode) Space::RenameMe %{
public static NewName factory(string s) {
return new $typemap(dtype, Space::RenameMe)( new $typemap(dtype, Name)(s) );
}
%}
#endif
-#endif
%rename(NewName) Space::RenameMe;
%inline %{