all repos — min @ 7e67cd88c1be12ebcd1ee4bbed1d2ee68056559e

A small but practical concatenative programming language.

tests/stack.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
'min-test require :test
;;;

"stack" test.describe

  (1 2 3 4 get-stack (1 2 3 4) ==) test.assert

  ((1 2 3) set-stack get-stack (1 2 3) ==) test.assert

  (1 id 1 ==) test.assert

  (2 pop get-stack () ==) test.assert

  (1 dup get-stack (1 1) ==) test.assert

  (3 2 (1 +) dip + 6 ==) test.assert

  (1 2 nip get-stack (2) ==) test.assert

  (1 2 4 '+ dip get-stack (3 4) ==) test.assert

  (1 2 4 '+ keep get-stack (1 6 4) ==) test.assert

  ((1) (2 swap append) sip concat (1 2 1) ==) test.assert

  (1 (2 3) cons (1 2 3) ==) test.assert

  (1 2 over get-stack (1 2 1) ==) test.assert

  (1 2 3 pick get-stack (1 2 3 1) ==) test.assert

  ((1 2 3) ('sum 'size) => cleave / 2 ==) test.assert

  ((1 2) (3 4) ((0 get) (1 get)) spread get-stack (1 4) ==) test.assert

  test.report
  clear-stack