]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani-tests.mdc
oceani tests: check for conflicts.
[ocean] / csrc / oceani-tests.mdc
index f5f097a1b4ac0a77c648552fb0f00658fa710084..bba5156a16b05f1c084afbc7404b975ffacc73ca 100644 (file)
@@ -38,6 +38,8 @@ arguments separated from the name by commas.  For each test, there is a section
 
        tests:: oceani_test_suite
        oceani_test_suite: oceani coverage_oceani
+               @./parsergen --report --LR1 --tag Parser oceani.mdc | grep " - no conflicts" > /dev/null || \
+                   { echo "Grammar container conflicts, please review" ; exit 1; }
                @rm -rf coverage; mkdir -p coverage
                @cp *.gcno coverage
                @for T in $(oceani_tests); do \
@@ -157,6 +159,16 @@ Now we need to test if/else and some different loops
                        count = count + 1
                print "error is ", target - guess * guess
 
+               for j:=0; then j = j+3 ; while j < 10:
+                       if j != 0 and then 20 / j > 3:
+                               print "20 /", j," =", 20 / j
+                       else:
+                               print "I won't calculate 20 /", j
+               pi ::= 3.1415926535897
+               if 355/113 == pi or else +(pi - 355/113) < 0.001:
+                       print "Close enough"
+               print "lower" if 355/113 < pi else "higher"
+
 ###### output: cond_loop
        Success
         1 2 4 8 16 32 64
@@ -165,6 +177,12 @@ Now we need to test if/else and some different loops
        2 1.41422
        3 1.41421
        error is  -4.51095e-12
+       I won't calculate 20 / 0
+       20 / 3  = 6.66667
+       20 / 6  = 3.33333
+       I won't calculate 20 / 9
+       Close enough
+       higher
 
 ## Say Hello