]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani-tests.mdc
oceani: introduce 'test' and 'choose' operators
[ocean] / csrc / oceani-tests.mdc
index d1557010e9c03d1cd27b895ace23989ef6227ff0..f9dce403d3e83f9920736e06853676778bfd7198 100644 (file)
@@ -134,6 +134,15 @@ calculations on them.
                  + b1
                  + b
 
+               z:Boolean= True
+               w:Boolean = False
+               if ?z:
+                       print "w??z", w??z
+                       print "z??w", z??w
+                       print "z??False", z??False, "w??False", w??False
+               if ?w:
+                       print "Weird?"
+
 ###### output: valvar
 
        23 12 35 11 276 1.916666667 11
@@ -142,6 +151,9 @@ calculations on them.
        False True True False False False
        This is a string  field theory This is a string field theory
        81
+       w??z True
+       z??w True
+       z??False True w??False False
 
 Next we change the value of variables
 
@@ -794,7 +806,7 @@ These programs were generated by looking for the
 various places that `type_err()` are called.
 
 ###### test list
-       oceani_failing_tests += type_err1 type_err2 type_err3 type_err4 type_err5
+       oceani_failing_tests += type_err1 type_err2 type_err3 type_err4 type_err5 type_err6
 
 ###### test: type_err1
 
@@ -939,6 +951,20 @@ various places that `type_err()` are called.
        .tmp.code:2:7: error: type has recursive definition: foo
        .tmp.code:5:7: error: type has recursive definition: baz
 
+###### test: type_err6
+
+       func main()
+               a:= "hello"
+               if ?a:
+                       print "no"
+               print a ?? "there"
+
+###### output: type_err6
+       .tmp.code:4:12: error: '?' requires a testable value, not string
+       .tmp.code:6:14: error: "??" requires a testable value, not string
+       oceani: type error in program - not running.
+
+
 ###### test list
        oceani_failing_tests += type_err_const type_err_const1 type_err_const2 missing_program bad_main