Update limbo tests to raise exception on failure rather than call 'exit'.
Unified · Split
| @@ -6,6 +6,8 @@ include "external_module.m"; · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | sys : Sys; |
| 8 | 8 | |
| 9 | +TEST_FAILED : exception; | |
| 10 | + | |
| 9 | 11 | init(args: list of string) |
| 10 | 12 | { |
| 11 | 13 | a := "foobar!"; |
| @@ -56,7 +58,7 @@ test_function_refs() · 44 unmodified lines | ||
| 56 | 58 | s1 := "abcdefg"; |
| 57 | 59 | s2 := "ABCDEFG"; |
| 58 | 60 | |
| 59 | − if (f(s1, s2) != 1) exit; | |
| 61 | + if (f(s1, s2) != 1) raise TEST_FAILED(); | |
| 60 | 62 | } |
| 61 | 63 | |
| 62 | 64 | test_alt() |
| @@ -74,9 +76,9 @@ test_alt() · 11 unmodified lines | ||
| 74 | 76 | alt |
| 75 | 77 | { |
| 76 | 78 | r1 := <- int_chan_10 => |
| 77 | − if (r1 != 10) exit; | |
| 79 | + if (r1 != 10) raise TEST_FAILED(); | |
| 78 | 80 | r2 := <- int_chan_20 => |
| 79 | − if (r2 != 20) exit; | |
| 81 | + if (r2 != 20) raise TEST_FAILED(); | |
| 80 | 82 | d = <- int_chan_done => |
| 81 | 83 | ; |
| 82 | 84 | } |
| @@ -94,9 +96,9 @@ test_alt() · 11 unmodified lines | ||
| 94 | 96 | alt |
| 95 | 97 | { |
| 96 | 98 | unused =<- int_chan_unused1 => |
| 97 | − exit; | |
| 99 | + raise TEST_FAILED(); | |
| 98 | 100 | int_chan_unused2 <-= unused => |
| 99 | − exit; | |
| 101 | + raise TEST_FAILED(); | |
| 100 | 102 | * => |
| 101 | 103 | ; |
| 102 | 104 | } |
| @@ -114,9 +116,9 @@ test_alt() · 11 unmodified lines | ||
| 114 | 116 | alt |
| 115 | 117 | { |
| 116 | 118 | unused =<- int_chan_unused1 => |
| 117 | − exit; | |
| 119 | + raise TEST_FAILED(); | |
| 118 | 120 | int_chan_unused2 <-= unused => |
| 119 | − exit; | |
| 121 | + raise TEST_FAILED(); | |
| 120 | 122 | * => |
| 121 | 123 | ; |
| 122 | 124 | } |
| @@ -136,17 +138,17 @@ alt2(ten : chan of int, twenty : chan of int, done : chan of int) · 13 unmodified lines | ||
| 136 | 138 | { |
| 137 | 139 | v : int; |
| 138 | 140 | v =<- twenty; |
| 139 | − if (v != 20) exit; | |
| 141 | + if (v != 20) raise TEST_FAILED(); | |
| 140 | 142 | v =<- ten; |
| 141 | − if (v != 10) exit; | |
| 143 | + if (v != 10) raise TEST_FAILED(); | |
| 142 | 144 | v =<- twenty; |
| 143 | − if (v != 20) exit; | |
| 145 | + if (v != 20) raise TEST_FAILED(); | |
| 144 | 146 | v =<- twenty; |
| 145 | − if (v != 20) exit; | |
| 147 | + if (v != 20) raise TEST_FAILED(); | |
| 146 | 148 | v =<- ten; |
| 147 | − if (v != 10) exit; | |
| 149 | + if (v != 10) raise TEST_FAILED(); | |
| 148 | 150 | v =<- ten; |
| 149 | − if (v != 10) exit; | |
| 151 | + if (v != 10) raise TEST_FAILED(); | |
| 150 | 152 | done <-= 1; |
| 151 | 153 | } |
| 152 | 154 | |
| @@ -171,7 +173,7 @@ test_channel_int(c : chan of int) · 18 unmodified lines | ||
| 171 | 173 | spawn test_channel_int(c_l); |
| 172 | 174 | |
| 173 | 175 | m := <- c_l; |
| 174 | − if (m != 10) exit; | |
| 176 | + if (m != 10) raise TEST_FAILED(); | |
| 175 | 177 | |
| 176 | 178 | c_l <-= 20; |
| 177 | 179 | } |
| @@ -180,7 +182,7 @@ test_channel_int(c : chan of int) · 2 unmodified lines | ||
| 180 | 182 | c <-= 10; |
| 181 | 183 | m := <- c; |
| 182 | 184 | |
| 183 | − if (m != 20) exit; | |
| 185 | + if (m != 20) raise TEST_FAILED(); | |
| 184 | 186 | } |
| 185 | 187 | } |
| 186 | 188 | |
| @@ -193,15 +195,15 @@ test_channel_int_buffered(c : chan of int, r : chan of int) · 6 unmodified lines | ||
| 193 | 195 | spawn test_channel_int_buffered(c_l, r_l); |
| 194 | 196 | |
| 195 | 197 | m := <- c_l; |
| 196 | − if (m != 10) exit; | |
| 198 | + if (m != 10) raise TEST_FAILED(); | |
| 197 | 199 | m += <- c_l; |
| 198 | − if (m != 20) exit; | |
| 200 | + if (m != 20) raise TEST_FAILED(); | |
| 199 | 201 | m += <- c_l; |
| 200 | − if (m != 30) exit; | |
| 202 | + if (m != 30) raise TEST_FAILED(); | |
| 201 | 203 | m += <- c_l; |
| 202 | − if (m != 40) exit; | |
| 204 | + if (m != 40) raise TEST_FAILED(); | |
| 203 | 205 | m += <- c_l; |
| 204 | − if (m != 50) exit; | |
| 206 | + if (m != 50) raise TEST_FAILED(); | |
| 205 | 207 | |
| 206 | 208 | r_l <-= m; |
| 207 | 209 | } |
| @@ -214,7 +216,7 @@ test_channel_int_buffered(c : chan of int, r : chan of int) · 6 unmodified lines | ||
| 214 | 216 | c <-= 10; |
| 215 | 217 | m := <- r; |
| 216 | 218 | |
| 217 | − if (m != 50) exit; | |
| 219 | + if (m != 50) raise TEST_FAILED(); | |
| 218 | 220 | } |
| 219 | 221 | } |
| 220 | 222 | |
| @@ -232,8 +234,8 @@ test_channel_adt(c : chan of ChannelAdt) · 11 unmodified lines | ||
| 232 | 234 | spawn test_channel_adt(c_l); |
| 233 | 235 | |
| 234 | 236 | 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(); | |
| 237 | 239 | |
| 238 | 240 | c_l <-= ("to", 2.0); |
| 239 | 241 | } |
| @@ -242,8 +244,8 @@ test_channel_adt(c : chan of ChannelAdt) · 2 unmodified lines | ||
| 242 | 244 | c <-= ("from", 1.0); |
| 243 | 245 | m := <- c; |
| 244 | 246 | |
| 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(); | |
| 247 | 249 | } |
| 248 | 250 | } |
| 249 | 251 | |
| @@ -256,14 +258,14 @@ test_channel_adt_buffered(c : chan of ChannelAdt, r : chan of ChannelAdt) · 6 unmodified lines | ||
| 256 | 258 | spawn test_channel_adt_buffered(c_l, r_l); |
| 257 | 259 | |
| 258 | 260 | 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(); | |
| 261 | 263 | 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(); | |
| 264 | 266 | 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(); | |
| 267 | 269 | |
| 268 | 270 | r_l <-= ("to", 2.0); |
| 269 | 271 | } |
| @@ -274,8 +276,8 @@ test_channel_adt_buffered(c : chan of ChannelAdt, r : chan of ChannelAdt) · 4 unmodified lines | ||
| 274 | 276 | c <-= ("from", 1.0); |
| 275 | 277 | m := <- r; |
| 276 | 278 | |
| 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(); | |
| 279 | 281 | } |
| 280 | 282 | } |
| 281 | 283 | |
| @@ -287,8 +289,8 @@ test_channel_ref_adt(c : chan of ref ChannelAdt) · 5 unmodified lines | ||
| 287 | 289 | spawn test_channel_ref_adt(c_l); |
| 288 | 290 | |
| 289 | 291 | 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(); | |
| 292 | 294 | |
| 293 | 295 | c_l <-= ref ("to", 2.0); |
| 294 | 296 | } |
| @@ -297,8 +299,8 @@ test_channel_ref_adt(c : chan of ref ChannelAdt) · 2 unmodified lines | ||
| 297 | 299 | c <-= ref ("from", 1.0); |
| 298 | 300 | m := <- c; |
| 299 | 301 | |
| 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(); | |
| 302 | 304 | } |
| 303 | 305 | } |
| 304 | 306 | |
| @@ -311,14 +313,14 @@ test_channel_ref_adt_buffered(c : chan of ref ChannelAdt, r : chan of ref Channe · 6 unmodified lines | ||
| 311 | 313 | spawn test_channel_ref_adt_buffered(c_l, r_l); |
| 312 | 314 | |
| 313 | 315 | 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(); | |
| 316 | 318 | 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(); | |
| 319 | 321 | 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(); | |
| 322 | 324 | |
| 323 | 325 | r_l <-= ref ("to", 2.0); |
| 324 | 326 | } |
| @@ -329,8 +331,8 @@ test_channel_ref_adt_buffered(c : chan of ref ChannelAdt, r : chan of ref Channe · 4 unmodified lines | ||
| 329 | 331 | c <-= ref ("from", 1.0); |
| 330 | 332 | m := <- r; |
| 331 | 333 | |
| 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(); | |
| 334 | 336 | } |
| 335 | 337 | } |
| 336 | 338 | |
| @@ -345,7 +347,7 @@ th1() · 8 unmodified lines | ||
| 345 | 347 | a := 9; |
| 346 | 348 | b := 11; |
| 347 | 349 | c := a + b; |
| 348 | − if (c != 20) exit; | |
| 350 | + if (c != 20) raise TEST_FAILED(); | |
| 349 | 351 | } |
| 350 | 352 | |
| 351 | 353 | TESTEXCEPTION : exception(int, int); |
| @@ -358,16 +360,16 @@ test_exceptions() · 6 unmodified lines | ||
| 358 | 360 | } exception e { |
| 359 | 361 | TESTEXCEPTION => |
| 360 | 362 | (a,b) := e; |
| 361 | − if (a != 5 || b != 10) exit; | |
| 363 | + if (a != 5 || b != 10) raise TEST_FAILED(); | |
| 362 | 364 | |
| 363 | − * => exit; | |
| 365 | + * => raise TEST_FAILED(); | |
| 364 | 366 | } |
| 365 | 367 | |
| 366 | 368 | { |
| 367 | 369 | raise "bad time"; |
| 368 | 370 | } exception e { |
| 369 | 371 | "bad time" => ; |
| 370 | − * => exit; | |
| 372 | + * => raise TEST_FAILED(); | |
| 371 | 373 | } |
| 372 | 374 | |
| 373 | 375 | s := 0; |
| @@ -377,7 +379,7 @@ test_exceptions() · 3 unmodified lines | ||
| 377 | 379 | TESTEXCEPTION => s = 1; |
| 378 | 380 | * => ; |
| 379 | 381 | } |
| 380 | − if (s != 1) exit; | |
| 382 | + if (s != 1) raise TEST_FAILED(); | |
| 381 | 383 | |
| 382 | 384 | s = 0; |
| 383 | 385 | { |
| @@ -386,7 +388,7 @@ test_exceptions() · 2 unmodified lines | ||
| 386 | 388 | "exception string" => s = 1; |
| 387 | 389 | * => ; |
| 388 | 390 | } |
| 389 | − if (s != 1) exit; | |
| 391 | + if (s != 1) raise TEST_FAILED(); | |
| 390 | 392 | |
| 391 | 393 | s = 0; |
| 392 | 394 | { |
| @@ -394,11 +396,11 @@ test_exceptions() · 1 unmodified line | ||
| 394 | 396 | } exception e { |
| 395 | 397 | TESTEXCEPTION => |
| 396 | 398 | (a,b) := e; |
| 397 | − if (a != 0) exit; | |
| 399 | + if (a != 0) raise TEST_FAILED(); | |
| 398 | 400 | s = 1; |
| 399 | 401 | * => ; |
| 400 | 402 | } |
| 401 | − if (s != 1) exit; | |
| 403 | + if (s != 1) raise TEST_FAILED(); | |
| 402 | 404 | } |
| 403 | 405 | |
| 404 | 406 | raise_exception_1(v : int) |
| @@ -406,10 +408,10 @@ raise_exception_1(v : int) · 1 unmodified line | ||
| 406 | 408 | { |
| 407 | 409 | raise_exception_2(v); |
| 408 | 410 | } exception e { |
| 409 | − "do not catch" => exit; | |
| 411 | + "do not catch" => raise TEST_FAILED(); | |
| 410 | 412 | } |
| 411 | 413 | |
| 412 | − exit; | |
| 414 | + raise TEST_FAILED(); | |
| 413 | 415 | } |
| 414 | 416 | |
| 415 | 417 | raise_exception_2(v : int) |
| @@ -444,7 +446,7 @@ test_case() · 28 unmodified lines | ||
| 444 | 446 | * => s = 0; |
| 445 | 447 | } |
| 446 | 448 | |
| 447 | − if (s != 1) exit; | |
| 449 | + if (s != 1) raise TEST_FAILED(); | |
| 448 | 450 | } |
| 449 | 451 | |
| 450 | 452 | { |
| @@ -457,7 +459,7 @@ test_case() · 6 unmodified lines | ||
| 457 | 459 | * => s = 0; |
| 458 | 460 | } |
| 459 | 461 | |
| 460 | − if (s != 1) exit; | |
| 462 | + if (s != 1) raise TEST_FAILED(); | |
| 461 | 463 | } |
| 462 | 464 | |
| 463 | 465 | { |
| @@ -471,7 +473,7 @@ test_case() · 7 unmodified lines | ||
| 471 | 473 | * => s = 0; |
| 472 | 474 | } |
| 473 | 475 | |
| 474 | − if (s != 1) exit; | |
| 476 | + if (s != 1) raise TEST_FAILED(); | |
| 475 | 477 | } |
| 476 | 478 | } |
| 477 | 479 | |
| @@ -494,12 +496,12 @@ test_discriminated_union() · 16 unmodified lines | ||
| 494 | 496 | pick x := c |
| 495 | 497 | { |
| 496 | 498 | Str => |
| 497 | − exit; | |
| 499 | + raise TEST_FAILED(); | |
| 498 | 500 | Real => |
| 499 | 501 | ; |
| 500 | 502 | }; |
| 501 | 503 | |
| 502 | − if (tagof(c) != tagof(Constant.Real)) exit; | |
| 504 | + if (tagof(c) != tagof(Constant.Real)) raise TEST_FAILED(); | |
| 503 | 505 | } |
| 504 | 506 | |
| 505 | 507 | test_external_module() |
| @@ -509,12 +511,12 @@ test_external_module() · 3 unmodified lines | ||
| 509 | 511 | |
| 510 | 512 | { |
| 511 | 513 | 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(); | |
| 513 | 515 | } |
| 514 | 516 | |
| 515 | 517 | { |
| 516 | 518 | thirty_four := ext_mod->double_int(17); |
| 517 | − if (thirty_four != 34) exit; | |
| 519 | + if (thirty_four != 34) raise TEST_FAILED(); | |
| 518 | 520 | } |
| 519 | 521 | |
| 520 | 522 | { |
| @@ -534,7 +536,7 @@ test_fixed_point() · 13 unmodified lines | ||
| 534 | 536 | a := fpt(1.5); |
| 535 | 537 | b := fpt(2.5); |
| 536 | 538 | c := a * b; |
| 537 | − if (c != fpt(3.75)) exit; | |
| 539 | + if (c != fpt(3.75)) raise TEST_FAILED(); | |
| 538 | 540 | } |
| 539 | 541 | |
| 540 | 542 | test_exponent() |
| @@ -544,34 +546,34 @@ test_exponent() · 3 unmodified lines | ||
| 544 | 546 | base := 2; |
| 545 | 547 | power := 3; |
| 546 | 548 | result := base ** power; |
| 547 | − if (result != 8) exit; | |
| 549 | + if (result != 8) raise TEST_FAILED(); | |
| 548 | 550 | base **= power; |
| 549 | − if (result != base) exit; | |
| 551 | + if (result != base) raise TEST_FAILED(); | |
| 550 | 552 | } |
| 551 | 553 | |
| 552 | 554 | { |
| 553 | 555 | base := big 2; |
| 554 | 556 | power := 3; |
| 555 | 557 | result := base ** power; |
| 556 | − if (result != big 8) exit; | |
| 558 | + if (result != big 8) raise TEST_FAILED(); | |
| 557 | 559 | base **= power; |
| 558 | − if (result != base) exit; | |
| 560 | + if (result != base) raise TEST_FAILED(); | |
| 559 | 561 | } |
| 560 | 562 | |
| 561 | 563 | { |
| 562 | 564 | base := real 2.0; |
| 563 | 565 | power := 3; |
| 564 | 566 | result := base ** power; |
| 565 | − if (result != real 8.0) exit; | |
| 567 | + if (result != real 8.0) raise TEST_FAILED(); | |
| 566 | 568 | base **= power; |
| 567 | − if (result != base) exit; | |
| 569 | + if (result != base) raise TEST_FAILED(); | |
| 568 | 570 | } |
| 569 | 571 | |
| 570 | 572 | { |
| 571 | 573 | base := 2; |
| 572 | 574 | power := 0; |
| 573 | 575 | result := base ** power; |
| 574 | − if (result != 1) exit; | |
| 576 | + if (result != 1) raise TEST_FAILED(); | |
| 575 | 577 | } |
| 576 | 578 | |
| 577 | 579 | # Integer exponent rules |
| @@ -579,12 +581,12 @@ test_exponent() · 1 unmodified line | ||
| 579 | 581 | base := 2; |
| 580 | 582 | power := 0; |
| 581 | 583 | result := base ** power; |
| 582 | − if (result != 1) exit; | |
| 584 | + if (result != 1) raise TEST_FAILED(); | |
| 583 | 585 | |
| 584 | 586 | base = 2; |
| 585 | 587 | power = -1; |
| 586 | 588 | 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) | |
| 588 | 590 | } |
| 589 | 591 | |
| 590 | 592 | # Real exponent rules |
| @@ -592,12 +594,12 @@ test_exponent() · 1 unmodified line | ||
| 592 | 594 | base := 2.0; |
| 593 | 595 | power := 0; |
| 594 | 596 | result := base ** power; |
| 595 | − if (result != 1.0) exit; | |
| 597 | + if (result != 1.0) raise TEST_FAILED(); | |
| 596 | 598 | |
| 597 | 599 | base = 2.0; |
| 598 | 600 | power = -1; |
| 599 | 601 | result = base ** power; |
| 600 | − if (result != 0.5) exit; | |
| 602 | + if (result != 0.5) raise TEST_FAILED(); | |
| 601 | 603 | } |
| 602 | 604 | } |
| 603 | 605 | |
| @@ -605,28 +607,28 @@ test_string() · 1 unmodified line | ||
| 605 | 607 | { |
| 606 | 608 | sys->print("test_string()\n"); |
| 607 | 609 | count4 := "abcd"; |
| 608 | − if (len count4 != 4) exit; | |
| 610 | + if (len count4 != 4) raise TEST_FAILED(); | |
| 609 | 611 | |
| 610 | 612 | array4 := array of byte count4; |
| 611 | − if (len array4 != 4) exit; | |
| 613 | + if (len array4 != 4) raise TEST_FAILED(); | |
| 612 | 614 | |
| 613 | 615 | count6 := "わがよたれぞ"; |
| 614 | − if (len count6 != 6) exit; | |
| 616 | + if (len count6 != 6) raise TEST_FAILED(); | |
| 615 | 617 | |
| 616 | 618 | array18 := array of byte count6; |
| 617 | − if (len array18 != 18) exit; | |
| 619 | + if (len array18 != 18) raise TEST_FAILED(); | |
| 618 | 620 | |
| 619 | 621 | count6_2 := string array18; |
| 620 | − if (count6 != count6_2) exit; | |
| 622 | + if (count6 != count6_2) raise TEST_FAILED(); | |
| 621 | 623 | |
| 622 | 624 | count7 := "खा सकता"; |
| 623 | − if (len count7 != 7) exit; | |
| 625 | + if (len count7 != 7) raise TEST_FAILED(); | |
| 624 | 626 | |
| 625 | 627 | array19 := array of byte count7; |
| 626 | − if (len array19 != 19) exit; | |
| 628 | + if (len array19 != 19) raise TEST_FAILED(); | |
| 627 | 629 | |
| 628 | 630 | count36 := "abcdefghijklmnopqrstuvwxyz0123456789"; |
| 629 | − if (len count36 != 36) exit; | |
| 631 | + if (len count36 != 36) raise TEST_FAILED(); | |
| 630 | 632 | |
| 631 | 633 | # Grow string |
| 632 | 634 | { |
| @@ -637,12 +639,12 @@ test_string() · 4 unmodified lines | ||
| 637 | 639 | str[len str] = ch + 2; |
| 638 | 640 | str[len str] = ch + 3; |
| 639 | 641 | 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(); | |
| 642 | 644 | |
| 643 | 645 | 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(); | |
| 646 | 648 | } |
| 647 | 649 | |
| 648 | 650 | # Compare (ascii) |
| @@ -651,27 +653,27 @@ test_string() · 2 unmodified lines | ||
| 651 | 653 | str_l2 := "a"; |
| 652 | 654 | str_g := "z"; |
| 653 | 655 | |
| 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(); | |
| 660 | 662 | |
| 661 | 663 | 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(); | |
| 675 | 677 | } |
| 676 | 678 | |
| 677 | 679 | # Compare (multi-byte) |
| @@ -680,27 +682,27 @@ test_string() · 2 unmodified lines | ||
| 680 | 682 | str_l2 := "Α"; |
| 681 | 683 | str_g := "Ω"; |
| 682 | 684 | |
| 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(); | |
| 689 | 691 | |
| 690 | 692 | 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(); | |
| 704 | 706 | } |
| 705 | 707 | |
| 706 | 708 | # Compare (multi-byte/ascii mix) |
| @@ -709,27 +711,27 @@ test_string() · 2 unmodified lines | ||
| 709 | 711 | str_l2 := "a"; |
| 710 | 712 | str_g := "Ω"; |
| 711 | 713 | |
| 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(); | |
| 718 | 720 | |
| 719 | 721 | 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(); | |
| 733 | 735 | } |
| 734 | 736 | |
| 735 | 737 | # Concat |
| @@ -739,10 +741,10 @@ test_string() · 3 unmodified lines | ||
| 739 | 741 | s3 : string; |
| 740 | 742 | |
| 741 | 743 | s4 := s1 + s2; |
| 742 | − if (s4 != "12") exit; | |
| 744 | + if (s4 != "12") raise TEST_FAILED(); | |
| 743 | 745 | |
| 744 | 746 | s1 += s2; |
| 745 | − if (s1 != "12") exit; | |
| 747 | + if (s1 != "12") raise TEST_FAILED(); | |
| 746 | 748 | |
| 747 | 749 | s5 := s3 + s1; |
| 748 | 750 | s6 := s3 + s3; |
| @@ -752,41 +754,41 @@ test_string() · 3 unmodified lines | ||
| 752 | 754 | { |
| 753 | 755 | s1 := "01234567"; |
| 754 | 756 | r1 := s1[2:6]; |
| 755 | − if (r1 != "2345") exit; | |
| 757 | + if (r1 != "2345") raise TEST_FAILED(); | |
| 756 | 758 | |
| 757 | 759 | s2 : string; |
| 758 | 760 | r2 := s2[0:0]; |
| 759 | − if (r2 != nil) exit; | |
| 761 | + if (r2 != nil) raise TEST_FAILED(); | |
| 760 | 762 | } |
| 761 | 763 | |
| 762 | 764 | # Convert number => string |
| 763 | 765 | { |
| 764 | 766 | w_val := 12345; |
| 765 | 767 | s_w := string w_val; |
| 766 | − if (s_w != "12345") exit; | |
| 768 | + if (s_w != "12345") raise TEST_FAILED(); | |
| 767 | 769 | |
| 768 | 770 | r_val := 3.14; |
| 769 | 771 | s_r := string r_val; |
| 770 | − if (s_r != "3.14") exit; | |
| 772 | + if (s_r != "3.14") raise TEST_FAILED(); | |
| 771 | 773 | |
| 772 | 774 | b_val := big 987532; |
| 773 | 775 | s_b := string b_val; |
| 774 | − if (s_b != "987532") exit; | |
| 776 | + if (s_b != "987532") raise TEST_FAILED(); | |
| 775 | 777 | } |
| 776 | 778 | |
| 777 | 779 | # Convert string => number |
| 778 | 780 | { |
| 779 | 781 | s_w := "12345"; |
| 780 | 782 | w_val := int s_w; |
| 781 | − if (w_val != 12345) exit; | |
| 783 | + if (w_val != 12345) raise TEST_FAILED(); | |
| 782 | 784 | |
| 783 | 785 | s_r := "3.14"; |
| 784 | 786 | r_val := real s_r; |
| 785 | − if (r_val != 3.14) exit; | |
| 787 | + if (r_val != 3.14) raise TEST_FAILED(); | |
| 786 | 788 | |
| 787 | 789 | s_b := "987532"; |
| 788 | 790 | b_val := big s_b; |
| 789 | − if (b_val != big 987532) exit; | |
| 791 | + if (b_val != big 987532) raise TEST_FAILED(); | |
| 790 | 792 | } |
| 791 | 793 | } |
| 792 | 794 | |
| @@ -795,7 +797,7 @@ test_array() · 2 unmodified lines | ||
| 795 | 797 | sys->print("test_array()\n"); |
| 796 | 798 | arr : array of int; |
| 797 | 799 | a := len arr; |
| 798 | − if (a != 0) exit; | |
| 800 | + if (a != 0) raise TEST_FAILED(); | |
| 799 | 801 | |
| 800 | 802 | test_array_byte(); |
| 801 | 803 | test_array_int(); |
| @@ -808,21 +810,21 @@ test_array_byte() · 6 unmodified lines | ||
| 808 | 810 | arr := array [] of { byte 1, byte 2, byte 3, byte 4, byte 5, byte 6 }; |
| 809 | 811 | |
| 810 | 812 | 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(); | |
| 814 | 816 | |
| 815 | 817 | 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(); | |
| 819 | 821 | |
| 820 | 822 | sl3 := array[4] of byte; |
| 821 | 823 | sl3[0] = byte 16ree; |
| 822 | 824 | sl3[1:] = arr[3:5]; |
| 823 | 825 | 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(); | |
| 826 | 828 | } |
| 827 | 829 | |
| 828 | 830 | test_array_int() |
| @@ -830,21 +832,21 @@ test_array_int() · 1 unmodified line | ||
| 830 | 832 | arr := array [] of { 1, 2, 3, 4, 5, 6 }; |
| 831 | 833 | |
| 832 | 834 | 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(); | |
| 836 | 838 | |
| 837 | 839 | 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(); | |
| 841 | 843 | |
| 842 | 844 | sl3 := array[4] of int; |
| 843 | 845 | sl3[0] = 16reeee; |
| 844 | 846 | sl3[1:] = arr[3:5]; |
| 845 | 847 | 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(); | |
| 848 | 850 | } |
| 849 | 851 | |
| 850 | 852 | test_array_big() |
| @@ -852,21 +854,21 @@ test_array_big() · 1 unmodified line | ||
| 852 | 854 | arr := array [] of { 16r100000001, 16r100000002, 16r100000003, 16r100000004, 16r100000005, 16r100000006 }; |
| 853 | 855 | |
| 854 | 856 | 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(); | |
| 858 | 860 | |
| 859 | 861 | 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(); | |
| 863 | 865 | |
| 864 | 866 | sl3 := array[4] of big; |
| 865 | 867 | sl3[0] = 16reeeeeeeeeeeeeeee; |
| 866 | 868 | sl3[1:] = arr[3:5]; |
| 867 | 869 | 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(); | |
| 870 | 872 | } |
| 871 | 873 | |
| 872 | 874 | test_array_real() |
| @@ -874,21 +876,21 @@ test_array_real() · 1 unmodified line | ||
| 874 | 876 | arr := array [] of { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; |
| 875 | 877 | |
| 876 | 878 | 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(); | |
| 880 | 882 | |
| 881 | 883 | 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(); | |
| 885 | 887 | |
| 886 | 888 | sl3 := array[4] of real; |
| 887 | 889 | sl3[0] = 1.1111111; |
| 888 | 890 | sl3[1:] = arr[3:5]; |
| 889 | 891 | 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(); | |
| 892 | 894 | } |
| 893 | 895 | |
| 894 | 896 | test_list() |
| @@ -896,7 +898,7 @@ test_list() · 1 unmodified line | ||
| 896 | 898 | sys->print("test_list()\n"); |
| 897 | 899 | lst : list of int; |
| 898 | 900 | l := len lst; |
| 899 | − if (l != 0) exit; | |
| 901 | + if (l != 0) raise TEST_FAILED(); | |
| 900 | 902 | |
| 901 | 903 | test_list_byte(); |
| 902 | 904 | test_list_int(); |
| @@ -912,9 +914,9 @@ test_list_byte() · 9 unmodified lines | ||
| 912 | 914 | lst2 := byte 16rfe :: lst1; |
| 913 | 915 | lst3 := byte 16rfd :: lst2; |
| 914 | 916 | |
| 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(); | |
| 918 | 920 | } |
| 919 | 921 | |
| 920 | 922 | test_list_int() |
| @@ -924,9 +926,9 @@ test_list_int() · 3 unmodified lines | ||
| 924 | 926 | lst2 := 16rfe00 :: lst1; |
| 925 | 927 | lst3 := 16rfd00 :: lst2; |
| 926 | 928 | |
| 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(); | |
| 930 | 932 | } |
| 931 | 933 | |
| 932 | 934 | test_list_big() |
| @@ -936,9 +938,9 @@ test_list_big() · 3 unmodified lines | ||
| 936 | 938 | lst2 := 16rfe000000ff000000 :: lst1; |
| 937 | 939 | lst3 := 16rfd000000ff000000 :: lst2; |
| 938 | 940 | |
| 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(); | |
| 942 | 944 | } |
| 943 | 945 | |
| 944 | 946 | test_list_real() |
| @@ -948,9 +950,9 @@ test_list_real() · 3 unmodified lines | ||
| 948 | 950 | lst2 := 2.0 :: lst1; |
| 949 | 951 | lst3 := 1.0 :: lst2; |
| 950 | 952 | |
| 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(); | |
| 954 | 956 | } |
| 955 | 957 | |
| 956 | 958 | ListAdt : adt |
| @@ -967,9 +969,9 @@ test_list_adt() · 10 unmodified lines | ||
| 967 | 969 | lst2 := ( "two", 2.0 ) :: lst1; |
| 968 | 970 | lst3 := ( "one", 1.0 ) :: lst2; |
| 969 | 971 | |
| 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(); | |
| 973 | 975 | } |
| 974 | 976 | |
| 975 | 977 | { |
| @@ -981,9 +983,9 @@ test_list_adt() · 5 unmodified lines | ||
| 981 | 983 | lst2 := e2 :: lst1; |
| 982 | 984 | lst3 := e1 :: lst2; |
| 983 | 985 | |
| 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(); | |
| 987 | 989 | } |
| 988 | 990 | } |
| 989 | 991 | |
| @@ -1000,40 +1002,40 @@ test_branch_byte() · 10 unmodified lines | ||
| 1000 | 1002 | { |
| 1001 | 1003 | a := byte 16rff; |
| 1002 | 1004 | 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(); | |
| 1007 | 1009 | } |
| 1008 | 1010 | |
| 1009 | 1011 | test_branch_int() |
| 1010 | 1012 | { |
| 1011 | 1013 | a := 1024; |
| 1012 | 1014 | 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(); | |
| 1017 | 1019 | } |
| 1018 | 1020 | |
| 1019 | 1021 | test_branch_big() |
| 1020 | 1022 | { |
| 1021 | 1023 | a := 16r10000000FFFFFFFF; |
| 1022 | 1024 | 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(); | |
| 1027 | 1029 | } |
| 1028 | 1030 | |
| 1029 | 1031 | test_branch_real() |
| 1030 | 1032 | { |
| 1031 | 1033 | a := 1.0; |
| 1032 | 1034 | 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(); | |
| 1037 | 1039 | } |
| 1038 | 1040 | |
| 1039 | 1041 | test_for_loop_function_call() |
| @@ -1046,13 +1048,13 @@ test_for_loop_function_call() · 6 unmodified lines | ||
| 1046 | 1048 | |
| 1047 | 1049 | if (j % 2 == 0) |
| 1048 | 1050 | { |
| 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(); | |
| 1051 | 1053 | } |
| 1052 | 1054 | else |
| 1053 | 1055 | { |
| 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(); | |
| 1056 | 1058 | } |
| 1057 | 1059 | } |
| 1058 | 1060 | } |