[svn] r6112: nemerle/trunk/lib/tests: Makefile list.n

malekith svnadmin at nemerle.org
Mon Feb 6 21:28:43 CET 2006


Log:
Add testcase for list

Author: malekith
Date: Mon Feb  6 21:28:43 2006
New Revision: 6112

Added:
   nemerle/trunk/lib/tests/list.n
Modified:
   nemerle/trunk/lib/tests/Makefile

Modified: nemerle/trunk/lib/tests/Makefile
==============================================================================
--- nemerle/trunk/lib/tests/Makefile	(original)
+++ nemerle/trunk/lib/tests/Makefile	Mon Feb  6 21:28:43 2006
@@ -4,7 +4,7 @@
 
 EXECUTE = $(NET_ENGINE) $(NET_FLAGS)
 THISDIR = $(shell if cygpath --help 2>/dev/null 1>&2; then echo `cygpath -m $(CURDIR)`; else echo $(CURDIR); fi)
-UNIT_SCR = linkedlist.n list.n
+UNIT_SRC = linkedlist.n list.n
 
 ############################################################
 # TARGETS
@@ -23,7 +23,7 @@
 		$(NUNIT_CONSOLE) lib-unit-tests.dll; \
 	fi
 
-lib-unit-tests.dll: 
+lib-unit-tests.dll: $(UNIT_SRC) 
 	$(Q)if test $(NUNIT_CONSOLE); then \
 		$(EXECUTE) $(TOP)/ncc/out.stage3/ncc.exe $(UNIT_SRC) -def:NUNIT $(NUNIT_LIB) -t:library -o:lib-unit-tests.dll; \
 	fi

Added: nemerle/trunk/lib/tests/list.n
==============================================================================
--- (empty file)
+++ nemerle/trunk/lib/tests/list.n	Mon Feb  6 21:28:43 2006
@@ -0,0 +1,46 @@
+using Nemerle.Collections;
+using Nemerle.IO;
+
+#if NUNIT
+using NUnit.Framework;
+
+[TestFixture]
+public class List_UnitTest : Assertion {
+
+  [Test]
+  public Empty () : void
+  {
+    Assert ([].IsEmpty);
+    Assert (![1].IsEmpty);
+  }
+
+  [Test]
+  public CopyTo () : void
+  {
+    def l = [1, 2, 3];
+    def a = array (3);
+    l.CopyTo (a);
+    mutable i = 0;
+    foreach (item in l) {
+      AssertEquals (item, a[i]);
+      ++ i;
+    }
+  }
+
+  [Test]
+  public CopyToLen () : void
+  {
+    def l = [1, 2, 3];
+    def a = array (2);
+    l.CopyTo (a, 2);
+    mutable i = 0;
+    foreach (item in l) {
+      when (i < a.Length)
+        AssertEquals (item, a[i]);
+      ++ i;
+    }
+  }
+
+}
+#endif
+



More information about the svn mailing list