summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-02-15 10:11:49 -0500
committerAdrian Thurston <thurston@complang.org>2015-02-15 10:11:49 -0500
commita7bf3fea2087b0edf93bae8cc26557d9e6200b2b (patch)
tree0e9b44348c569513e9b530677c4d2ba27d3e0763
parente02a3e7d7369540bf020134d538c2a3f2001c5fa (diff)
downloadcolm-a7bf3fea2087b0edf93bae8cc26557d9e6200b2b.tar.gz
some test cases for value generics
-rw-r--r--test/list3.lm26
-rw-r--r--test/map2.lm23
-rw-r--r--test/map3.lm24
-rw-r--r--test/map4.lm24
4 files changed, 97 insertions, 0 deletions
diff --git a/test/list3.lm b/test/list3.lm
new file mode 100644
index 00000000..fd477595
--- /dev/null
+++ b/test/list3.lm
@@ -0,0 +1,26 @@
+
+
+new L: vlist<str>()
+
+L->push_tail( "dear" )
+L->push_tail( "friend" )
+L->push_tail( "---" )
+
+L->push_head( "my" )
+L->push_head( "hello" )
+
+L->push_head( "..." )
+
+
+L->pop_tail()
+L->pop_head()
+
+for S: str in L {
+ print "[S]
+}
+
+##### EXP #####
+hello
+my
+dear
+friend
diff --git a/test/map2.lm b/test/map2.lm
new file mode 100644
index 00000000..1d3fc52c
--- /dev/null
+++ b/test/map2.lm
@@ -0,0 +1,23 @@
+new M: vmap<str str>()
+
+M->insert( ( "hello" ) ( "friend" ) )
+M->insert( ( "one--" ) ( "num1" ) )
+M->insert( ( "two--" ) ( "num2" ) )
+M->insert( ( "three" ) ( "num3" ) )
+M->insert( ( "four-" ) ( "num4" ) )
+
+M->remove( "one--" )
+
+for V: str in M {
+ print "[V]
+}
+
+Two: str = M->find( "two--" )
+print "[Two]
+
+##### EXP #####
+num4
+friend
+num3
+num2
+num2
diff --git a/test/map3.lm b/test/map3.lm
new file mode 100644
index 00000000..7ce27bd1
--- /dev/null
+++ b/test/map3.lm
@@ -0,0 +1,24 @@
+
+new M: vmap<str int>()
+
+M->insert( ( "one--" ) ( 1 ) )
+M->insert( ( "two--" ) ( 2 ) )
+M->insert( ( "three" ) ( 3 ) )
+M->insert( ( "four-" ) ( 4 ) )
+M->insert( ( "five-" ) ( 5 ) )
+
+M->remove( "three" )
+
+for V: int in M {
+ print "[V]
+}
+
+Two: int = M->find( "two--" )
+print "[Two]
+
+##### EXP #####
+5
+4
+1
+2
+2
diff --git a/test/map4.lm b/test/map4.lm
new file mode 100644
index 00000000..f32c1bf4
--- /dev/null
+++ b/test/map4.lm
@@ -0,0 +1,24 @@
+
+new M: vmap<int str>()
+
+M->insert( 0 ( "hello" ) )
+M->insert( 1 ( "one" ) )
+M->insert( 2 ( "two" ) )
+M->insert( 3 ( "three" ) )
+M->insert( 4 ( "four" ) )
+
+M->remove( 3 )
+
+for V: str in M {
+ print "[V]
+}
+
+Two: str = M->find( 2 )
+print "[Two]
+
+##### EXP #####
+hello
+one
+two
+four
+two