all repos — min @ 41ef6b03007f894516fa6f06624da7fb848e210e

A small but practical concatenative programming language.

tests/test.min

 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
(
 (("OK")) .ok

 (
  quote .check      // save the check quotation to validate
  quote .results    // save the result symbol to update
  check dup first swap rest
  ( 
    pop
    ok results -> append quote results bind
    "." print pop
  )
  (
    pop
    check results -> append quote results bind 
    "x" print pop
  )
  ifte
 ) :assert

 (
  (
    quote .result
    result
    (ok !=)
    ("FAILED: " print pop result puts)
    ()
    ifte
  )
  map
 ) :report

) =test

#test

// Sample unit test program
(()) :maths
'maths (2 3 ==) assert
'maths (2 1 >) assert
'maths (2 1 <) assert
'maths (4 4 ==) assert
'maths (7 7 ==) assert
newline
maths report