all repos — min @ a82d0c84bcb1727bccc1f0ab1a252d7762d1d028

A small but practical concatenative programming language.

tests/dict.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
 46
 47
 48
 49
 50
 51
 52
 53
 54
'min-test require :test 
;;;

"dict" test.describe

  ((("a" 1)("b" 2)("c" 3)) dictionary? not) test.assert

  ({1 :a 2 :b 3 :c} dictionary?) test.assert

  ({1 :a 2 :b 3 :c} 'b dget 2 ==) test.assert

  ({1 :a 2 :b 3 :c} :dict1 dict1 5 'b dset 7 "d" dset :newdict newdict {1 :a 5 :b 3 :c 7 :d} ==  dict1 newdict != and) test.assert

  ({1 :a 2 :b 3 :c} :dict1 dict1 ddup 5 'b dset 7 "d" dset :newdict newdict {1 :a 5 :b 3 :c 7 :d} ==  dict1 {1 :a 2 :b 3 :c} == and) test.assert

  ({1 :a 2 :b 3 :c} :dict1 dict1 'b ddel {1 :a 3 :c} ==) test.assert

  ({1 :a 2 :b 3 :c} dkeys ("a" "b" "c") ==) test.assert

  ({1 :a 2 :b 3 :c} dvalues (1 2 3) ==) test.assert

  (global dtype "module" ==) test.assert
  
  ({} dtype "" ==) test.assert 

  ({1 :a 2 :b 3 :c 4 :d} ("b" "c") dpick {2 :b 3 :c} ==) test.assert

  (2 2 {+ :plus} "plus" dget 4 ==) test.assert

  (2 {(2 3 +) :sum} "sum" dget -> + 7 ==) test.assert

  ({a :test} "test" dget-raw "str" dget "a" ==) test.assert

  ({} 'aaa 'test dset-sym {aaa :test} ==) test.assert

  (
    {} :archives
    ({"a" :a 2 :b} {"aa" :a 4 :b} {"aaa" :a 6 :b})
    (
      :article
      article "a" dget :code
      {}
      code "code" dset
      :archive
      archives archive code dset @archives 
    ) foreach
    archives {{"a" :code} :a {"aa" :code} :aa {"aaa" :code} :aaa} ==) test.assert

  (
    {1 :a 2 :b 3 :c} dpairs ((1 "a") (2 "b") (3 "c")) ==
  ) test.assert

  test.report
  stack.clear