csharp test-suite infrastructure

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4434 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2003-03-04 23:00:21 +00:00
commit 85a9996858
4 changed files with 333 additions and 0 deletions

View file

@ -0,0 +1,208 @@
abstract_inherit
abstract_inherit_ok
abstract_signature
abstract_typedef2
abstract_virtual
add_link
anonymous_arg
argout
arrayptr
arrayref
arrays
arrays_global
arrays_global_twodim
arrays_scope
bools
bool_default
casts
cast_operator
char_constant
class_ignore
constant_pointers
constover
constructor_exception
constructor_explicit
constructor_value
const_const
const_const_2
conversion
conversion_namespace
conversion_ns_template
cplusplus_throw
cpp_enum
cpp_enum_scope
cpp_macro_noarg
cpp_namespace
cpp_nodefault
cpp_static
cpp_typedef
CVS
default_cast
default_constructor
default_ns
default_ref
defineop
defines
dynamic_cast
enum
enum_plus
enum_scope
enum_scope_template
enum_var
evil_diamond
evil_diamond_ns
evil_diamond_prop
explicit
extend_template
extend_template_ns
global_ns_arg
grouping
ignore_parameter
imports
import_nomodule
inherit_missing
java_constants
java_enums
java_jnitypes
java_lib_arrays
java_pragmas
java_throws
java_typemaps_proxy
java_typemaps_typewrapper
kind
lib_carrays
lib_cdata
lib_cmalloc
lib_constraints
lib_cpointer
lib_math
lib_std_deque
lib_std_string
lib_std_vector
lib_typemaps
long_long
macro_2
member_template
minherit
name
namespace_enum
namespace_extend
namespace_nested
namespace_template
namespace_typemap
name_cxx
name_inherit
nested
newobject1
newobject2
overload_complicated
overload_copy
overload_extend
overload_extendc
overload_simple
overload_subtype
overload_template
pointer_reference
preproc_1
preproc_2
preproc_3
preproc_4
preproc_5
primitive_ref
private_assign
pure_virtual
reference_global_vars
rename_default
rename_scope
return_value_scope
ret_by_value
rname
sizeof_pointer
smart_pointer_const
smart_pointer_multi
smart_pointer_multi_typedef
smart_pointer_not
smart_pointer_overload
smart_pointer_protected
smart_pointer_rename
smart_pointer_simple
smart_pointer_typedef
sneaky1
static_array_member
static_const_member
static_const_member_2
struct_value
template
template_arg_replace
template_arg_scope
template_arg_typename
template_base_template
template_classes
template_construct
template_const_ref
template_default
template_default2
template_default_arg
template_default_inherit
template_default_qualify
template_enum
template_enum_ns_inherit
template_enum_typedef
template_explicit
template_extend1
template_extend2
template_extend_overload
template_extend_overload_2
template_forward
template_inherit
template_inherit_abstract
template_int_const
template_ns
template_ns2
template_ns3
template_ns4
template_ns_enum
template_ns_enum2
template_ns_inherit
template_ns_scope
template_qualifier
template_rename
template_retvalue
template_specialization
template_static
template_tbase_template
template_typedef
template_typedef_cplx
template_typedef_cplx2
template_typedef_cplx3
template_typedef_cplx4
template_typedef_import
template_type_namespace
template_virtual
template_whitespace
throw_exception
typedef_array_member
typedef_funcptr
typedef_inherit
typedef_mptr
typedef_reference
typedef_scope
typemap_namespace
typemap_ns_using
typemap_subst
typename
unions
union_scope
using1
using2
using_composition
using_extend
using_inherit
using_private
using_protected
valuewrapper_base
varargs
virtual_destructor
voidtest
*.class

View file

@ -0,0 +1,64 @@
#######################################################################
# $Header$
# Makefile for csharp test-suite
#######################################################################
LANGUAGE = csharp
SCRIPTSUFFIX = _runme.cs
include ../common.mk
# Overridden variables here
TOP = ../../..
SWIGOPT = -I$(TOP)/$(TEST_SUITE) -package $*
#Target prefix cannot be used on Windows
#TARGETPREFIX = lib
# Rules for the different types of tests
%.cpptest:
$(setup) \
(cd $*; $(swig_and_compile_cpp); ); \
$(run_testcase)
%.ctest:
$(setup) \
(cd $*; $(swig_and_compile_c); ); \
$(run_testcase)
%.multicpptest:
$(setup) \
(cd $*; $(swig_and_compile_multi_cpp); ); \
$(run_testcase)
# Makes a directory for the testcase if it does not exist
setup = \
@if [ -f $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "Checking testcase $* (with run test) under $(LANGUAGE)" ; \
else \
echo "Checking testcase $* under $(LANGUAGE)" ; \
fi; \
if [ ! -d $* ]; then \
mkdir $*; \
fi;
# Compiles csharp files then runs the testcase. A testcase is only run if
# a file is found which has _runme.cs appended after the testcase name.
# Note CSharp uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows and SHLIB_PATH on HPUX.
run_testcase = \
if [ -f $*_runme.cs ]; then ( \
$(MAKE) -f $*/$(TOP)/Makefile CSHARPFLAGS='-o $*_runme' CSHARPSRCS='$*_runme.cs $*/*.cs' csharp_compile; \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" ilrun $*_runme; ) \
else ( \
cd $*; \
$(MAKE) -f $(TOP)/Makefile CSHARPFLAGS='-c' CSHARPSRCS='*.cs' csharp_compile; ); \
fi;
# Clean: remove testcase directories
%.clean:
@rm -f $*_runme
@if [ -d $* ]; then \
rm -rf $*; \
fi;
clean:

View file

@ -0,0 +1,42 @@
SWIG testsuite README file
--------------------------
This testsuite is here to ensure SWIG can handle a wide range of c/c++
syntax. The testsuite comprises many testcases in this directory. Each
test case is tested under each of the language modules thereby
thoroughly testing all of SWIG. It ensures that each of the language
modules are at a similar standard.
Those modules that support shadow classes run the tests producing
shadow classes to test the full language module functionality.
Some test cases need a runtime test. These need implementing in each
of the language modules. The language modules look for a file in the
language specific test-suite directory which has _runme appended after
the testcase name. If one is found it will be run as part of the test.
Some language modules add to this common set of test cases for
language specific tests. These can be found in the appropriate
language test-suite directory. There is also a README in each of the
language module directories.
For each testcase a message showing which testcase is being tested is
displayed. Nothing else is printed unless the test fails.
Some Developer Guidelines
-------------------------
Note that the whole test suite need not be run each time a testcase is
modified. An individual testcase may be run by going to the language
module test-suite directory and using make testcasename.xxx where xxx
is the type of test (eg cpptest). See common.mk. make -s doesn't print
any junk on the screen and is useful for emulating the way make check
works from the SWIG root directory.
If there are runtime tests needed, don't print anything unless there
is an error in which case stderr is suggested.
Please set the name of the module to the same name as the testcase,
otherwise modules will not be found.

View file

@ -0,0 +1,19 @@
using System;
public class runme
{
static void Main()
{
if (sneaky1.add(30, 2) != 32)
throw new Exception("add test failed");
if (sneaky1.sub(20, 2) != 18)
throw new Exception("sub test failed");
if (sneaky1.mul(20, 2) != 40)
throw new Exception("mul test failed");
if (sneaky1.divide(20, 2) != 10)
throw new Exception("div test failed");
}
}