Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mp4/blob/main/tests/docs.om # omega-mp4 omega-mp4: ovideo, an MP4 reader written in Omega (Apache-2.0) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mp4 / tests / docs.om` 1070 lines ยท 17576 bytes Raw Blame History 1 om2 2 note tests/docs.om: publication checks of this repository's own text (README, sources, corpus notes, 3 note tests). The gate builds it with the pinned compiler and runs it from the repository root; by hand: 4 note OMC < tests/docs.om > build/docs && chmod +x build/docs && build/docs 5 note Rules come from tests/docrules.txt, one per line; lines starting with # and blank lines are skipped. 6 note file PATH PATH must exist and be readable; every forbid rule applies to it. 7 note paths PATH as file, and every path-like word in PATH that contains a slash and ends .om, .md 8 note or .txt must name a file of this repository: not absolute, no .. segment, 9 note and present. 10 note forbid TEXT TEXT (the rest of the line, case-sensitive) must not occur in any file. 11 note need PATH TEXT PATH (declared by an earlier file or paths line) must contain TEXT. 12 note cases PATH the gate's case file (ID EXIT ...; rob and # lines skipped). A sentence of a 13 note checked file that says some exit codes have "no case" must not name a code 14 note that a case of PATH expects, before or after those words. 15 note Then every line ID|PATH|OLD|NEW of tests/docmutants.txt is a mutant: the line OLD of PATH (found 16 note exactly once) replaced by NEW, or the whole file absent when OLD is *. Some rule must fail on it. 17 note ID, PATH and OLD contain no "|"; NEW is the rest of the line and may. 18 note Exit 0 with the last line "DOCS PASS ...", 1 with "DOCS FAIL failures=N", 3 with "DOCS NOT_RUN: ..." 19 note when a rule or mutant line is malformed or a rule file cannot be read. 20 note Bounds: 64 files, 64 forbid rules, 64 need rules, files below 4 MiB, rule and mutant files below 21 note 64 KiB, paths below 4096 bytes. Each refuses with NOT_RUN or a FAIL line, never a trap. 22 23 const FBN ulong `4194304` 24 const RLN ulong 65536 25 const NOP ulong `4294967295` 26 27 global fb uchar `4194304` 28 global mb uchar `4194304` 29 global rl uchar 65536 30 global mt uchar 65536 31 global pa uchar 4096 32 global pan ulong 1 33 note file table: path rl[fpo .. fpo + fpl), fpr 1 when the path rule applies. 34 global fpo ulong 64 35 global fpl ulong 64 36 global fpr ulong 64 37 global nfl ulong 1 38 note forbid rules: rl[zo .. zo + zl). 39 global zo ulong 64 40 global zl ulong 64 41 global nz ulong 1 42 note need rules: file nfi, text rl[nto .. nto + ntl). 43 global nfi ulong 64 44 global nto ulong 64 45 global ntl ulong 64 46 global nn ulong 1 47 note cw[c] is 1 when a case of the cases file expects exit status c; ckon 1 once a cases line was read. 48 global cw uchar 256 49 global ckon ulong 1 50 note cnt: 0 files checked, 1 paths files, 2 mutants, 3 mutants killed. 51 global cnt ulong 4 52 note quiet 1 while a mutant is checked (violations are counted, not printed). 53 global quiet ulong 1 54 note ml: start and end of the mutated line found by mlines, then the mutated file's length (mbuild). 55 global ml ulong 3 56 57 text tnl "\n" 58 text trules "tests/docrules.txt" 59 text tmuts "tests/docmutants.txt" 60 text kfile "file " 61 text kpaths "paths " 62 text kforbid "forbid " 63 text kneed "need " 64 text kcases "cases " 65 text knoc "no case" 66 text tx1 ".om" 67 text tx2 ".md" 68 text tx3 ".txt" 69 text tfail "DOCS FAIL " 70 text tnr "DOCS NOT_RUN: " 71 text tcolon ": " 72 text tline "line " 73 text tmiss "missing or unreadable file" 74 text tbig "file of 4 MiB or more" 75 text tforb "forbidden text: " 76 text tneed "required text absent: " 77 text tout "reference outside the repository: " 78 text tgone "cited file missing: " 79 text tclaim "says exit status " 80 text tclaim2 " has no case, but the case file expects it" 81 text tnorule "cannot read tests/docrules.txt" 82 text tnomut "cannot read tests/docmutants.txt" 83 text tnofile "no file rules" 84 text tbadr "malformed rule line: " 85 text tbadm "malformed mutant line: " 86 text tkill "DOCS MUTANT killed " 87 text tsurv "DOCS MUTANT SURVIVED " 88 text tnf "DOCS MUTANT FAIL (old line not found exactly once, or the file is unreadable) " 89 text tpass "DOCS PASS files=" 90 text tp1 " paths-files=" 91 text tp2 " forbid=" 92 text tp3 " need=" 93 text tp4 " cases-file=" 94 text tp5 " mutants-killed=" 95 text tslash "/" 96 text tfails "DOCS FAIL failures=" 97 98 fn say t view uchar * to void 99 r = write 1 t 0 len t 100 end 101 102 fn saynum v ulong to void 103 b = new uchar 24 0 104 x = v 105 for i ulong 20 106 put b sub 19 i uchar add rem x 10 48 107 x = div x 10 108 end 109 k = ulong 0 110 while lt k 19 bound 20 111 if ne get b k 48 112 break 113 end 114 k = add k 1 115 end 116 r = write 1 b k sub 20 k 117 end 118 119 fn sayrl s ulong n ulong to void 120 r = write 1 rl s n 121 end 122 123 fn saymt s ulong n ulong to void 124 r = write 1 mt s n 125 end 126 127 fn notrun t view uchar * to void 128 say tnr 129 say t 130 say tnl 131 exit 3 132 end 133 134 note ---- paths in pa ---- 135 fn pat t view uchar * to void 136 for i ulong len t bound 4096 137 put pa i get t i 138 end 139 put pan 0 len t 140 end 141 142 fn parl s ulong n ulong to void 143 if ge n 4096 144 notrun tbadr 145 end 146 for i ulong n bound 4096 147 put pa i get rl add s i 148 end 149 put pan 0 n 150 end 151 152 fn pamt s ulong n ulong to void 153 if ge n 4096 154 notrun tbadm 155 end 156 for i ulong n bound 4096 157 put pa i get mt add s i 158 end 159 put pan 0 n 160 end 161 162 note rd: file pa into buffer w (0 fb, 1 mb, 2 rl, 3 mt); the byte count, -1 when it cannot be opened 163 note or read (a directory too), -2 when it fills the buffer. 164 fn rd w ulong to long 165 fd = fopen pa 0 get pan 0 0 0 166 if lt fd 0 167 ret long -1 168 end 169 cap = FBN 170 if ge w 2 171 cap = RLN 172 end 173 n = ulong 0 174 res = long 0 175 while true bound 100000 176 r = long 0 177 if eq w 0 178 r = read int fd fb n sub cap n 179 end 180 if eq w 1 181 r = read int fd mb n sub cap n 182 end 183 if eq w 2 184 r = read int fd rl n sub cap n 185 end 186 if eq w 3 187 r = read int fd mt n sub cap n 188 end 189 if lt r 0 190 res = long -1 191 break 192 end 193 if eq r 0 194 res = long n 195 break 196 end 197 n = add n ulong r 198 if eq n cap 199 res = long -2 200 break 201 end 202 end 203 c = fclose int fd 204 ret res 205 end 206 207 note ---- lines and words ---- 208 fn rleol s ulong n ulong to ulong 209 e = s 210 while lt e n bound 65536 211 if eq get rl e 10 212 break 213 end 214 e = add e 1 215 end 216 ret e 217 end 218 219 fn mteol s ulong n ulong to ulong 220 e = s 221 while lt e n bound 65536 222 if eq get mt e 10 223 break 224 end 225 e = add e 1 226 end 227 ret e 228 end 229 230 fn mbeol s ulong n ulong to ulong 231 e = s 232 while lt e n bound `4194304` 233 if eq get mb e 10 234 break 235 end 236 e = add e 1 237 end 238 ret e 239 end 240 241 fn fbeol s ulong n ulong to ulong 242 e = s 243 while lt e n bound `4194304` 244 if eq get fb e 10 245 break 246 end 247 e = add e 1 248 end 249 ret e 250 end 251 252 fn fbskip i ulong b ulong to ulong 253 j = i 254 while lt j b bound `4194304` 255 if ne get fb j 32 256 break 257 end 258 j = add j 1 259 end 260 ret j 261 end 262 263 fn fbword i ulong b ulong to ulong 264 j = i 265 while lt j b bound `4194304` 266 if eq get fb j 32 267 break 268 end 269 j = add j 1 270 end 271 ret j 272 end 273 274 note rlkw: rl[s .. e) starts with t. 275 fn rlkw s ulong e ulong t view uchar * to bool 276 if lt sub e s len t 277 ret false 278 end 279 for i ulong len t bound 64 280 if ne get rl add s i get t i 281 ret false 282 end 283 end 284 ret true 285 end 286 287 note mtbar: the first | in mt[s .. e), or e. 288 fn mtbar s ulong e ulong to ulong 289 i = s 290 while lt i e bound 65536 291 if eq get mt i 124 292 break 293 end 294 i = add i 1 295 end 296 ret i 297 end 298 299 note ffind: the index of path pa in the file table, or 99. 300 fn ffind to ulong 301 n = get pan 0 302 for i ulong get nfl 0 bound 64 303 if eq get fpl i n 304 ok = true 305 o = get fpo i 306 for j ulong n bound 4096 307 if ne get rl add o j get pa j 308 ok = false 309 break 310 end 311 end 312 if ok 313 ret i 314 end 315 end 316 end 317 ret 99 318 end 319 320 note ---- rules ---- 321 fn addf s ulong e ulong p ulong to bool 322 k = get nfl 0 323 if or ge s e ge k 64 324 ret false 325 end 326 put fpo k s 327 put fpl k sub e s 328 put fpr k p 329 put nfl 0 add k 1 330 if eq p 1 331 put cnt 1 add get cnt 1 1 332 end 333 ret true 334 end 335 336 fn addz s ulong e ulong to bool 337 k = get nz 0 338 if or ge s e ge k 64 339 ret false 340 end 341 put zo k s 342 put zl k sub e s 343 put nz 0 add k 1 344 ret true 345 end 346 347 fn addn s ulong e ulong to bool 348 k = get nn 0 349 if ge k 64 350 ret false 351 end 352 sp = s 353 while lt sp e bound 65536 354 if eq get rl sp 32 355 break 356 end 357 sp = add sp 1 358 end 359 if or eq sp s ge add sp 1 e 360 ret false 361 end 362 parl s sub sp s 363 fi = ffind 364 if eq fi 99 365 ret false 366 end 367 put nfi k fi 368 put nto k add sp 1 369 put ntl k sub e add sp 1 370 put nn 0 add k 1 371 ret true 372 end 373 374 note cline: one line fb[a .. b) of the cases file; marks the expected exit status of a case. 375 fn cline a ulong b ulong to void 376 i = fbskip a b 377 if ge i b 378 ret 379 end 380 if eq get fb i 35 381 ret 382 end 383 j = fbword i b 384 if eq sub j i 3 385 if eq get fb i 114 386 if eq get fb add i 1 111 387 if eq get fb add i 2 98 388 ret 389 end 390 end 391 end 392 end 393 p = fbskip j b 394 q = fbword p b 395 if or eq p q gt sub q p 3 396 ret 397 end 398 v = ulong 0 399 for t ulong sub q p bound 3 400 c = get fb add p t 401 if or lt c 48 gt c 57 402 ret 403 end 404 v = add mul v 10 ulong sub c 48 405 end 406 if lt v 256 407 put cw v 1 408 end 409 end 410 411 fn ldcases s ulong e ulong to bool 412 if or ge s e eq get ckon 0 1 413 ret false 414 end 415 parl s sub e s 416 k = rd 0 417 if lt k 0 418 ret false 419 end 420 n = ulong k 421 a = ulong 0 422 while lt a n bound `4194304` 423 b = fbeol a n 424 cline a b 425 a = add b 1 426 end 427 put ckon 0 1 428 ret true 429 end 430 431 fn rule1 s ulong e ulong to bool 432 if eq s e 433 ret true 434 end 435 if eq get rl s 35 436 ret true 437 end 438 if rlkw s e kfile 439 ret addf add s len kfile e 0 440 end 441 if rlkw s e kpaths 442 ret addf add s len kpaths e 1 443 end 444 if rlkw s e kforbid 445 ret addz add s len kforbid e 446 end 447 if rlkw s e kneed 448 ret addn add s len kneed e 449 end 450 if rlkw s e kcases 451 ret ldcases add s len kcases e 452 end 453 ret false 454 end 455 456 fn rules to void 457 pat trules 458 k = rd 2 459 if lt k 0 460 notrun tnorule 461 end 462 n = ulong k 463 s = ulong 0 464 while lt s n bound 65536 465 e = rleol s n 466 if not rule1 s e 467 say tnr 468 say tbadr 469 sayrl s sub e s 470 say tnl 471 exit 3 472 end 473 s = add e 1 474 end 475 if eq get nfl 0 0 476 notrun tnofile 477 end 478 end 479 480 note ---- checks of fb[0 .. n) as file fi ---- 481 fn lineof p ulong to ulong 482 l = ulong 1 483 for i ulong p bound `4194304` 484 if eq get fb i 10 485 l = add l 1 486 end 487 end 488 ret l 489 end 490 491 note viol: the first part of a violation line (nothing while quiet): "DOCS FAIL PATH: line L: T". 492 fn viol fi ulong p ulong t view uchar * to void 493 if eq get quiet 0 1 494 ret 495 end 496 say tfail 497 sayrl get fpo fi get fpl fi 498 say tcolon 499 if ne p NOP 500 say tline 501 saynum lineof p 502 say tcolon 503 end 504 say t 505 end 506 507 fn xrl s ulong n ulong to void 508 if eq get quiet 0 0 509 sayrl s n 510 say tnl 511 end 512 end 513 514 fn xfb s ulong n ulong to void 515 if eq get quiet 0 0 516 r = write 1 fb s n 517 say tnl 518 end 519 end 520 521 fn xnone to void 522 if eq get quiet 0 0 523 say tnl 524 end 525 end 526 527 note fbat: fb[p .. p + n) equals rl[s .. s + n) (the caller keeps p + n within the file). 528 fn fbat p ulong s ulong n ulong to bool 529 for i ulong n bound 65536 530 if ne get fb add p i get rl add s i 531 ret false 532 end 533 end 534 ret true 535 end 536 537 fn fbt p ulong t view uchar * to bool 538 for i ulong len t bound 64 539 if ne get fb add p i get t i 540 ret false 541 end 542 end 543 ret true 544 end 545 546 fn cforb fi ulong n ulong to ulong 547 v = ulong 0 548 for z ulong get nz 0 bound 64 549 zs = get zo z 550 zn = get zl z 551 if gt zn n 552 continue 553 end 554 for p ulong add sub n zn 1 bound `4194304` 555 if fbat p zs zn 556 v = add v 1 557 viol fi p tforb 558 xrl zs zn 559 end 560 end 561 end 562 ret v 563 end 564 565 fn fbhas n ulong s ulong k ulong to bool 566 if gt k n 567 ret false 568 end 569 for p ulong add sub n k 1 bound `4194304` 570 if fbat p s k 571 ret true 572 end 573 end 574 ret false 575 end 576 577 fn cneed fi ulong n ulong to ulong 578 v = ulong 0 579 for k ulong get nn 0 bound 64 580 if eq get nfi k fi 581 if not fbhas n get nto k get ntl k 582 v = add v 1 583 viol fi NOP tneed 584 xrl get nto k get ntl k 585 end 586 end 587 end 588 ret v 589 end 590 591 fn pch c uchar to bool 592 if and ge c 97 le c 122 593 ret true 594 end 595 if and ge c 65 le c 90 596 ret true 597 end 598 if and ge c 48 le c 57 599 ret true 600 end 601 if or eq c 95 or eq c 46 or eq c 47 eq c 45 602 ret true 603 end 604 ret false 605 end 606 607 note endsw: fb[i .. j) is longer than t and ends with t. 608 fn endsw i ulong j ulong t view uchar * to bool 609 if le sub j i len t 610 ret false 611 end 612 ret fbt sub j len t t 613 end 614 615 note dotseg: fb[i .. j) has a .. path segment. 616 fn dotseg i ulong j ulong to bool 617 k = i 618 while lt k j bound `4194304` 619 if eq get fb k 46 620 if lt add k 1 j 621 if eq get fb add k 1 46 622 pre = true 623 if gt k i 624 pre = eq get fb sub k 1 47 625 end 626 post = true 627 e2 = add k 2 628 if lt e2 j 629 post = eq get fb e2 47 630 end 631 if and pre post 632 ret true 633 end 634 end 635 end 636 end 637 k = add k 1 638 end 639 ret false 640 end 641 642 note ctok: the path rule on the word fb[i .. j); 1 when it is violated. 643 fn ctok fi ulong i ulong j0 ulong to ulong 644 j = j0 645 while gt j i bound `4194304` 646 if ne get fb sub j 1 46 647 break 648 end 649 j = sub j 1 650 end 651 if eq j i 652 ret 0 653 end 654 ok = endsw i j tx1 655 if not ok 656 ok = endsw i j tx2 657 end 658 if not ok 659 ok = endsw i j tx3 660 end 661 if not ok 662 ret 0 663 end 664 sl = false 665 for k ulong sub j i bound `4194304` 666 if eq get fb add i k 47 667 sl = true 668 break 669 end 670 end 671 if not sl 672 ret 0 673 end 674 up = false 675 if ge sub j i 3 676 if eq get fb i 46 677 if eq get fb add i 1 46 678 if eq get fb add i 2 47 679 up = true 680 end 681 end 682 end 683 end 684 if or up dotseg i j 685 viol fi i tout 686 xfb i sub j i 687 ret 1 688 end 689 if eq get fb i 47 690 viol fi i tout 691 xfb i sub j i 692 ret 1 693 end 694 if ge sub j i 4096 695 viol fi i tgone 696 xfb i sub j i 697 ret 1 698 end 699 for k ulong sub j i bound 4096 700 put pa k get fb add i k 701 end 702 put pan 0 sub j i 703 fd = fopen pa 0 get pan 0 0 0 704 if lt fd 0 705 viol fi i tgone 706 xfb i sub j i 707 ret 1 708 end 709 c = fclose int fd 710 ret 0 711 end 712 713 fn cpath fi ulong n ulong to ulong 714 if eq get fpr fi 0 715 ret 0 716 end 717 v = ulong 0 718 i = ulong 0 719 while lt i n bound `4194304` 720 if not pch get fb i 721 i = add i 1 722 continue 723 end 724 j = i 725 while lt j n bound `4194304` 726 if not pch get fb j 727 break 728 end 729 j = add j 1 730 end 731 v = add v ctok fi i j 732 i = j 733 end 734 ret v 735 end 736 737 fn isdig c uchar to bool 738 ret and ge c 48 le c 57 739 end 740 741 fn isaln c uchar to bool 742 if isdig c 743 ret true 744 end 745 if and ge c 97 le c 122 746 ret true 747 end 748 ret and ge c 65 le c 90 749 end 750 751 note cnums: digit runs in fb[a .. b) whose code a case expects; the reported line is rp. 752 fn cnums fi ulong a ulong b ulong rp ulong to ulong 753 v = ulong 0 754 i = a 755 while lt i b bound `4194304` 756 d = get fb i 757 ok = isdig d 758 if and ok gt i a 759 if isaln get fb sub i 1 760 ok = false 761 end 762 end 763 if not ok 764 i = add i 1 765 continue 766 end 767 x = ulong 0 768 while lt i b bound `4194304` 769 d = get fb i 770 if not isdig d 771 break 772 end 773 if lt x 1000 774 x = add mul x 10 ulong sub d 48 775 end 776 i = add i 1 777 end 778 if lt x 256 779 if eq get cw x 1 780 v = add v 1 781 viol fi rp tclaim 782 if eq get quiet 0 0 783 saynum x 784 say tclaim2 785 say tnl 786 end 787 end 788 end 789 end 790 ret v 791 end 792 793 note csend: end of the sentence that contains "no case" at p, or n. 794 fn csend p ulong n ulong to ulong 795 e = add p len knoc 796 if gt e n 797 ret n 798 end 799 s = e 800 while lt s n bound `4194304` 801 c = get fb s 802 if eq c 10 803 break 804 end 805 if eq c 46 806 if lt add s 1 n 807 if eq get fb add s 1 32 808 break 809 end 810 end 811 end 812 s = add s 1 813 end 814 ret s 815 end 816 817 note csent: the sentence holding "no case" at p, from the line start or the last ". " to the next 818 note ". " or the line end; every number in it whose code a case expects is a violation. 819 fn csent fi ulong p ulong n ulong to ulong 820 q = p 821 while gt q 0 bound `4194304` 822 c = get fb sub q 1 823 if eq c 10 824 break 825 end 826 if and eq c 32 ge q 2 827 if eq get fb sub q 2 46 828 break 829 end 830 end 831 q = sub q 1 832 end 833 v = cnums fi q p p 834 s = csend p n 835 v = add v cnums fi add p len knoc s p 836 ret v 837 end 838 839 fn cnoc fi ulong n ulong to ulong 840 if eq get ckon 0 0 841 ret 0 842 end 843 kn = len knoc 844 if lt n kn 845 ret 0 846 end 847 v = ulong 0 848 for p ulong add sub n kn 1 bound `4194304` 849 if fbt p knoc 850 v = add v csent fi p n 851 end 852 end 853 ret v 854 end 855 856 note fone: the violations of file fi whose bytes are fb[0 .. k) (k from rd: below 0, missing or too big). 857 fn fone fi ulong k long to ulong 858 if eq k -2 859 viol fi NOP tbig 860 xnone 861 ret 1 862 end 863 if lt k 0 864 viol fi NOP tmiss 865 xnone 866 ret 1 867 end 868 n = ulong k 869 v = cforb fi n 870 v = add v cneed fi n 871 v = add v cpath fi n 872 v = add v cnoc fi n 873 ret v 874 end 875 876 fn clean to ulong 877 bad = ulong 0 878 for i ulong get nfl 0 bound 64 879 parl get fpo i get fpl i 880 k = rd 0 881 bad = add bad fone i k 882 put cnt 0 add get cnt 0 1 883 end 884 ret bad 885 end 886 887 note ---- mutants ---- 888 note mbeq: mb[s .. s + k) equals mt[os .. os + k). 889 fn mbeq s ulong os ulong k ulong to bool 890 for i ulong k bound 65536 891 if ne get mb add s i get mt add os i 892 ret false 893 end 894 end 895 ret true 896 end 897 898 note mlines: the number of lines of mb[0 .. n) equal to mt[os .. oe); the last one's bounds go to ml. 899 fn mlines n ulong os ulong oe ulong to ulong 900 c = ulong 0 901 s = ulong 0 902 k = sub oe os 903 while lt s n bound `4194304` 904 e = mbeol s n 905 if eq sub e s k 906 if mbeq s os k 907 c = add c 1 908 put ml 0 s 909 put ml 1 e 910 end 911 end 912 s = add e 1 913 end 914 ret c 915 end 916 917 note mbuild: fb = mb[0 .. n) with the line mb[ml0 .. ml1) replaced by mt[s0 .. s1); its length, or FBN. 918 fn mbuild n ulong s0 ulong s1 ulong to ulong 919 a = get ml 0 920 b = get ml 1 921 k = sub s1 s0 922 t = add add a k sub n b 923 if ge t FBN 924 ret FBN 925 end 926 put ml 2 n 927 mtail a b k 928 for i ulong k bound 65536 929 put fb add a i get mt add s0 i 930 end 931 ret t 932 end 933 934 note mtail: fb[0 .. a) = mb[0 .. a) and the bytes of mb from b on follow at a + k in fb. 935 fn mtail a ulong b ulong k ulong to void 936 for i ulong a bound `4194304` 937 put fb i get mb i 938 end 939 o = add a k 940 m = sub get ml 2 b 941 for i ulong m bound `4194304` 942 put fb add o i get mb add b i 943 end 944 end 945 946 fn mreport ok bool s ulong b1 ulong to void 947 if ok 948 put cnt 3 add get cnt 3 1 949 say tkill 950 else 951 say tsurv 952 end 953 saymt s sub b1 s 954 say tnl 955 end 956 957 note mut1: the mutant mt[s .. e); 1 when it is not killed. 958 fn mut1 s ulong e ulong to ulong 959 b1 = mtbar s e 960 b2 = mtbar add b1 1 e 961 b3 = mtbar add b2 1 e 962 if ge b3 e 963 say tnr 964 say tbadm 965 saymt s sub e s 966 say tnl 967 exit 3 968 end 969 pamt add b1 1 sub b2 add b1 1 970 fi = ffind 971 if eq fi 99 972 say tnr 973 say tbadm 974 saymt s sub e s 975 say tnl 976 exit 3 977 end 978 put cnt 2 add get cnt 2 1 979 os = add b2 1 980 if eq sub b3 os 1 981 if eq get mt os 42 982 v = fone fi long -1 983 mreport gt v 0 s b1 984 ret ite0 gt v 0 985 end 986 end 987 k = rd 1 988 n = ulong 0 989 c = ulong 0 990 if ge k 0 991 n = ulong k 992 c = mlines n os b3 993 end 994 if ne c 1 995 say tnf 996 saymt s sub b1 s 997 say tnl 998 ret 1 999 end 1000 t = mbuild n add b3 1 e 1001 if eq t FBN 1002 say tnf 1003 saymt s sub b1 s 1004 say tnl 1005 ret 1 1006 end 1007 v = fone fi long t 1008 mreport gt v 0 s b1 1009 ret ite0 gt v 0 1010 end 1011 1012 note ite0: 0 when the mutant was killed, else 1. 1013 fn ite0 killed bool to ulong 1014 if killed 1015 ret 0 1016 end 1017 ret 1 1018 end 1019 1020 fn muts to ulong 1021 pat tmuts 1022 k = rd 3 1023 if lt k 0 1024 notrun tnomut 1025 end 1026 n = ulong k 1027 bad = ulong 0 1028 s = ulong 0 1029 while lt s n bound 65536 1030 e = mteol s n 1031 if gt e s 1032 if ne get mt s 35 1033 bad = add bad mut1 s e 1034 end 1035 end 1036 s = add e 1 1037 end 1038 ret bad 1039 end 1040 1041 fn main to int 1042 put quiet 0 0 1043 rules 1044 bad = clean 1045 put quiet 0 1 1046 bad = add bad muts 1047 put quiet 0 0 1048 if eq bad 0 1049 say tpass 1050 saynum get cnt 0 1051 say tp1 1052 saynum get cnt 1 1053 say tp2 1054 saynum get nz 0 1055 say tp3 1056 saynum get nn 0 1057 say tp4 1058 saynum get ckon 0 1059 say tp5 1060 saynum get cnt 3 1061 say tslash 1062 saynum get cnt 2 1063 say tnl 1064 ret 0 1065 end 1066 say tfails 1067 saynum bad 1068 say tnl 1069 ret 1 1070 end