From: NeilBrown Date: Sat, 18 Dec 2021 11:00:48 +0000 (+1100) Subject: oceani: last fixes for UNTESTED for now. X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=commitdiff_plain;h=631d5279eef7fe755d9df27ce16b416ba976154b oceani: last fixes for UNTESTED for now. I still don't get 100% due to some case labels which gcov think are not tested, but I don't understand why. Signed-off-by: NeilBrown --- diff --git a/csrc/oceani-tests.mdc b/csrc/oceani-tests.mdc index d262881..fafb788 100644 --- a/csrc/oceani-tests.mdc +++ b/csrc/oceani-tests.mdc @@ -295,6 +295,19 @@ Now we need to test if/else and some different loops else print 'larger' + // different parsing options + for { + x:=1; sum := 0 + } then { + x = x + 1 + } while { + use x < 10 + } do { + sum = sum + x + } case 1 { + print "impossible" + } + ###### output: cond_loop Success 1 2 4 8 16 32 64 diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index cd37f1b..9d6aec9 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -1157,7 +1157,7 @@ A separate function encoding these cases will simplify some code later. { int cmp; if (tl != tr) - return tl - tr; // NOTEST + return tl - tr; switch (tl->vtype) { case Vlabel: cmp = left->label == right->label ? 0 : 1; break; case Vnum: cmp = mpq_cmp(left->num, right->num); break; @@ -4557,20 +4557,17 @@ the common header for all reductions to use. }$ | IN OptNL Statementlist OUT ${ $0 = $ OpenScope { IN OptNL Statementlist OUT OptNL } ${ $0 = $ OpenScope { IN OptNL Statementlist OUT OptNL } ${ $0 = $ { OpenScope IN OptNL Statementlist OUT OptNL } ${ $0 = $ { IN OpenScope OptNL Statementlist OUT OptNL } ${ $0 = $ { IN OptNL Statementlist OUT OptNL } ${ $0 = $ { IN OptNL Statementlist OUT OptNL } ${ $0 = $