Merge remote-tracking branch 'origin/master' into gsoc2012-scilab
Conflicts: Examples/Makefile.in
This commit is contained in:
commit
21e17eaa73
795 changed files with 16905 additions and 11792 deletions
|
|
@ -72,7 +72,7 @@ run_testcase = \
|
|||
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
|
||||
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \
|
||||
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(INTERPRETER) $(INTERPRETER_FLAGS) $*_runme.exe; \
|
||||
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(INTERPRETER) $(INTERPRETER_FLAGS) ./$*_runme.exe; \
|
||||
else \
|
||||
cd $* && \
|
||||
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
|
||||
|
|
|
|||
|
|
@ -5,6 +5,22 @@ using csharp_prepostNamespace;
|
|||
|
||||
public class csharp_prepost_runme {
|
||||
|
||||
class PrePost3_Derived : PrePost3
|
||||
{
|
||||
public PrePost3_Derived(){}
|
||||
public override void method(ref double[] vpre, DoubleVector vpost)
|
||||
{
|
||||
Assert(vpre[0], 1.0);
|
||||
vpre[0] = 2.0;
|
||||
Assert(vpost.Count, 2);
|
||||
vpost.Add(1.0);
|
||||
}
|
||||
public override int methodint(ref double[] vpre, DoubleVector vpost)
|
||||
{
|
||||
method(ref vpre, vpost);
|
||||
return vpost.Count;
|
||||
}
|
||||
}
|
||||
public static void Main() {
|
||||
{
|
||||
double[] v;
|
||||
|
|
@ -37,6 +53,28 @@ public class csharp_prepost_runme {
|
|||
Assert(v[1], 8.8);
|
||||
}
|
||||
|
||||
{
|
||||
PrePost3_Derived p = new PrePost3_Derived();
|
||||
double[] vpre = new double[] { 1.0 };
|
||||
DoubleVector vpost = new DoubleVector();
|
||||
vpost.Add(3.0);
|
||||
vpost.Add(4.0);
|
||||
p.method(ref vpre, vpost);
|
||||
Assert(vpre[0], 2.0);
|
||||
Assert(vpost.Count, 3);
|
||||
}
|
||||
{
|
||||
PrePost3_Derived p = new PrePost3_Derived();
|
||||
double[] vpre = new double[] { 1.0 };
|
||||
DoubleVector vpost = new DoubleVector();
|
||||
vpost.Add(3.0);
|
||||
vpost.Add(4.0);
|
||||
int size = p.methodint(ref vpre, vpost);
|
||||
Assert(vpre[0], 2.0);
|
||||
Assert(vpost.Count, 3);
|
||||
Assert(size, 3);
|
||||
}
|
||||
|
||||
// Check attributes are generated for the constructor helper function
|
||||
{
|
||||
CsinAttributes c = new CsinAttributes(5);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public class bools_runme {
|
|||
}
|
||||
}
|
||||
|
||||
class director_nspace_MyBarFoo : director_nspaceNamespace.Bar.Foo {
|
||||
class director_nspace_MyBarFoo : director_nspaceNamespace.TopLevel.Bar.Foo {
|
||||
|
||||
public override String ping() {
|
||||
return "director_nspace_MyBarFoo.ping();";
|
||||
|
|
@ -18,15 +18,15 @@ class director_nspace_MyBarFoo : director_nspaceNamespace.Bar.Foo {
|
|||
return "director_nspace_MyBarFoo.pong();" + ping();
|
||||
}
|
||||
|
||||
public override String fooBar(director_nspaceNamespace.Bar.FooBar fooBar) {
|
||||
public override String fooBar(director_nspaceNamespace.TopLevel.Bar.FooBar fooBar) {
|
||||
return fooBar.FooBarDo();
|
||||
}
|
||||
|
||||
public override director_nspaceNamespace.Bar.Foo makeFoo() {
|
||||
return new director_nspaceNamespace.Bar.Foo();
|
||||
public override director_nspaceNamespace.TopLevel.Bar.Foo makeFoo() {
|
||||
return new director_nspaceNamespace.TopLevel.Bar.Foo();
|
||||
}
|
||||
|
||||
public override director_nspaceNamespace.Bar.FooBar makeFooBar() {
|
||||
return new director_nspaceNamespace.Bar.FooBar();
|
||||
public override director_nspaceNamespace.TopLevel.Bar.FooBar makeFooBar() {
|
||||
return new director_nspaceNamespace.TopLevel.Bar.FooBar();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
41
Examples/test-suite/csharp/director_smartptr_runme.cs
Normal file
41
Examples/test-suite/csharp/director_smartptr_runme.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using director_smartptrNamespace;
|
||||
|
||||
public class runme
|
||||
{
|
||||
|
||||
private class director_smartptr_MyBarFoo : Foo
|
||||
{
|
||||
public override string ping()
|
||||
{
|
||||
return "director_smartptr_MyBarFoo.ping();";
|
||||
}
|
||||
|
||||
public override string pong()
|
||||
{
|
||||
return "director_smartptr_MyBarFoo.pong();" + ping();
|
||||
}
|
||||
|
||||
public override string fooBar(FooBar fooBar)
|
||||
{
|
||||
return fooBar.FooBarDo();
|
||||
}
|
||||
|
||||
public override Foo makeFoo()
|
||||
{
|
||||
return new Foo();
|
||||
}
|
||||
|
||||
public override FooBar makeFooBar()
|
||||
{
|
||||
return new FooBar();
|
||||
}
|
||||
}
|
||||
|
||||
static void Main()
|
||||
{
|
||||
director_smartptr_MyBarFoo myBarFoo =
|
||||
new director_smartptr_MyBarFoo();
|
||||
|
||||
myBarFoo.ping();
|
||||
}
|
||||
}
|
||||
16
Examples/test-suite/csharp/enum_forward_runme.cs
Normal file
16
Examples/test-suite/csharp/enum_forward_runme.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using enum_forwardNamespace;
|
||||
|
||||
public class runme {
|
||||
static void Main() {
|
||||
ForwardEnum1 f1 = enum_forward.get_enum1();
|
||||
f1 = enum_forward.test_function1(f1);
|
||||
|
||||
ForwardEnum2 f2 = enum_forward.get_enum2();
|
||||
f2 = enum_forward.test_function2(f2);
|
||||
|
||||
ForwardEnum3 f3 = enum_forward.get_enum3();
|
||||
f3 = enum_forward.test_function3(f3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,246 +1,246 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* li_std_map_runme.cs
|
||||
*
|
||||
* SWIG C# tester for std_map.i
|
||||
* This class tests all the functionality of the std_map.i wrapper.
|
||||
* Upon successful testing, the main function doesn't print out anything.
|
||||
* If any error is found - it will be printed on the screen.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using li_std_mapNamespace;
|
||||
|
||||
public class li_std_map_runme {
|
||||
|
||||
private static readonly int collectionSize = 20;
|
||||
private static readonly int midCollection = collectionSize / 2;
|
||||
|
||||
public static void Main()
|
||||
{
|
||||
// Set up an int int map
|
||||
StringIntMap simap = new StringIntMap();
|
||||
for (int i = 0; i < collectionSize; i++)
|
||||
{
|
||||
int val = i * 18;
|
||||
simap.Add(i.ToString(), val);
|
||||
}
|
||||
|
||||
// Count property test
|
||||
if (simap.Count != collectionSize)
|
||||
throw new Exception("Count test failed");
|
||||
|
||||
// IsReadOnly property test
|
||||
if (simap.IsReadOnly)
|
||||
throw new Exception("IsReadOnly test failed");
|
||||
|
||||
// Item indexing test
|
||||
simap["0"] = 200;
|
||||
if (simap["0"] != 200)
|
||||
throw new Exception("Item property test failed");
|
||||
simap["0"] = 0 * 18;
|
||||
|
||||
// ContainsKey() test
|
||||
for (int i = 0; i < collectionSize; i++)
|
||||
{
|
||||
if (!simap.ContainsKey(i.ToString()))
|
||||
throw new Exception("ContainsKey test " + i + " failed");
|
||||
}
|
||||
|
||||
// ContainsKey() test
|
||||
for (int i = 0; i < collectionSize; i++)
|
||||
{
|
||||
if (!simap.Contains(new KeyValuePair<string, int>(i.ToString(), i * 18)))
|
||||
throw new Exception("Contains test " + i + " failed");
|
||||
}
|
||||
|
||||
// TryGetValue() test
|
||||
int value;
|
||||
bool rc = simap.TryGetValue("3", out value);
|
||||
if (rc != true || value != (3 * 18))
|
||||
throw new Exception("TryGetValue test 1 failed");
|
||||
|
||||
rc = simap.TryGetValue("-1", out value);
|
||||
if (rc != false)
|
||||
throw new Exception("TryGetValue test 2 failed");
|
||||
|
||||
// Keys and Values test
|
||||
{
|
||||
IList<string> keys = new List<string>(simap.Keys);
|
||||
IList<int> values = new List<int>(simap.Values);
|
||||
Dictionary<string, int> check = new Dictionary<string, int>();
|
||||
if (keys.Count != collectionSize)
|
||||
throw new Exception("Keys count test failed");
|
||||
|
||||
if (values.Count != collectionSize)
|
||||
throw new Exception("Values count test failed");
|
||||
|
||||
for (int i = 0; i < keys.Count; i++)
|
||||
{
|
||||
if (simap[keys[i]] != values[i])
|
||||
throw new Exception("Keys and values test failed for index " + i);
|
||||
check.Add(keys[i], values[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < collectionSize; i++)
|
||||
{
|
||||
if (!check.ContainsKey(i.ToString()))
|
||||
throw new Exception("Keys and Values ContainsKey test " + i + " failed");
|
||||
}
|
||||
}
|
||||
|
||||
// Add and Remove test
|
||||
for (int i = 100; i < 103; i++)
|
||||
{
|
||||
simap.Add(i.ToString(), i * 18);
|
||||
if (!simap.ContainsKey(i.ToString()) || simap[i.ToString()] != (i * 18))
|
||||
throw new Exception("Add test failed for index " + i);
|
||||
|
||||
simap.Remove(i.ToString());
|
||||
if (simap.ContainsKey(i.ToString()))
|
||||
throw new Exception("Remove test failed for index " + i);
|
||||
}
|
||||
|
||||
for (int i = 200; i < 203; i++)
|
||||
{
|
||||
simap.Add(new KeyValuePair<string, int>(i.ToString(), i * 18));
|
||||
if (!simap.ContainsKey(i.ToString()) || simap[i.ToString()] != (i * 18))
|
||||
throw new Exception("Add explicit test failed for index " + i);
|
||||
|
||||
simap.Remove(new KeyValuePair<string, int>(i.ToString(), i * 18));
|
||||
if (simap.ContainsKey(i.ToString()))
|
||||
throw new Exception("Remove explicit test failed for index " + i);
|
||||
}
|
||||
|
||||
// Duplicate key test
|
||||
try
|
||||
{
|
||||
simap.Add("3", 0);
|
||||
throw new Exception("Adding duplicate key test failed");
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
}
|
||||
|
||||
// CopyTo() test
|
||||
{
|
||||
KeyValuePair<string, int>[] outputarray = new KeyValuePair<string, int>[collectionSize];
|
||||
simap.CopyTo(outputarray);
|
||||
foreach (KeyValuePair<string, int> val in outputarray)
|
||||
{
|
||||
if (simap[val.Key] != val.Value)
|
||||
throw new Exception("CopyTo (1) test failed, index:" + val.Key);
|
||||
}
|
||||
}
|
||||
{
|
||||
KeyValuePair<string, int>[] outputarray = new KeyValuePair<string, int>[midCollection + collectionSize];
|
||||
simap.CopyTo(outputarray, midCollection);
|
||||
for (int i = midCollection; i < midCollection + collectionSize; i++)
|
||||
{
|
||||
KeyValuePair<string, int> val = outputarray[i];
|
||||
if (simap[val.Key] != val.Value)
|
||||
throw new Exception("CopyTo (2) test failed, index:" + val.Key);
|
||||
}
|
||||
}
|
||||
{
|
||||
KeyValuePair<string, int>[] outputarray = new KeyValuePair<string, int>[collectionSize - 1];
|
||||
try
|
||||
{
|
||||
simap.CopyTo(outputarray);
|
||||
throw new Exception("CopyTo (4) test failed");
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Clear test
|
||||
simap.Clear();
|
||||
if (simap.Count != 0)
|
||||
throw new Exception("Clear test failed");
|
||||
|
||||
// Test wrapped methods
|
||||
for (int i = 1; i <= 5; i++)
|
||||
{
|
||||
simap[i.ToString()] = i;
|
||||
}
|
||||
double avg = li_std_map.valueAverage(simap);
|
||||
if (avg != 3.0)
|
||||
throw new Exception("Wrapped method valueAverage test failed. Got " + avg);
|
||||
|
||||
string keyStringified = li_std_map.stringifyKeys(simap);
|
||||
if (keyStringified != " 1 2 3 4 5")
|
||||
throw new Exception("Wrapped method stringifyKeys test failed. Got " + keyStringified);
|
||||
|
||||
// Test a map with a new complex type (Struct)
|
||||
{
|
||||
IntStructMap ismap = new IntStructMap();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
ismap.Add(i, new Struct(i * 10.1));
|
||||
}
|
||||
|
||||
if (ismap.Count != 10)
|
||||
throw new Exception("Count test on complex type map failed");
|
||||
|
||||
foreach (KeyValuePair<int, Struct> p in ismap)
|
||||
{
|
||||
if ((p.Key * 10.1) != p.Value.num)
|
||||
throw new Exception("Iteration test on complex type map failed for index " + p.Key);
|
||||
}
|
||||
}
|
||||
|
||||
// Test a map of pointers
|
||||
{
|
||||
IntStructPtrMap ispmap = new IntStructPtrMap();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
ispmap.Add(i, new Struct(i * 10.1));
|
||||
}
|
||||
|
||||
if (ispmap.Count != 10)
|
||||
throw new Exception("Count test on complex type pointer map failed");
|
||||
|
||||
foreach (KeyValuePair<int, Struct> p in ispmap)
|
||||
{
|
||||
if ((p.Key * 10.1) != p.Value.num)
|
||||
throw new Exception("Iteration test on complex type pointer map failed for index " + p.Key);
|
||||
}
|
||||
}
|
||||
{
|
||||
IntStructConstPtrMap iscpmap = new IntStructConstPtrMap();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
iscpmap.Add(i, new Struct(i * 10.1));
|
||||
}
|
||||
|
||||
if (iscpmap.Count != 10)
|
||||
throw new Exception("Count test on complex type const pointer map failed");
|
||||
|
||||
foreach (KeyValuePair<int, Struct> p in iscpmap)
|
||||
{
|
||||
if ((p.Key * 10.1) != p.Value.num)
|
||||
throw new Exception("Iteration test on complex type const pointer map failed for index " + p.Key);
|
||||
}
|
||||
}
|
||||
|
||||
// Test complex type as key (Struct)
|
||||
{
|
||||
StructIntMap limap = new StructIntMap();
|
||||
Struct s7 = new Struct(7);
|
||||
Struct s8 = new Struct(8);
|
||||
limap[s7] = 8;
|
||||
if (limap[s7] != 8)
|
||||
throw new Exception("Assignment test on complex key map failed");
|
||||
|
||||
if (!limap.ContainsKey(s7))
|
||||
throw new Exception("Key test (1) on complex key map failed");
|
||||
|
||||
if (limap.ContainsKey(s8))
|
||||
throw new Exception("Key test (2) on complex key map failed");
|
||||
}
|
||||
|
||||
// All done
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* li_std_map_runme.cs
|
||||
*
|
||||
* SWIG C# tester for std_map.i
|
||||
* This class tests all the functionality of the std_map.i wrapper.
|
||||
* Upon successful testing, the main function doesn't print out anything.
|
||||
* If any error is found - it will be printed on the screen.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using li_std_mapNamespace;
|
||||
|
||||
public class li_std_map_runme {
|
||||
|
||||
private static readonly int collectionSize = 20;
|
||||
private static readonly int midCollection = collectionSize / 2;
|
||||
|
||||
public static void Main()
|
||||
{
|
||||
// Set up an int int map
|
||||
StringIntMap simap = new StringIntMap();
|
||||
for (int i = 0; i < collectionSize; i++)
|
||||
{
|
||||
int val = i * 18;
|
||||
simap.Add(i.ToString(), val);
|
||||
}
|
||||
|
||||
// Count property test
|
||||
if (simap.Count != collectionSize)
|
||||
throw new Exception("Count test failed");
|
||||
|
||||
// IsReadOnly property test
|
||||
if (simap.IsReadOnly)
|
||||
throw new Exception("IsReadOnly test failed");
|
||||
|
||||
// Item indexing test
|
||||
simap["0"] = 200;
|
||||
if (simap["0"] != 200)
|
||||
throw new Exception("Item property test failed");
|
||||
simap["0"] = 0 * 18;
|
||||
|
||||
// ContainsKey() test
|
||||
for (int i = 0; i < collectionSize; i++)
|
||||
{
|
||||
if (!simap.ContainsKey(i.ToString()))
|
||||
throw new Exception("ContainsKey test " + i + " failed");
|
||||
}
|
||||
|
||||
// ContainsKey() test
|
||||
for (int i = 0; i < collectionSize; i++)
|
||||
{
|
||||
if (!simap.Contains(new KeyValuePair<string, int>(i.ToString(), i * 18)))
|
||||
throw new Exception("Contains test " + i + " failed");
|
||||
}
|
||||
|
||||
// TryGetValue() test
|
||||
int value;
|
||||
bool rc = simap.TryGetValue("3", out value);
|
||||
if (rc != true || value != (3 * 18))
|
||||
throw new Exception("TryGetValue test 1 failed");
|
||||
|
||||
rc = simap.TryGetValue("-1", out value);
|
||||
if (rc != false)
|
||||
throw new Exception("TryGetValue test 2 failed");
|
||||
|
||||
// Keys and Values test
|
||||
{
|
||||
IList<string> keys = new List<string>(simap.Keys);
|
||||
IList<int> values = new List<int>(simap.Values);
|
||||
Dictionary<string, int> check = new Dictionary<string, int>();
|
||||
if (keys.Count != collectionSize)
|
||||
throw new Exception("Keys count test failed");
|
||||
|
||||
if (values.Count != collectionSize)
|
||||
throw new Exception("Values count test failed");
|
||||
|
||||
for (int i = 0; i < keys.Count; i++)
|
||||
{
|
||||
if (simap[keys[i]] != values[i])
|
||||
throw new Exception("Keys and values test failed for index " + i);
|
||||
check.Add(keys[i], values[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < collectionSize; i++)
|
||||
{
|
||||
if (!check.ContainsKey(i.ToString()))
|
||||
throw new Exception("Keys and Values ContainsKey test " + i + " failed");
|
||||
}
|
||||
}
|
||||
|
||||
// Add and Remove test
|
||||
for (int i = 100; i < 103; i++)
|
||||
{
|
||||
simap.Add(i.ToString(), i * 18);
|
||||
if (!simap.ContainsKey(i.ToString()) || simap[i.ToString()] != (i * 18))
|
||||
throw new Exception("Add test failed for index " + i);
|
||||
|
||||
simap.Remove(i.ToString());
|
||||
if (simap.ContainsKey(i.ToString()))
|
||||
throw new Exception("Remove test failed for index " + i);
|
||||
}
|
||||
|
||||
for (int i = 200; i < 203; i++)
|
||||
{
|
||||
simap.Add(new KeyValuePair<string, int>(i.ToString(), i * 18));
|
||||
if (!simap.ContainsKey(i.ToString()) || simap[i.ToString()] != (i * 18))
|
||||
throw new Exception("Add explicit test failed for index " + i);
|
||||
|
||||
simap.Remove(new KeyValuePair<string, int>(i.ToString(), i * 18));
|
||||
if (simap.ContainsKey(i.ToString()))
|
||||
throw new Exception("Remove explicit test failed for index " + i);
|
||||
}
|
||||
|
||||
// Duplicate key test
|
||||
try
|
||||
{
|
||||
simap.Add("3", 0);
|
||||
throw new Exception("Adding duplicate key test failed");
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
}
|
||||
|
||||
// CopyTo() test
|
||||
{
|
||||
KeyValuePair<string, int>[] outputarray = new KeyValuePair<string, int>[collectionSize];
|
||||
simap.CopyTo(outputarray);
|
||||
foreach (KeyValuePair<string, int> val in outputarray)
|
||||
{
|
||||
if (simap[val.Key] != val.Value)
|
||||
throw new Exception("CopyTo (1) test failed, index:" + val.Key);
|
||||
}
|
||||
}
|
||||
{
|
||||
KeyValuePair<string, int>[] outputarray = new KeyValuePair<string, int>[midCollection + collectionSize];
|
||||
simap.CopyTo(outputarray, midCollection);
|
||||
for (int i = midCollection; i < midCollection + collectionSize; i++)
|
||||
{
|
||||
KeyValuePair<string, int> val = outputarray[i];
|
||||
if (simap[val.Key] != val.Value)
|
||||
throw new Exception("CopyTo (2) test failed, index:" + val.Key);
|
||||
}
|
||||
}
|
||||
{
|
||||
KeyValuePair<string, int>[] outputarray = new KeyValuePair<string, int>[collectionSize - 1];
|
||||
try
|
||||
{
|
||||
simap.CopyTo(outputarray);
|
||||
throw new Exception("CopyTo (4) test failed");
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Clear test
|
||||
simap.Clear();
|
||||
if (simap.Count != 0)
|
||||
throw new Exception("Clear test failed");
|
||||
|
||||
// Test wrapped methods
|
||||
for (int i = 1; i <= 5; i++)
|
||||
{
|
||||
simap[i.ToString()] = i;
|
||||
}
|
||||
double avg = li_std_map.valueAverage(simap);
|
||||
if (avg != 3.0)
|
||||
throw new Exception("Wrapped method valueAverage test failed. Got " + avg);
|
||||
|
||||
string keyStringified = li_std_map.stringifyKeys(simap);
|
||||
if (keyStringified != " 1 2 3 4 5")
|
||||
throw new Exception("Wrapped method stringifyKeys test failed. Got " + keyStringified);
|
||||
|
||||
// Test a map with a new complex type (Struct)
|
||||
{
|
||||
IntStructMap ismap = new IntStructMap();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
ismap.Add(i, new Struct(i * 10.1));
|
||||
}
|
||||
|
||||
if (ismap.Count != 10)
|
||||
throw new Exception("Count test on complex type map failed");
|
||||
|
||||
foreach (KeyValuePair<int, Struct> p in ismap)
|
||||
{
|
||||
if ((p.Key * 10.1) != p.Value.num)
|
||||
throw new Exception("Iteration test on complex type map failed for index " + p.Key);
|
||||
}
|
||||
}
|
||||
|
||||
// Test a map of pointers
|
||||
{
|
||||
IntStructPtrMap ispmap = new IntStructPtrMap();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
ispmap.Add(i, new Struct(i * 10.1));
|
||||
}
|
||||
|
||||
if (ispmap.Count != 10)
|
||||
throw new Exception("Count test on complex type pointer map failed");
|
||||
|
||||
foreach (KeyValuePair<int, Struct> p in ispmap)
|
||||
{
|
||||
if ((p.Key * 10.1) != p.Value.num)
|
||||
throw new Exception("Iteration test on complex type pointer map failed for index " + p.Key);
|
||||
}
|
||||
}
|
||||
{
|
||||
IntStructConstPtrMap iscpmap = new IntStructConstPtrMap();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
iscpmap.Add(i, new Struct(i * 10.1));
|
||||
}
|
||||
|
||||
if (iscpmap.Count != 10)
|
||||
throw new Exception("Count test on complex type const pointer map failed");
|
||||
|
||||
foreach (KeyValuePair<int, Struct> p in iscpmap)
|
||||
{
|
||||
if ((p.Key * 10.1) != p.Value.num)
|
||||
throw new Exception("Iteration test on complex type const pointer map failed for index " + p.Key);
|
||||
}
|
||||
}
|
||||
|
||||
// Test complex type as key (Struct)
|
||||
{
|
||||
StructIntMap limap = new StructIntMap();
|
||||
Struct s7 = new Struct(7);
|
||||
Struct s8 = new Struct(8);
|
||||
limap[s7] = 8;
|
||||
if (limap[s7] != 8)
|
||||
throw new Exception("Assignment test on complex key map failed");
|
||||
|
||||
if (!limap.ContainsKey(s7))
|
||||
throw new Exception("Key test (1) on complex key map failed");
|
||||
|
||||
if (limap.ContainsKey(s8))
|
||||
throw new Exception("Key test (2) on complex key map failed");
|
||||
}
|
||||
|
||||
// All done
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ public class runme {
|
|||
throw new Exception("test failed");
|
||||
if (special_variable_macros.testMary(name) != "SWIGTYPE_p_NameWrap")
|
||||
throw new Exception("test failed");
|
||||
if (special_variable_macros.testJames(name) != "SWIGTYPE_Name")
|
||||
throw new Exception("test failed");
|
||||
if (special_variable_macros.testJim(name) != "multiname num")
|
||||
throw new Exception("test failed");
|
||||
NewName newName = NewName.factory("factoryname");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue