]> git.mdlowis.com Git - archive/dlang.git/commitdiff
Added language integration tests
authorMike D. Lowis <mike@mdlowis.com>
Thu, 1 Mar 2012 16:43:43 +0000 (11:43 -0500)
committerMike D. Lowis <mike@mdlowis.com>
Thu, 1 Mar 2012 16:43:43 +0000 (11:43 -0500)
tests/integration/types/blocks.dl [new file with mode: 0644]
tests/integration/types/booleans.dl [new file with mode: 0644]
tests/integration/types/characters.dl [new file with mode: 0644]
tests/integration/types/lists.dl [new file with mode: 0644]
tests/integration/types/numbers.dl [new file with mode: 0644]
tests/integration/types/strings.dl [new file with mode: 0644]
tests/integration/types/symbols.dl [new file with mode: 0644]
tests/integration/types/vectors.dl [new file with mode: 0644]
tests/system/system_tests.dl [deleted file]

diff --git a/tests/integration/types/blocks.dl b/tests/integration/types/blocks.dl
new file mode 100644 (file)
index 0000000..f575577
--- /dev/null
@@ -0,0 +1,7 @@
+#------------------------------------------------------------------------------
+# Integration Tests for Blocks
+#------------------------------------------------------------------------------
+
+assert( typeof( { 1 + 1} ) == Block )
+assert( typeof( {|a| a + 1} ) == Block )
+assert( typeof( {|a,b| a + b} ) == Block )
diff --git a/tests/integration/types/booleans.dl b/tests/integration/types/booleans.dl
new file mode 100644 (file)
index 0000000..dc7ddc8
--- /dev/null
@@ -0,0 +1,26 @@
+#------------------------------------------------------------------------------
+# Integration Tests for Booleans and Nil
+#------------------------------------------------------------------------------
+
+assert( typeof( True ) == Bool )
+assert( typeof( False ) == Bool )
+assert( True == True )
+assert( False == False )
+assert( False == Nil )
+assert( True != False )
+assert( True != Nil )
+assert( True == 0 )
+assert( True == 1 )
+assert( True == 'A' )
+assert( True == "" )
+assert( True == () )
+assert( True == [] )
+assert( True == $Foo )
+assert( False != 0 )
+assert( False != 1 )
+assert( False != 'A' )
+assert( False != "" )
+assert( False != () )
+assert( False != [] )
+assert( False != $Foo )
+
diff --git a/tests/integration/types/characters.dl b/tests/integration/types/characters.dl
new file mode 100644 (file)
index 0000000..9c71aac
--- /dev/null
@@ -0,0 +1,5 @@
+#------------------------------------------------------------------------------
+# Integration Tests for Characters
+#------------------------------------------------------------------------------
+
+assert( typeof( 'A' ) == Char )
diff --git a/tests/integration/types/lists.dl b/tests/integration/types/lists.dl
new file mode 100644 (file)
index 0000000..a6b3cc4
--- /dev/null
@@ -0,0 +1,5 @@
+#------------------------------------------------------------------------------
+# Integration Tests for Lists
+#------------------------------------------------------------------------------
+
+assert( typeof( (1,2,3) ) == List )
diff --git a/tests/integration/types/numbers.dl b/tests/integration/types/numbers.dl
new file mode 100644 (file)
index 0000000..bc74d76
--- /dev/null
@@ -0,0 +1,32 @@
+#------------------------------------------------------------------------------
+# Integration Tests for Numbers
+#------------------------------------------------------------------------------
+
+assert( typeof( 345 ) == Num )
+assert( 345 == 345 )
+
+assert( typeof( -345 ) == Num )
+assert( -345 == -345 )
+
+assert( typeof( 34.5 ) == Num )
+assert( 34.5 == 34.5 )
+
+assert( typeof( -34.5 ) == Num )
+assert( -34.5 == -34.5 )
+
+assert( typeof( 3.45e2 ) == Num )
+assert( 3.45e2 == 345 )
+
+assert( typeof( -3.45e2 ) == Num )
+assert( -3.45e2 == -345 )
+
+assert( typeof( 34500e-2 ) == Num )
+assert( 34500e-2 == 345 )
+
+assert( typeof( -34500e-2 ) == Num )
+assert( -34500e-2 == -345 )
+
+assert( typeof( 0x159 ) == Num )
+assert( 0x159 == 345 )
+
+
diff --git a/tests/integration/types/strings.dl b/tests/integration/types/strings.dl
new file mode 100644 (file)
index 0000000..750ba6e
--- /dev/null
@@ -0,0 +1,5 @@
+#------------------------------------------------------------------------------
+# Integration Tests for Strings
+#------------------------------------------------------------------------------
+
+assert( typeof("this is a string") == String)
diff --git a/tests/integration/types/symbols.dl b/tests/integration/types/symbols.dl
new file mode 100644 (file)
index 0000000..e0c419b
--- /dev/null
@@ -0,0 +1,5 @@
+#------------------------------------------------------------------------------
+# Integration Tests for Symbols
+#------------------------------------------------------------------------------
+
+assert( typeof( $Foo ) == Symbol )
diff --git a/tests/integration/types/vectors.dl b/tests/integration/types/vectors.dl
new file mode 100644 (file)
index 0000000..c569f35
--- /dev/null
@@ -0,0 +1,5 @@
+#------------------------------------------------------------------------------
+# Integration Tests for Vectors
+#------------------------------------------------------------------------------
+
+assert( typeof( [1,2,3] ) == Vector )
diff --git a/tests/system/system_tests.dl b/tests/system/system_tests.dl
deleted file mode 100644 (file)
index ce94648..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-#------------------------------------------------------------------------------
-# Macro Tests
-#------------------------------------------------------------------------------
-# Macro Definitions
-% if ( cond, branch1:Block ) {
-       exec_if( cond, branch1 )
-}
-
-% ifelse ( cond, branch1:Block, branch2:Block ) {
-       exec_if( cond, branch1, branch2 )
-}
-
-% foreach ( lst, fn:Block ) {
-       for_each(fn, lst)
-}
-
-# Possible New Macro Syntax
-# _     Macro Name
-# Exp   Expression
-# Vctr  Vector
-# Lst   List
-# Blk   Block
-# ID    ID
-# Num   Number
-# Chr   Character
-# Str   String
-# Sym   Symbol
-#% if {
-#      (_ Exp Blk)   : exec_if( $1, $2 ) 
-#      (_ Exp Blk Blk) : exec_if( $1, $2, $3 )
-#}
-#
-#% if {
-#      (_ Exp Blk)   : exec_if( $1, $2 ) 
-#      (_ Exp Blk ID(else) Blk) : exec_if( $1, $2, $3 )
-#}
-
-# Macro Uses
-if (1 == 1)
-{
-       print("1 Hello, World!")
-}
-
-if (1 == 0)
-{
-       print("Hello, World!")
-}
-
-ifelse (1 == 1)
-{
-       print("2 Hello, World!")
-}{
-       error("Incorrect branch was taken.")
-}
-
-ifelse (1 == 0)
-{
-       error("Incorrect branch was taken.")
-}{
-       print("3 Hello, World!")
-}
-
-#------------------------------------------------------------------------------
-# Collection Access and Iteration Tests
-#------------------------------------------------------------------------------
-# Accessing elements of lists, vectors, and strings
-lst1 = `(4,5,6)
-print(lst1[0], " Hello, World!")
-
-vec1 = [4,5,6]
-print(vec1[1], " Hello, World!")
-
-str1 = "456"
-print(str1[2], " Hello, World!")
-
-# Iterating over lists, vectors, and strings
-lst_foo = `(7,8,9,10)
-foreach lst_foo { |a|
-       print(a," Hello, World!")
-}
-
-vec_foo = [11,12,13,14,15]
-foreach vec_foo { |a,b|
-       print(b," Hello, World!")
-}
-
-str_foo = "6789"
-foreach str_foo { |a|
-       print(1,a," Hello, World!")
-}
-
-#------------------------------------------------------------------------------
-# Delayed Evaluation
-#------------------------------------------------------------------------------
-% delay ( exp ) {
-       make_promise({ exp })
-}
-
-% force ( prom ) {
-       force( prom )
-}
-
-foo = delay nonexistent_var + 1
-nonexistent_var = 19
-assert( typeof(foo) == Block )
-assert( typeof( force foo ) == Num )
-print( force( foo ), " Hello, World!" )
-
-#------------------------------------------------------------------------------
-# Type Checking Tests
-#------------------------------------------------------------------------------
-assert( typeof( 1.1 ) == Num )
-assert( typeof( 'A' ) == Char )
-assert( typeof( `(1,2,3) ) == List )
-assert( typeof( [1,2,3] ) == Vector )
-assert( typeof( $Foo ) == Symbol )
-assert( typeof( {|a| a + 1} ) == Block )
-