tests.hex
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
0x0 "test-count" store 0x0 "successes" store 0x0 "failures" store () "errors" store ( "current-test" store test-count 0x1 + "test-count" store ( (current-test i) ( "." print successes 0x1 + "successes" store ) ( "x" print failures 0x1 + "failures" store ) if ) ( ; Store error errors " - Test #" test-count dec cat ": " cat error cat q cat "errors" store "x" print failures 0x1 + "failures" store ) try ) "test" store ; --- Tests (0x1 "a" store a 0x1 ==) test i ("a" free 0x1) test i ("aaa" type "string" == 0x1 type "integer" == () type "quotation" == and and) test i ((0x1 0x2 +) i 0x3 ==) test i ("0x2 0x2 -" eval 0x0 ==) test i ;5 (0x4 0x5 + 0x9 ==) test i (0x5 0x3 - 0x2 ==) test i (0x5 0x2 * 0xa ==) test i (0x5 0x2 / 0x2 ==) test i (0x4 0x2 % 0x0 ==) test i ;10 (0x10101 0x01010 & 0x0 ==) test i (0x10111 0x01000 | 0x11111 ==) test i (0x1 0x1 ^ 0x0 ==) test i (0x1 ~ 0xfffffffe ==) test i (0x1 0x4 << 0x10 ==) test i ;15 (0x10 0x4 >> 0x1 ==) test i ("10" int 0x10 ==) test i (0x10 str "10" ==) test i (0xa dec "10" ==) test i ("10" hex 0xa ==) test i ;20 ("aaa" "aaa" ==) test i (0x20 0x20 ==) test i (0x21 0x22 !=) test i ("abba" "aaa" !=) test i (0x2 0x1 >) test i ;25 (0x2 0x2 >=) test i (0x2 0x3 <) test i (0x3 0x3 <=) test i (0x2 0x3 and) test i (0x1 0x0 or) test i ;30 (0x1 0x0 xor) test i (0x1 0x1 xor not) test i ("hello" " world" cat "hello world" ==) test i ((0x1 "a") ("b") cat (0x1 "a" "b") ==) test i ((0x1 0x2 0x3) 0x1 0x2 slice (0x2 0x3) ==) test i ("hello" 0x0 0x3 slice "hell" ==) test i ; --- Report "\nSuccessful Tests: " print successes dec print "/" print successes failures + dec puts (errors len 0x0 >) ( "Errors:" warn errors (warn) each ) when ; --- Cleanup ;"a" free |