all repos — min @ d0d644faeeecdd1812927dbd61b3061ab3e81187

A small but practical concatenative programming language.

tests/logic.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
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
'min-test require :test
;;;

"logic" test.describe

  (2 3 <) test.assert
  (3 2 < false ==) test.assert
  (3 3 < false ==) test.assert
  (2.99 3 <) test.assert
  (2 1.99 < false ==) test.assert
  (1.99 1.991 <) test.assert
  (1.99 1.990 < false ==) test.assert
  ("test1" "test2" <) test.assert
  ("test3" "test2" < false ==) test.assert
  ("test2" "test2" < false ==) test.assert

  (2 3 <=) test.assert
  (3 2 <= false ==) test.assert
  (3 3 <=) test.assert
  (2.99 3 <=) test.assert
  (2 1.99 <= false ==) test.assert
  (1.99 1.991 <=) test.assert
  (1.99 1.990 <=) test.assert
  ("test1" "test2" <=) test.assert
  ("test3" "test2" <= false ==) test.assert
  ("test2" "test2" <=) test.assert


  (2 3 > false ==) test.assert
  (3 2 >) test.assert
  (3 3 > false ==) test.assert
  (2.99 3 > false ==) test.assert
  (2 1.99 >) test.assert
  (1.99 1.991 > false ==) test.assert
  (1.99 1.990 > false ==) test.assert
  ("test1" "test2" > false ==) test.assert
  ("test3" "test2" >) test.assert
  ("test2" "test2" > false ==) test.assert

  (2 3 >= false ==) test.assert
  (3 2 >=) test.assert
  (3 3 >=) test.assert
  (2.99 3 >= false ==) test.assert
  (2 1.99 >=) test.assert
  (1.99 1.991 >= false ==) test.assert
  (1.99 1.990 >=) test.assert
  ("test1" "test2" >= false ==) test.assert
  ("test3" "test2" >=) test.assert
  ("test2" "test2" >=) test.assert

  (true true ==) test.assert
  (false true == false ==) test.assert
  (true false == false ==) test.assert
  (false false ==) test.assert
  (1 1 ==) test.assert
  ("aaa" "aaa" ==) test.assert
  (1.0 1 ==) test.assert
  ((1 2 3.0) (1.0 2 3) ==) test.assert
  (("a" "b") ("a" "b") ==) test.assert
  (("a" "b" 3) ("a" "b" 4) == false ==) test.assert
  ((1 "b" 3 myrandomsymbol) (1 "b" 3.0 myrandomsymbol) ==) test.assert

  (true true != false ==) test.assert
  (false true !=) test.assert
  (true false !=) test.assert
  (false false != false ==) test.assert
  (1 1 != false ==) test.assert
  ("aaa" "aaa" != false ==) test.assert
  ;;(1.0 1 != false ==) *test/assert
  ;;((1 2 3.0) (1.0 2.0 3) != false ==) *test/assert
  ;;(("a" "b") ("a" "b") != false ==) *test/assert
  (("a" "b" 3) ("a" "b" 4) !=) test.assert
  ((1 "b" 3 myrandomsymbol) (1 "b" 3.0 myrandomsymbol) != false ==) test.assert

  (false not) test.assert
  (true not false ==) test.assert

  (true true and) test.assert
  (true false and false ==) test.assert
  (false true and false ==) test.assert
  (false false and false ==) test.assert

  (true true or) test.assert
  (true false or) test.assert
  (false true or) test.assert
  (false false or false ==) test.assert

  (true true xor false ==) test.assert
  (true false xor) test.assert
  (false true xor) test.assert
  (false false xor false ==) test.assert

  ("a" string?) test.assert
  (1 string? false ==) test.assert
  (1.0 string? false ==) test.assert
  (true string? false ==) test.assert
  (false string? false ==) test.assert
  (("a" 2 c) string? false ==) test.assert

  ("a" integer? false ==) test.assert
  (1 integer?) test.assert
  (1.0 integer? false ==) test.assert
  (true integer? false ==) test.assert
  (false integer? false ==) test.assert
  (("a" 2 c) integer? false ==) test.assert

  ("a" float? false ==) test.assert
  (1 float? false ==) test.assert
  (1.0 float?) test.assert
  (true float? false ==) test.assert
  (false float? false ==) test.assert
  (("a" 2 c) float? false ==) test.assert

  ("a" boolean? false ==) test.assert
  (1 boolean? false ==) test.assert
  (1.0 boolean? false ==) test.assert
  (true boolean?) test.assert
  (false boolean?) test.assert
  (("a" 2 c) boolean? false ==) test.assert

  ("a" number? false ==) test.assert
  (1 number?) test.assert
  (1.0 number?) test.assert
  (true number? false ==) test.assert
  (false number? false ==) test.assert
  (("a" 2 c) number? false ==) test.assert

  ("a" quotation? false ==) test.assert
  (1 quotation? false ==) test.assert
  (1.0 quotation? false ==) test.assert
  (true quotation? false ==) test.assert
  (false quotation? false ==) test.assert
  (("a" 2 c) quotation?) test.assert

  ("a" stringlike?) test.assert
  (1 stringlike? false ==) test.assert
  ('test stringlike?) test.assert

  (("a") quoted-symbol? not) test.assert
  ('test quoted-symbol?) test.assert
  ((aaa bbb) quoted-symbol? not) test.assert

  ({} 'dict:module type? false ==) test.assert
  ((1 2 3) 'dict:module type? false ==) test.assert
  (4 'dict:module type? false ==) test.assert
  (logic 'dict:module type?) test.assert
  (1 "int" type?) test.assert
  ("test" "str" type?) test.assert
  (global "dict:module" type?) test.assert

  (7 0 / inf ==) test.assert
  (-7 0 / -inf ==) test.assert
  (0 0 / nan ==) test.assert
  (10 3 / 3.33333 ==) test.assert

  (3 "a" == not) test.assert
  (1 () != true) test.assert
  (3.3 'test == not) test.assert

  (
    (
      (true)
      (2 1 >)
      ("a" "b" ==)
      ("never printed" puts!)
    ) &&
    false ==
  ) test.assert
  
  (
    (
      (false)
      (2 1 <)
      ("a" "a" ==)
      ("never printed" puts!)
    ) ||
  ) test.assert
  
  test.report
  clear-stack