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 55 56 57 58 59 60 61 |
'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 :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 :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 (ROOT 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 4 ==) *test/assert (2 {(2 3 +) :sum} /sum -> + 7 ==) *test/assert ({a :test} "test" dget-raw /str "a" ==) *test/assert ({} 'test 'aaa dset-sym {aaa :test} ==) *test/assert ( {} :archives ({"a" :a 2 :b} {"aa" :a 4 :b} {"aaa" :a 6 :b}) ( :article article /a :code {code :code} => archives swap code dset @archives ) foreach archives {{"a" :code} :a {"aa" :code} :aa {"aaa" :code} :aaa} ==) *test/assert ( {} :archives ({"a" :a 2 :b} {"aa" :a 4 :b} {"aaa" :a 6 :b}) ( :article article /a :code {} code %code :archive archives archive code dset @archives ) foreach archives {{"a" :code} :a {"aa" :code} :aa {"aaa" :code} :aaa} ==) *test/assert *test/report clear-stack |