all repos — hex @ 480e85d0d088b7c1c84480f318c26247297d1471

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

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
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 str 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

; --- Report
"\nSuccessful Tests: " print successes dec print "/" print successes failures + dec puts


(errors len 0x0 >)
    (
        "Errors:" warn
        errors (warn) each
    )
when

; --- Cleanup
;"a" free