[Zope-CVS] CVS: PythonNet/src/testing - EnumTest.cs:1.2 IndexerTest.cs:1.2

Brian Lloyd brian@zope.com
Mon, 28 Jul 2003 22:28:57 -0400


Update of /cvs-repository/PythonNet/src/testing
In directory cvs.zope.org:/tmp/cvs-serv5111/src/testing

Modified Files:
	EnumTest.cs IndexerTest.cs 
Log Message:
added indexer support, array support and preliminary thread primitives

=== PythonNet/src/testing/EnumTest.cs 1.1 => 1.2 ===
--- PythonNet/src/testing/EnumTest.cs:1.1	Mon Jul 14 16:00:05 2003
+++ PythonNet/src/testing/EnumTest.cs	Mon Jul 28 22:28:23 2003
@@ -20,49 +20,74 @@
     public enum ByteEnum : byte {
 	Zero,
 	One,
-	Two
+	Two,
+	Three,
+	Four,
+	Five
     }
 
     public enum SByteEnum : sbyte {
+
 	Zero,
 	One,
-	Two
+	Two,
+	Three,
+	Four,
+	Five
     }
 
     public enum ShortEnum : short {
 	Zero,
 	One,
-	Two
+	Two,
+	Three,
+	Four,
+	Five
     }
 
     public enum UShortEnum : ushort {
 	Zero,
 	One,
-	Two
+	Two,
+	Three,
+	Four,
+	Five
     }
 
     public enum IntEnum : int{
 	Zero,
 	One,
-	Two
+	Two,
+	Three,
+	Four,
+	Five
     }
 
     public enum UIntEnum : uint {
 	Zero,
 	One,
-	Two
+	Two,
+	Three,
+	Four,
+	Five
     }
 
     public enum LongEnum : long {
 	Zero,
 	One,
-	Two
+	Two,
+	Three,
+	Four,
+	Five
     }
 
     public enum ULongEnum : ulong {
 	Zero,
 	One,
-	Two
+	Two,
+	Three,
+	Four,
+	Five
     }
 
 }


=== PythonNet/src/testing/IndexerTest.cs 1.1 => 1.2 ===
--- PythonNet/src/testing/IndexerTest.cs:1.1	Thu Jul 24 19:55:05 2003
+++ PythonNet/src/testing/IndexerTest.cs	Mon Jul 28 22:28:23 2003
@@ -18,7 +18,6 @@
     // Supports units tests for indexer access.
     //========================================================================
 
-
     public class IndexerBase {
 
 	protected Hashtable t;
@@ -28,6 +27,9 @@
 	}
 
 	protected string GetValue(object index) {
+	    if (index == null) {
+		return null;
+	    }
 	    object value = t[index];
 	    if (value != null) {
 		return (string)value;
@@ -297,6 +299,52 @@
 	public string this [Spam index] {
 	    get { return GetValue(index); }
 	    set { t[index] = value; }
+	}
+
+    }
+
+
+    public class MultiArgIndexerTest : IndexerBase {
+
+	public MultiArgIndexerTest() : base() {}
+
+	public string this [int index1, int index2] {
+	    get { 
+		string key = index1.ToString() + index2.ToString();
+		object value = t[key];
+		if (value != null) {
+		    return (string)value;
+		}
+		return null;
+	    }
+	    set { 
+		string key = index1.ToString() + index2.ToString();
+		t[key] = value; 
+	    }
+	}
+
+    }
+
+
+    public class MultiTypeIndexerTest : IndexerBase {
+
+	public MultiTypeIndexerTest() : base() {}
+
+	public string this [int i1, string i2, ISpam i3] {
+	    get { 
+		string key = i1.ToString() + i2.ToString() + 
+		             i3.GetHashCode().ToString();
+		object value = t[key];
+		if (value != null) {
+		    return (string)value;
+		}
+		return null;
+	    }
+	    set { 
+		string key = i1.ToString() + i2.ToString() + 
+		             i3.GetHashCode().ToString();
+		t[key] = value; 
+	    }
 	}
 
     }