History

Merged in basic_tests_raise (pull request #5)

Update limbo tests to raise exception on failure rather than call 'exit'.

Aaron R Robinson committed 9 years ago

Commit e5f12522 parents c55b47f 63ba7151 file · +227 −225Browse files

Unified · Split

limbo/basic_limbo_tests.b+227−225
@@ -6,6 +6,8 @@ include "external_module.m"; · 5 unmodified lines
66
77 sys : Sys;
88
9+TEST_FAILED : exception;
10+
911 init(args: list of string)
1012 {
1113 a := "foobar!";
@@ -56,7 +58,7 @@ test_function_refs() · 44 unmodified lines
5658 s1 := "abcdefg";
5759 s2 := "ABCDEFG";
5860
59− if (f(s1, s2) != 1) exit;
61+ if (f(s1, s2) != 1) raise TEST_FAILED();
6062 }
6163
6264 test_alt()
@@ -74,9 +76,9 @@ test_alt() · 11 unmodified lines
7476 alt
7577 {
7678 r1 := <- int_chan_10 =>
77− if (r1 != 10) exit;
79+ if (r1 != 10) raise TEST_FAILED();
7880 r2 := <- int_chan_20 =>
79− if (r2 != 20) exit;
81+ if (r2 != 20) raise TEST_FAILED();
8082 d = <- int_chan_done =>
8183 ;
8284 }
@@ -94,9 +96,9 @@ test_alt() · 11 unmodified lines
9496 alt
9597 {
9698 unused =<- int_chan_unused1 =>
97− exit;
99+ raise TEST_FAILED();
98100 int_chan_unused2 <-= unused =>
99− exit;
101+ raise TEST_FAILED();
100102 * =>
101103 ;
102104 }
@@ -114,9 +116,9 @@ test_alt() · 11 unmodified lines
114116 alt
115117 {
116118 unused =<- int_chan_unused1 =>
117− exit;
119+ raise TEST_FAILED();
118120 int_chan_unused2 <-= unused =>
119− exit;
121+ raise TEST_FAILED();
120122 * =>
121123 ;
122124 }
@@ -136,17 +138,17 @@ alt2(ten : chan of int, twenty : chan of int, done : chan of int) · 13 unmodified lines
136138 {
137139 v : int;
138140 v =<- twenty;
139− if (v != 20) exit;
141+ if (v != 20) raise TEST_FAILED();
140142 v =<- ten;
141− if (v != 10) exit;
143+ if (v != 10) raise TEST_FAILED();
142144 v =<- twenty;
143− if (v != 20) exit;
145+ if (v != 20) raise TEST_FAILED();
144146 v =<- twenty;
145− if (v != 20) exit;
147+ if (v != 20) raise TEST_FAILED();
146148 v =<- ten;
147− if (v != 10) exit;
149+ if (v != 10) raise TEST_FAILED();
148150 v =<- ten;
149− if (v != 10) exit;
151+ if (v != 10) raise TEST_FAILED();
150152 done <-= 1;
151153 }
152154
@@ -171,7 +173,7 @@ test_channel_int(c : chan of int) · 18 unmodified lines
171173 spawn test_channel_int(c_l);
172174
173175 m := <- c_l;
174− if (m != 10) exit;
176+ if (m != 10) raise TEST_FAILED();
175177
176178 c_l <-= 20;
177179 }
@@ -180,7 +182,7 @@ test_channel_int(c : chan of int) · 2 unmodified lines
180182 c <-= 10;
181183 m := <- c;
182184
183− if (m != 20) exit;
185+ if (m != 20) raise TEST_FAILED();
184186 }
185187 }
186188
@@ -193,15 +195,15 @@ test_channel_int_buffered(c : chan of int, r : chan of int) · 6 unmodified lines
193195 spawn test_channel_int_buffered(c_l, r_l);
194196
195197 m := <- c_l;
196− if (m != 10) exit;
198+ if (m != 10) raise TEST_FAILED();
197199 m += <- c_l;
198− if (m != 20) exit;
200+ if (m != 20) raise TEST_FAILED();
199201 m += <- c_l;
200− if (m != 30) exit;
202+ if (m != 30) raise TEST_FAILED();
201203 m += <- c_l;
202− if (m != 40) exit;
204+ if (m != 40) raise TEST_FAILED();
203205 m += <- c_l;
204− if (m != 50) exit;
206+ if (m != 50) raise TEST_FAILED();
205207
206208 r_l <-= m;
207209 }
@@ -214,7 +216,7 @@ test_channel_int_buffered(c : chan of int, r : chan of int) · 6 unmodified lines
214216 c <-= 10;
215217 m := <- r;
216218
217− if (m != 50) exit;
219+ if (m != 50) raise TEST_FAILED();
218220 }
219221 }
220222
@@ -232,8 +234,8 @@ test_channel_adt(c : chan of ChannelAdt) · 11 unmodified lines
232234 spawn test_channel_adt(c_l);
233235
234236 m := <- c_l;
235− if (m.s != "from") exit;
236− if (m.d != 1.0) exit;
237+ if (m.s != "from") raise TEST_FAILED();
238+ if (m.d != 1.0) raise TEST_FAILED();
237239
238240 c_l <-= ("to", 2.0);
239241 }
@@ -242,8 +244,8 @@ test_channel_adt(c : chan of ChannelAdt) · 2 unmodified lines
242244 c <-= ("from", 1.0);
243245 m := <- c;
244246
245− if (m.s != "to") exit;
246− if (m.d != 2.0) exit;
247+ if (m.s != "to") raise TEST_FAILED();
248+ if (m.d != 2.0) raise TEST_FAILED();
247249 }
248250 }
249251
@@ -256,14 +258,14 @@ test_channel_adt_buffered(c : chan of ChannelAdt, r : chan of ChannelAdt) · 6 unmodified lines
256258 spawn test_channel_adt_buffered(c_l, r_l);
257259
258260 m := <- c_l;
259− if (m.s != "from") exit;
260− if (m.d != 1.0) exit;
261+ if (m.s != "from") raise TEST_FAILED();
262+ if (m.d != 1.0) raise TEST_FAILED();
261263 m = <- c_l;
262− if (m.s != "from") exit;
263− if (m.d != 1.0) exit;
264+ if (m.s != "from") raise TEST_FAILED();
265+ if (m.d != 1.0) raise TEST_FAILED();
264266 m = <- c_l;
265− if (m.s != "from") exit;
266− if (m.d != 1.0) exit;
267+ if (m.s != "from") raise TEST_FAILED();
268+ if (m.d != 1.0) raise TEST_FAILED();
267269
268270 r_l <-= ("to", 2.0);
269271 }
@@ -274,8 +276,8 @@ test_channel_adt_buffered(c : chan of ChannelAdt, r : chan of ChannelAdt) · 4 unmodified lines
274276 c <-= ("from", 1.0);
275277 m := <- r;
276278
277− if (m.s != "to") exit;
278− if (m.d != 2.0) exit;
279+ if (m.s != "to") raise TEST_FAILED();
280+ if (m.d != 2.0) raise TEST_FAILED();
279281 }
280282 }
281283
@@ -287,8 +289,8 @@ test_channel_ref_adt(c : chan of ref ChannelAdt) · 5 unmodified lines
287289 spawn test_channel_ref_adt(c_l);
288290
289291 m := <- c_l;
290− if (m.s != "from") exit;
291− if (m.d != 1.0) exit;
292+ if (m.s != "from") raise TEST_FAILED();
293+ if (m.d != 1.0) raise TEST_FAILED();
292294
293295 c_l <-= ref ("to", 2.0);
294296 }
@@ -297,8 +299,8 @@ test_channel_ref_adt(c : chan of ref ChannelAdt) · 2 unmodified lines
297299 c <-= ref ("from", 1.0);
298300 m := <- c;
299301
300− if (m.s != "to") exit;
301− if (m.d != 2.0) exit;
302+ if (m.s != "to") raise TEST_FAILED();
303+ if (m.d != 2.0) raise TEST_FAILED();
302304 }
303305 }
304306
@@ -311,14 +313,14 @@ test_channel_ref_adt_buffered(c : chan of ref ChannelAdt, r : chan of ref Channe · 6 unmodified lines
311313 spawn test_channel_ref_adt_buffered(c_l, r_l);
312314
313315 m := <- c_l;
314− if (m.s != "from") exit;
315− if (m.d != 1.0) exit;
316+ if (m.s != "from") raise TEST_FAILED();
317+ if (m.d != 1.0) raise TEST_FAILED();
316318 m = <- c_l;
317− if (m.s != "from") exit;
318− if (m.d != 1.0) exit;
319+ if (m.s != "from") raise TEST_FAILED();
320+ if (m.d != 1.0) raise TEST_FAILED();
319321 m = <- c_l;
320− if (m.s != "from") exit;
321− if (m.d != 1.0) exit;
322+ if (m.s != "from") raise TEST_FAILED();
323+ if (m.d != 1.0) raise TEST_FAILED();
322324
323325 r_l <-= ref ("to", 2.0);
324326 }
@@ -329,8 +331,8 @@ test_channel_ref_adt_buffered(c : chan of ref ChannelAdt, r : chan of ref Channe · 4 unmodified lines
329331 c <-= ref ("from", 1.0);
330332 m := <- r;
331333
332− if (m.s != "to") exit;
333− if (m.d != 2.0) exit;
334+ if (m.s != "to") raise TEST_FAILED();
335+ if (m.d != 2.0) raise TEST_FAILED();
334336 }
335337 }
336338
@@ -345,7 +347,7 @@ th1() · 8 unmodified lines
345347 a := 9;
346348 b := 11;
347349 c := a + b;
348− if (c != 20) exit;
350+ if (c != 20) raise TEST_FAILED();
349351 }
350352
351353 TESTEXCEPTION : exception(int, int);
@@ -358,16 +360,16 @@ test_exceptions() · 6 unmodified lines
358360 } exception e {
359361 TESTEXCEPTION =>
360362 (a,b) := e;
361− if (a != 5 || b != 10) exit;
363+ if (a != 5 || b != 10) raise TEST_FAILED();
362364
363− * => exit;
365+ * => raise TEST_FAILED();
364366 }
365367
366368 {
367369 raise "bad time";
368370 } exception e {
369371 "bad time" => ;
370− * => exit;
372+ * => raise TEST_FAILED();
371373 }
372374
373375 s := 0;
@@ -377,7 +379,7 @@ test_exceptions() · 3 unmodified lines
377379 TESTEXCEPTION => s = 1;
378380 * => ;
379381 }
380− if (s != 1) exit;
382+ if (s != 1) raise TEST_FAILED();
381383
382384 s = 0;
383385 {
@@ -386,7 +388,7 @@ test_exceptions() · 2 unmodified lines
386388 "exception string" => s = 1;
387389 * => ;
388390 }
389− if (s != 1) exit;
391+ if (s != 1) raise TEST_FAILED();
390392
391393 s = 0;
392394 {
@@ -394,11 +396,11 @@ test_exceptions() · 1 unmodified line
394396 } exception e {
395397 TESTEXCEPTION =>
396398 (a,b) := e;
397− if (a != 0) exit;
399+ if (a != 0) raise TEST_FAILED();
398400 s = 1;
399401 * => ;
400402 }
401− if (s != 1) exit;
403+ if (s != 1) raise TEST_FAILED();
402404 }
403405
404406 raise_exception_1(v : int)
@@ -406,10 +408,10 @@ raise_exception_1(v : int) · 1 unmodified line
406408 {
407409 raise_exception_2(v);
408410 } exception e {
409− "do not catch" => exit;
411+ "do not catch" => raise TEST_FAILED();
410412 }
411413
412− exit;
414+ raise TEST_FAILED();
413415 }
414416
415417 raise_exception_2(v : int)
@@ -444,7 +446,7 @@ test_case() · 28 unmodified lines
444446 * => s = 0;
445447 }
446448
447− if (s != 1) exit;
449+ if (s != 1) raise TEST_FAILED();
448450 }
449451
450452 {
@@ -457,7 +459,7 @@ test_case() · 6 unmodified lines
457459 * => s = 0;
458460 }
459461
460− if (s != 1) exit;
462+ if (s != 1) raise TEST_FAILED();
461463 }
462464
463465 {
@@ -471,7 +473,7 @@ test_case() · 7 unmodified lines
471473 * => s = 0;
472474 }
473475
474− if (s != 1) exit;
476+ if (s != 1) raise TEST_FAILED();
475477 }
476478 }
477479
@@ -494,12 +496,12 @@ test_discriminated_union() · 16 unmodified lines
494496 pick x := c
495497 {
496498 Str =>
497− exit;
499+ raise TEST_FAILED();
498500 Real =>
499501 ;
500502 };
501503
502− if (tagof(c) != tagof(Constant.Real)) exit;
504+ if (tagof(c) != tagof(Constant.Real)) raise TEST_FAILED();
503505 }
504506
505507 test_external_module()
@@ -509,12 +511,12 @@ test_external_module() · 3 unmodified lines
509511
510512 {
511513 module_int := ext_mod->return_int();
512− if (module_int != ext_mod->module_constant) exit;
514+ if (module_int != ext_mod->module_constant) raise TEST_FAILED();
513515 }
514516
515517 {
516518 thirty_four := ext_mod->double_int(17);
517− if (thirty_four != 34) exit;
519+ if (thirty_four != 34) raise TEST_FAILED();
518520 }
519521
520522 {
@@ -534,7 +536,7 @@ test_fixed_point() · 13 unmodified lines
534536 a := fpt(1.5);
535537 b := fpt(2.5);
536538 c := a * b;
537− if (c != fpt(3.75)) exit;
539+ if (c != fpt(3.75)) raise TEST_FAILED();
538540 }
539541
540542 test_exponent()
@@ -544,34 +546,34 @@ test_exponent() · 3 unmodified lines
544546 base := 2;
545547 power := 3;
546548 result := base ** power;
547− if (result != 8) exit;
549+ if (result != 8) raise TEST_FAILED();
548550 base **= power;
549− if (result != base) exit;
551+ if (result != base) raise TEST_FAILED();
550552 }
551553
552554 {
553555 base := big 2;
554556 power := 3;
555557 result := base ** power;
556− if (result != big 8) exit;
558+ if (result != big 8) raise TEST_FAILED();
557559 base **= power;
558− if (result != base) exit;
560+ if (result != base) raise TEST_FAILED();
559561 }
560562
561563 {
562564 base := real 2.0;
563565 power := 3;
564566 result := base ** power;
565− if (result != real 8.0) exit;
567+ if (result != real 8.0) raise TEST_FAILED();
566568 base **= power;
567− if (result != base) exit;
569+ if (result != base) raise TEST_FAILED();
568570 }
569571
570572 {
571573 base := 2;
572574 power := 0;
573575 result := base ** power;
574− if (result != 1) exit;
576+ if (result != 1) raise TEST_FAILED();
575577 }
576578
577579 # Integer exponent rules
@@ -579,12 +581,12 @@ test_exponent() · 1 unmodified line
579581 base := 2;
580582 power := 0;
581583 result := base ** power;
582− if (result != 1) exit;
584+ if (result != 1) raise TEST_FAILED();
583585
584586 base = 2;
585587 power = -1;
586588 result = base ** power;
587− if (result != 0) exit; # Non integer result (i.e. 0)
589+ if (result != 0) raise TEST_FAILED(); # Non integer result (i.e. 0)
588590 }
589591
590592 # Real exponent rules
@@ -592,12 +594,12 @@ test_exponent() · 1 unmodified line
592594 base := 2.0;
593595 power := 0;
594596 result := base ** power;
595− if (result != 1.0) exit;
597+ if (result != 1.0) raise TEST_FAILED();
596598
597599 base = 2.0;
598600 power = -1;
599601 result = base ** power;
600− if (result != 0.5) exit;
602+ if (result != 0.5) raise TEST_FAILED();
601603 }
602604 }
603605
@@ -605,28 +607,28 @@ test_string() · 1 unmodified line
605607 {
606608 sys->print("test_string()\n");
607609 count4 := "abcd";
608− if (len count4 != 4) exit;
610+ if (len count4 != 4) raise TEST_FAILED();
609611
610612 array4 := array of byte count4;
611− if (len array4 != 4) exit;
613+ if (len array4 != 4) raise TEST_FAILED();
612614
613615 count6 := "わがよたれぞ";
614− if (len count6 != 6) exit;
616+ if (len count6 != 6) raise TEST_FAILED();
615617
616618 array18 := array of byte count6;
617− if (len array18 != 18) exit;
619+ if (len array18 != 18) raise TEST_FAILED();
618620
619621 count6_2 := string array18;
620− if (count6 != count6_2) exit;
622+ if (count6 != count6_2) raise TEST_FAILED();
621623
622624 count7 := "खा सकता";
623− if (len count7 != 7) exit;
625+ if (len count7 != 7) raise TEST_FAILED();
624626
625627 array19 := array of byte count7;
626− if (len array19 != 19) exit;
628+ if (len array19 != 19) raise TEST_FAILED();
627629
628630 count36 := "abcdefghijklmnopqrstuvwxyz0123456789";
629− if (len count36 != 36) exit;
631+ if (len count36 != 36) raise TEST_FAILED();
630632
631633 # Grow string
632634 {
@@ -637,12 +639,12 @@ test_string() · 4 unmodified lines
637639 str[len str] = ch + 2;
638640 str[len str] = ch + 3;
639641 str[len str] = ch + 4;
640− if (len str != 5) exit;
641− if (str[2] != 'c') exit;
642+ if (len str != 5) raise TEST_FAILED();
643+ if (str[2] != 'c') raise TEST_FAILED();
642644
643645 str[2] = 'よ';
644− if (len str != 5) exit;
645− if (str[2] != 'よ') exit;
646+ if (len str != 5) raise TEST_FAILED();
647+ if (str[2] != 'よ') raise TEST_FAILED();
646648 }
647649
648650 # Compare (ascii)
@@ -651,27 +653,27 @@ test_string() · 2 unmodified lines
651653 str_l2 := "a";
652654 str_g := "z";
653655
654− if (!(str_l == str_l)) exit;
655− if (!(str_l == str_l2)) exit;
656− if (!(str_l <= str_l2)) exit;
657− if (!(str_l >= str_l2)) exit;
658− if (!(str_l < str_g)) exit;
659− if (!(str_g > str_l)) exit;
656+ if (!(str_l == str_l)) raise TEST_FAILED();
657+ if (!(str_l == str_l2)) raise TEST_FAILED();
658+ if (!(str_l <= str_l2)) raise TEST_FAILED();
659+ if (!(str_l >= str_l2)) raise TEST_FAILED();
660+ if (!(str_l < str_g)) raise TEST_FAILED();
661+ if (!(str_g > str_l)) raise TEST_FAILED();
660662
661663 str_e : string;
662− if (str_l == str_e) exit;
663− if (!(str_l != str_e)) exit;
664− if (str_l <= str_e) exit;
665− if (!(str_l >= str_e)) exit;
666− if (str_l < str_e) exit;
667− if (!(str_g > str_e)) exit;
668−
669− if (str_e == str_l) exit;
670− if (!(str_e != str_l)) exit;
671− if (!(str_e <= str_l)) exit;
672− if (str_e >= str_l) exit;
673− if (!(str_e < str_l)) exit;
674− if (str_e > str_g) exit;
664+ if (str_l == str_e) raise TEST_FAILED();
665+ if (!(str_l != str_e)) raise TEST_FAILED();
666+ if (str_l <= str_e) raise TEST_FAILED();
667+ if (!(str_l >= str_e)) raise TEST_FAILED();
668+ if (str_l < str_e) raise TEST_FAILED();
669+ if (!(str_g > str_e)) raise TEST_FAILED();
670+
671+ if (str_e == str_l) raise TEST_FAILED();
672+ if (!(str_e != str_l)) raise TEST_FAILED();
673+ if (!(str_e <= str_l)) raise TEST_FAILED();
674+ if (str_e >= str_l) raise TEST_FAILED();
675+ if (!(str_e < str_l)) raise TEST_FAILED();
676+ if (str_e > str_g) raise TEST_FAILED();
675677 }
676678
677679 # Compare (multi-byte)
@@ -680,27 +682,27 @@ test_string() · 2 unmodified lines
680682 str_l2 := "Α";
681683 str_g := "Ω";
682684
683− if (!(str_l == str_l)) exit;
684− if (!(str_l == str_l2)) exit;
685− if (!(str_l <= str_l2)) exit;
686− if (!(str_l >= str_l2)) exit;
687− if (!(str_l < str_g)) exit;
688− if (!(str_g > str_l)) exit;
685+ if (!(str_l == str_l)) raise TEST_FAILED();
686+ if (!(str_l == str_l2)) raise TEST_FAILED();
687+ if (!(str_l <= str_l2)) raise TEST_FAILED();
688+ if (!(str_l >= str_l2)) raise TEST_FAILED();
689+ if (!(str_l < str_g)) raise TEST_FAILED();
690+ if (!(str_g > str_l)) raise TEST_FAILED();
689691
690692 str_e : string;
691− if (str_l == str_e) exit;
692− if (!(str_l != str_e)) exit;
693− if (str_l <= str_e) exit;
694− if (!(str_l >= str_e)) exit;
695− if (str_l < str_e) exit;
696− if (!(str_g > str_e)) exit;
697−
698− if (str_e == str_l) exit;
699− if (!(str_e != str_l)) exit;
700− if (!(str_e <= str_l)) exit;
701− if (str_e >= str_l) exit;
702− if (!(str_e < str_l)) exit;
703− if (str_e > str_g) exit;
693+ if (str_l == str_e) raise TEST_FAILED();
694+ if (!(str_l != str_e)) raise TEST_FAILED();
695+ if (str_l <= str_e) raise TEST_FAILED();
696+ if (!(str_l >= str_e)) raise TEST_FAILED();
697+ if (str_l < str_e) raise TEST_FAILED();
698+ if (!(str_g > str_e)) raise TEST_FAILED();
699+
700+ if (str_e == str_l) raise TEST_FAILED();
701+ if (!(str_e != str_l)) raise TEST_FAILED();
702+ if (!(str_e <= str_l)) raise TEST_FAILED();
703+ if (str_e >= str_l) raise TEST_FAILED();
704+ if (!(str_e < str_l)) raise TEST_FAILED();
705+ if (str_e > str_g) raise TEST_FAILED();
704706 }
705707
706708 # Compare (multi-byte/ascii mix)
@@ -709,27 +711,27 @@ test_string() · 2 unmodified lines
709711 str_l2 := "a";
710712 str_g := "Ω";
711713
712− if (!(str_l == str_l)) exit;
713− if (!(str_l == str_l2)) exit;
714− if (!(str_l <= str_l2)) exit;
715− if (!(str_l >= str_l2)) exit;
716− if (!(str_l < str_g)) exit;
717− if (!(str_g > str_l)) exit;
714+ if (!(str_l == str_l)) raise TEST_FAILED();
715+ if (!(str_l == str_l2)) raise TEST_FAILED();
716+ if (!(str_l <= str_l2)) raise TEST_FAILED();
717+ if (!(str_l >= str_l2)) raise TEST_FAILED();
718+ if (!(str_l < str_g)) raise TEST_FAILED();
719+ if (!(str_g > str_l)) raise TEST_FAILED();
718720
719721 str_e : string;
720− if (str_l == str_e) exit;
721− if (!(str_l != str_e)) exit;
722− if (str_l <= str_e) exit;
723− if (!(str_l >= str_e)) exit;
724− if (str_l < str_e) exit;
725− if (!(str_g > str_e)) exit;
726−
727− if (str_e == str_l) exit;
728− if (!(str_e != str_l)) exit;
729− if (!(str_e <= str_l)) exit;
730− if (str_e >= str_l) exit;
731− if (!(str_e < str_l)) exit;
732− if (str_e > str_g) exit;
722+ if (str_l == str_e) raise TEST_FAILED();
723+ if (!(str_l != str_e)) raise TEST_FAILED();
724+ if (str_l <= str_e) raise TEST_FAILED();
725+ if (!(str_l >= str_e)) raise TEST_FAILED();
726+ if (str_l < str_e) raise TEST_FAILED();
727+ if (!(str_g > str_e)) raise TEST_FAILED();
728+
729+ if (str_e == str_l) raise TEST_FAILED();
730+ if (!(str_e != str_l)) raise TEST_FAILED();
731+ if (!(str_e <= str_l)) raise TEST_FAILED();
732+ if (str_e >= str_l) raise TEST_FAILED();
733+ if (!(str_e < str_l)) raise TEST_FAILED();
734+ if (str_e > str_g) raise TEST_FAILED();
733735 }
734736
735737 # Concat
@@ -739,10 +741,10 @@ test_string() · 3 unmodified lines
739741 s3 : string;
740742
741743 s4 := s1 + s2;
742− if (s4 != "12") exit;
744+ if (s4 != "12") raise TEST_FAILED();
743745
744746 s1 += s2;
745− if (s1 != "12") exit;
747+ if (s1 != "12") raise TEST_FAILED();
746748
747749 s5 := s3 + s1;
748750 s6 := s3 + s3;
@@ -752,41 +754,41 @@ test_string() · 3 unmodified lines
752754 {
753755 s1 := "01234567";
754756 r1 := s1[2:6];
755− if (r1 != "2345") exit;
757+ if (r1 != "2345") raise TEST_FAILED();
756758
757759 s2 : string;
758760 r2 := s2[0:0];
759− if (r2 != nil) exit;
761+ if (r2 != nil) raise TEST_FAILED();
760762 }
761763
762764 # Convert number => string
763765 {
764766 w_val := 12345;
765767 s_w := string w_val;
766− if (s_w != "12345") exit;
768+ if (s_w != "12345") raise TEST_FAILED();
767769
768770 r_val := 3.14;
769771 s_r := string r_val;
770− if (s_r != "3.14") exit;
772+ if (s_r != "3.14") raise TEST_FAILED();
771773
772774 b_val := big 987532;
773775 s_b := string b_val;
774− if (s_b != "987532") exit;
776+ if (s_b != "987532") raise TEST_FAILED();
775777 }
776778
777779 # Convert string => number
778780 {
779781 s_w := "12345";
780782 w_val := int s_w;
781− if (w_val != 12345) exit;
783+ if (w_val != 12345) raise TEST_FAILED();
782784
783785 s_r := "3.14";
784786 r_val := real s_r;
785− if (r_val != 3.14) exit;
787+ if (r_val != 3.14) raise TEST_FAILED();
786788
787789 s_b := "987532";
788790 b_val := big s_b;
789− if (b_val != big 987532) exit;
791+ if (b_val != big 987532) raise TEST_FAILED();
790792 }
791793 }
792794
@@ -795,7 +797,7 @@ test_array() · 2 unmodified lines
795797 sys->print("test_array()\n");
796798 arr : array of int;
797799 a := len arr;
798− if (a != 0) exit;
800+ if (a != 0) raise TEST_FAILED();
799801
800802 test_array_byte();
801803 test_array_int();
@@ -808,21 +810,21 @@ test_array_byte() · 6 unmodified lines
808810 arr := array [] of { byte 1, byte 2, byte 3, byte 4, byte 5, byte 6 };
809811
810812 sl1 := arr[2:5];
811− if (len sl1 != 3) exit;
812− if (sl1[0] != byte 3) exit;
813− if (sl1[2] != byte 5) exit;
813+ if (len sl1 != 3) raise TEST_FAILED();
814+ if (sl1[0] != byte 3) raise TEST_FAILED();
815+ if (sl1[2] != byte 5) raise TEST_FAILED();
814816
815817 sl2 := sl1[1:];
816− if (len sl2 != 2) exit;
817− if (sl2[0] != byte 4) exit;
818− if (sl2[1] != byte 5) exit;
818+ if (len sl2 != 2) raise TEST_FAILED();
819+ if (sl2[0] != byte 4) raise TEST_FAILED();
820+ if (sl2[1] != byte 5) raise TEST_FAILED();
819821
820822 sl3 := array[4] of byte;
821823 sl3[0] = byte 16ree;
822824 sl3[1:] = arr[3:5];
823825 sl3[3] = byte 16ree;
824− if (sl3[1] != byte 4) exit;
825− if (sl3[2] != byte 5) exit;
826+ if (sl3[1] != byte 4) raise TEST_FAILED();
827+ if (sl3[2] != byte 5) raise TEST_FAILED();
826828 }
827829
828830 test_array_int()
@@ -830,21 +832,21 @@ test_array_int() · 1 unmodified line
830832 arr := array [] of { 1, 2, 3, 4, 5, 6 };
831833
832834 sl1 := arr[2:5];
833− if (len sl1 != 3) exit;
834− if (sl1[0] != 3) exit;
835− if (sl1[2] != 5) exit;
835+ if (len sl1 != 3) raise TEST_FAILED();
836+ if (sl1[0] != 3) raise TEST_FAILED();
837+ if (sl1[2] != 5) raise TEST_FAILED();
836838
837839 sl2 := sl1[1:];
838− if (len sl2 != 2) exit;
839− if (sl2[0] != 4) exit;
840− if (sl2[1] != 5) exit;
840+ if (len sl2 != 2) raise TEST_FAILED();
841+ if (sl2[0] != 4) raise TEST_FAILED();
842+ if (sl2[1] != 5) raise TEST_FAILED();
841843
842844 sl3 := array[4] of int;
843845 sl3[0] = 16reeee;
844846 sl3[1:] = arr[3:5];
845847 sl3[3] = 16reeee;
846− if (sl3[1] != 4) exit;
847− if (sl3[2] != 5) exit;
848+ if (sl3[1] != 4) raise TEST_FAILED();
849+ if (sl3[2] != 5) raise TEST_FAILED();
848850 }
849851
850852 test_array_big()
@@ -852,21 +854,21 @@ test_array_big() · 1 unmodified line
852854 arr := array [] of { 16r100000001, 16r100000002, 16r100000003, 16r100000004, 16r100000005, 16r100000006 };
853855
854856 sl1 := arr[2:5];
855− if (len sl1 != 3) exit;
856− if (sl1[0] != 16r100000003) exit;
857− if (sl1[2] != 16r100000005) exit;
857+ if (len sl1 != 3) raise TEST_FAILED();
858+ if (sl1[0] != 16r100000003) raise TEST_FAILED();
859+ if (sl1[2] != 16r100000005) raise TEST_FAILED();
858860
859861 sl2 := sl1[1:];
860− if (len sl2 != 2) exit;
861− if (sl2[0] != 16r100000004) exit;
862− if (sl2[1] != 16r100000005) exit;
862+ if (len sl2 != 2) raise TEST_FAILED();
863+ if (sl2[0] != 16r100000004) raise TEST_FAILED();
864+ if (sl2[1] != 16r100000005) raise TEST_FAILED();
863865
864866 sl3 := array[4] of big;
865867 sl3[0] = 16reeeeeeeeeeeeeeee;
866868 sl3[1:] = arr[3:5];
867869 sl3[3] = 16reeeeeeeeeeeeeeee;
868− if (sl3[1] != 16r100000004) exit;
869− if (sl3[2] != 16r100000005) exit;
870+ if (sl3[1] != 16r100000004) raise TEST_FAILED();
871+ if (sl3[2] != 16r100000005) raise TEST_FAILED();
870872 }
871873
872874 test_array_real()
@@ -874,21 +876,21 @@ test_array_real() · 1 unmodified line
874876 arr := array [] of { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 };
875877
876878 sl1 := arr[2:5];
877− if (len sl1 != 3) exit;
878− if (sl1[0] != 3.0) exit;
879− if (sl1[2] != 5.0) exit;
879+ if (len sl1 != 3) raise TEST_FAILED();
880+ if (sl1[0] != 3.0) raise TEST_FAILED();
881+ if (sl1[2] != 5.0) raise TEST_FAILED();
880882
881883 sl2 := sl1[1:];
882− if (len sl2 != 2) exit;
883− if (sl2[0] != 4.0) exit;
884− if (sl2[1] != 5.0) exit;
884+ if (len sl2 != 2) raise TEST_FAILED();
885+ if (sl2[0] != 4.0) raise TEST_FAILED();
886+ if (sl2[1] != 5.0) raise TEST_FAILED();
885887
886888 sl3 := array[4] of real;
887889 sl3[0] = 1.1111111;
888890 sl3[1:] = arr[3:5];
889891 sl3[3] = 1.1111111;
890− if (sl3[1] != 4.0) exit;
891− if (sl3[2] != 5.0) exit;
892+ if (sl3[1] != 4.0) raise TEST_FAILED();
893+ if (sl3[2] != 5.0) raise TEST_FAILED();
892894 }
893895
894896 test_list()
@@ -896,7 +898,7 @@ test_list() · 1 unmodified line
896898 sys->print("test_list()\n");
897899 lst : list of int;
898900 l := len lst;
899− if (l != 0) exit;
901+ if (l != 0) raise TEST_FAILED();
900902
901903 test_list_byte();
902904 test_list_int();
@@ -912,9 +914,9 @@ test_list_byte() · 9 unmodified lines
912914 lst2 := byte 16rfe :: lst1;
913915 lst3 := byte 16rfd :: lst2;
914916
915− if (len lst3 != 3) exit;
916− if (hd lst3 != byte 16rfd) exit;
917− if (hd tl tl lst3 != byte 16rff) exit;
917+ if (len lst3 != 3) raise TEST_FAILED();
918+ if (hd lst3 != byte 16rfd) raise TEST_FAILED();
919+ if (hd tl tl lst3 != byte 16rff) raise TEST_FAILED();
918920 }
919921
920922 test_list_int()
@@ -924,9 +926,9 @@ test_list_int() · 3 unmodified lines
924926 lst2 := 16rfe00 :: lst1;
925927 lst3 := 16rfd00 :: lst2;
926928
927− if (len lst3 != 3) exit;
928− if (hd lst3 != 16rfd00) exit;
929− if (hd tl tl lst3 != 16rff00) exit;
929+ if (len lst3 != 3) raise TEST_FAILED();
930+ if (hd lst3 != 16rfd00) raise TEST_FAILED();
931+ if (hd tl tl lst3 != 16rff00) raise TEST_FAILED();
930932 }
931933
932934 test_list_big()
@@ -936,9 +938,9 @@ test_list_big() · 3 unmodified lines
936938 lst2 := 16rfe000000ff000000 :: lst1;
937939 lst3 := 16rfd000000ff000000 :: lst2;
938940
939− if (len lst3 != 3) exit;
940− if (hd lst3 != 16rfd000000ff000000) exit;
941− if (hd tl tl lst3 != 16rff000000ff000000) exit;
941+ if (len lst3 != 3) raise TEST_FAILED();
942+ if (hd lst3 != 16rfd000000ff000000) raise TEST_FAILED();
943+ if (hd tl tl lst3 != 16rff000000ff000000) raise TEST_FAILED();
942944 }
943945
944946 test_list_real()
@@ -948,9 +950,9 @@ test_list_real() · 3 unmodified lines
948950 lst2 := 2.0 :: lst1;
949951 lst3 := 1.0 :: lst2;
950952
951− if (len lst3 != 3) exit;
952− if (hd lst3 != 1.0) exit;
953− if (hd tl tl lst3 != 3.0) exit;
953+ if (len lst3 != 3) raise TEST_FAILED();
954+ if (hd lst3 != 1.0) raise TEST_FAILED();
955+ if (hd tl tl lst3 != 3.0) raise TEST_FAILED();
954956 }
955957
956958 ListAdt : adt
@@ -967,9 +969,9 @@ test_list_adt() · 10 unmodified lines
967969 lst2 := ( "two", 2.0 ) :: lst1;
968970 lst3 := ( "one", 1.0 ) :: lst2;
969971
970− if (len lst3 != 3) exit;
971− if ((hd lst3).r != 1.0) exit;
972− if ((hd tl tl lst3).r != 3.0) exit;
972+ if (len lst3 != 3) raise TEST_FAILED();
973+ if ((hd lst3).r != 1.0) raise TEST_FAILED();
974+ if ((hd tl tl lst3).r != 3.0) raise TEST_FAILED();
973975 }
974976
975977 {
@@ -981,9 +983,9 @@ test_list_adt() · 5 unmodified lines
981983 lst2 := e2 :: lst1;
982984 lst3 := e1 :: lst2;
983985
984− if (len lst3 != 3) exit;
985− if ((hd lst3).r != 1.0) exit;
986− if ((hd tl tl lst3).r != 3.0) exit;
986+ if (len lst3 != 3) raise TEST_FAILED();
987+ if ((hd lst3).r != 1.0) raise TEST_FAILED();
988+ if ((hd tl tl lst3).r != 3.0) raise TEST_FAILED();
987989 }
988990 }
989991
@@ -1000,40 +1002,40 @@ test_branch_byte() · 10 unmodified lines
10001002 {
10011003 a := byte 16rff;
10021004 b := byte 16rff;
1003− if (a < b) exit;
1004− if (a > b) exit;
1005− if (a != b) exit;
1006− if (!(a == b)) exit;
1005+ if (a < b) raise TEST_FAILED();
1006+ if (a > b) raise TEST_FAILED();
1007+ if (a != b) raise TEST_FAILED();
1008+ if (!(a == b)) raise TEST_FAILED();
10071009 }
10081010
10091011 test_branch_int()
10101012 {
10111013 a := 1024;
10121014 b := 1024;
1013− if (a < b) exit;
1014− if (a > b) exit;
1015− if (a != b) exit;
1016− if (!(a == b)) exit;
1015+ if (a < b) raise TEST_FAILED();
1016+ if (a > b) raise TEST_FAILED();
1017+ if (a != b) raise TEST_FAILED();
1018+ if (!(a == b)) raise TEST_FAILED();
10171019 }
10181020
10191021 test_branch_big()
10201022 {
10211023 a := 16r10000000FFFFFFFF;
10221024 b := 16r10000000FFFFFFFF;
1023− if (a < b) exit;
1024− if (a > b) exit;
1025− if (a != b) exit;
1026− if (!(a == b)) exit;
1025+ if (a < b) raise TEST_FAILED();
1026+ if (a > b) raise TEST_FAILED();
1027+ if (a != b) raise TEST_FAILED();
1028+ if (!(a == b)) raise TEST_FAILED();
10271029 }
10281030
10291031 test_branch_real()
10301032 {
10311033 a := 1.0;
10321034 b := 1.0;
1033− if (a < b) exit;
1034− if (a > b) exit;
1035− if (a != b) exit;
1036− if (!(a == b)) exit;
1035+ if (a < b) raise TEST_FAILED();
1036+ if (a > b) raise TEST_FAILED();
1037+ if (a != b) raise TEST_FAILED();
1038+ if (!(a == b)) raise TEST_FAILED();
10371039 }
10381040
10391041 test_for_loop_function_call()
@@ -1046,13 +1048,13 @@ test_for_loop_function_call() · 6 unmodified lines
10461048
10471049 if (j % 2 == 0)
10481050 {
1049− if (is_odd != 0) exit;
1050− if (is_even != 1) exit;
1051+ if (is_odd != 0) raise TEST_FAILED();
1052+ if (is_even != 1) raise TEST_FAILED();
10511053 }
10521054 else
10531055 {
1054− if (is_odd != 1) exit;
1055− if (is_even != 0) exit;
1056+ if (is_odd != 1) raise TEST_FAILED();
1057+ if (is_even != 0) raise TEST_FAILED();
10561058 }
10571059 }
10581060 }