Raymond Toy pushed to branch issue-156-take-2-nan-comparison at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • tests/nan.lisp
    ... ... @@ -34,7 +34,11 @@
    34 34
         (frob double-float <)
    
    35 35
         (frob double-float >)
    
    36 36
         (frob single-float =)
    
    37
    -    (frob double-float =)))
    
    37
    +    (frob double-float =)
    
    38
    +    (frob single-float >=)
    
    39
    +    (frob double-float >=)
    
    40
    +    (frob single-float <=)
    
    41
    +    (frob double-float <=)))
    
    38 42
     
    
    39 43
     (define-test nan-single.<
    
    40 44
         (:tag :nan)
    
    ... ... @@ -101,7 +105,10 @@
    101 105
       (ext:with-float-traps-masked (:invalid)
    
    102 106
         (assert-false (stst-<3 *single-float-nan* 2f0 3f0))
    
    103 107
         (assert-false (stst-<3 1f0 *single-float-nan* 3f0))
    
    104
    -    (assert-false (stst-<3 *single-float-nan* *single-float-nan* 3f0))))
    
    108
    +    (assert-false (stst-<3 *single-float-nan* *single-float-nan* 3f0))
    
    109
    +    (assert-false (stst-<3 1f0 2f0 *single-float-nan*))
    
    110
    +    (assert-false (stst-<3 1f0 *single-float-nan* 3f0))
    
    111
    +    (assert-false (stst-<3 1f0 *single-float-nan* *single-float-nan*))))
    
    105 112
       
    
    106 113
     (define-test nan-double.<3
    
    107 114
         (:tag :nan)
    
    ... ... @@ -120,7 +127,10 @@
    120 127
       (ext:with-float-traps-masked (:invalid)
    
    121 128
         (assert-false (dtst-<3 *double-float-nan* 2d0 3d0))
    
    122 129
         (assert-false (dtst-<3 1d0 *double-float-nan* 3d0))
    
    123
    -    (assert-false (dtst-<3 *double-float-nan* *double-float-nan* 3d0))))
    
    130
    +    (assert-false (dtst-<3 *double-float-nan* *double-float-nan* 3d0))
    
    131
    +    (assert-false (dtst-<3 1d0 2d0 *double-float-nan*))
    
    132
    +    (assert-false (dtst-<3 1d0 *double-float-nan* 3d0))
    
    133
    +    (assert-false (dtst-<3 1d0 *double-float-nan* *double-float-nan*))))
    
    124 134
       
    
    125 135
     (define-test nan-single.>3
    
    126 136
         (:tag :nan)
    
    ... ... @@ -139,7 +149,10 @@
    139 149
       (ext:with-float-traps-masked (:invalid)
    
    140 150
         (assert-false (stst->3 *single-float-nan* 2f0 3f0))
    
    141 151
         (assert-false (stst->3 1f0 *single-float-nan* 3f0))
    
    142
    -    (assert-false (stst->3 *single-float-nan* *single-float-nan* 3f0))))
    
    152
    +    (assert-false (stst->3 *single-float-nan* *single-float-nan* 3f0))
    
    153
    +    (assert-false (stst->3 1f0 2f0 *single-float-nan*))
    
    154
    +    (assert-false (stst->3 1f0 *single-float-nan* 3f0))
    
    155
    +    (assert-false (stst->3 1f0 *single-float-nan* *single-float-nan*))))
    
    143 156
       
    
    144 157
     (define-test nan-double.>3
    
    145 158
         (:tag :nan)
    
    ... ... @@ -158,7 +171,118 @@
    158 171
       (ext:with-float-traps-masked (:invalid)
    
    159 172
         (assert-false (dtst->3 *double-float-nan* 2d0 3d0))
    
    160 173
         (assert-false (dtst->3 1d0 *double-float-nan* 3d0))
    
    161
    -    (assert-false (dtst->3 *double-float-nan* *double-float-nan* 3d0))))
    
    174
    +    (assert-false (dtst->3 *double-float-nan* *double-float-nan* 3d0))
    
    175
    +    (assert-false (dtst->3 1d0 2d0 *double-float-nan*))
    
    176
    +    (assert-false (dtst->3 1d0 *double-float-nan* 3d0))
    
    177
    +    (assert-false (dtst->3 1d0 *double-float-nan* *double-float-nan*))))
    
    178
    +  
    
    179
    +(define-test nan-single.>=
    
    180
    +    (:tag :nan)
    
    181
    +  :Basic tests with regular numbers
    
    182
    +  (assert-true (stst->= 1f0 1f0))
    
    183
    +  (assert-true (stst->= 2f0 1f0))
    
    184
    +  (assert-false (stst->= 0f0 1f0))
    
    185
    +  (ext:with-float-traps-masked (:invalid)
    
    186
    +    (assert-false (stst->= 1f0 *single-float-nan*))
    
    187
    +    (assert-false (stst->= *single-float-nan* 1f0))
    
    188
    +    (assert-false (stst->= *single-float-nan* *single-float-nan*))))
    
    189
    +  
    
    190
    +(define-test nan-single.<=
    
    191
    +    (:tag :nan)
    
    192
    +  :Basic tests with regular numbers
    
    193
    +  (assert-true (stst-<= 1f0 1f0))
    
    194
    +  (assert-true (stst-<= 1f0 2f0))
    
    195
    +  (assert-false (stst-<= 2f0 1f0))
    
    196
    +  (ext:with-float-traps-masked (:invalid)
    
    197
    +    (assert-false (stst-<= 1f0 *single-float-nan*))
    
    198
    +    (assert-false (stst-<= *single-float-nan* 1f0))
    
    199
    +    (assert-false (stst-<= *single-float-nan* *single-float-nan*))))
    
    200
    +  
    
    201
    +(define-test nan-single.>=3
    
    202
    +    (:tag :nan)
    
    203
    +  :Basic tests with regular numbers
    
    204
    +  (assert-true (stst->=3 1f0 1f0 1f0))
    
    205
    +  (assert-true (stst->=3 2f0 1f0 1f0))
    
    206
    +  (assert-false (stst->=3 0f0 1f0 1f0))
    
    207
    +  (assert-false (stst->=3 2f0 0f0 1f0))
    
    208
    +  
    
    209
    +  (ext:with-float-traps-masked (:invalid)
    
    210
    +    (assert-false (stst->=3 1f0 *single-float-nan* 2f0))
    
    211
    +    (assert-false (stst->=3 *single-float-nan* 1f0 2f0))
    
    212
    +    (assert-false (stst->=3 *single-float-nan* *single-float-nan* 2f0))
    
    213
    +    (assert-false (stst->=3 2f0 1f0 *single-float-nan*))
    
    214
    +    (assert-false (stst->=3 2f0 *single-float-nan* 1f0))
    
    215
    +    (assert-false (stst->=3 2f0 *single-float-nan* *single-float-nan*))))
    
    216
    +  
    
    217
    +(define-test nan-single.<=3
    
    218
    +    (:tag :nan)
    
    219
    +  :Basic tests with regular numbers
    
    220
    +  (assert-true (stst-<=3 1f0 1f0 1f0))
    
    221
    +  (assert-true (stst-<=3 1f0 2f0 2f0))
    
    222
    +  (assert-false (stst-<=3 1f0 3f0 2f0))
    
    223
    +  (assert-false (stst-<=3 2f0 1f0 1f0))
    
    224
    +
    
    225
    +  (ext:with-float-traps-masked (:invalid)
    
    226
    +    (assert-false (stst-<=3 1f0 *single-float-nan* 2f0))
    
    227
    +    (assert-false (stst-<=3 *single-float-nan* 1f0 2f0))
    
    228
    +    (assert-false (stst-<=3 *single-float-nan* *single-float-nan* 2f0))
    
    229
    +    (assert-false (stst-<=3 1f0 2f0 *single-float-nan*))
    
    230
    +    (assert-false (stst-<=3 1f0 *single-float-nan* 1f0))
    
    231
    +    (assert-false (stst-<=3 1f0 *single-float-nan* *single-float-nan*))))
    
    232
    +  
    
    233
    +(define-test nan-double.>=
    
    234
    +    (:tag :nan)
    
    235
    +  :Basic tests with regular numbers
    
    236
    +  (assert-true (dtst->= 1f0 1f0))
    
    237
    +  (assert-true (dtst->= 2f0 1f0))
    
    238
    +  (assert-false (dtst->= 0f0 1f0))
    
    239
    +  (ext:with-float-traps-masked (:invalid)
    
    240
    +    (assert-false (dtst->= 1f0 *double-float-nan*))
    
    241
    +    (assert-false (dtst->= *double-float-nan* 1f0))
    
    242
    +    (assert-false (dtst->= *double-float-nan* *double-float-nan*))))
    
    243
    +  
    
    244
    +(define-test nan-double.<=
    
    245
    +    (:tag :nan)
    
    246
    +  :Basic tests with regular numbers
    
    247
    +  (assert-true (dtst-<= 1f0 1f0))
    
    248
    +  (assert-true (dtst-<= 1f0 2f0))
    
    249
    +  (assert-false (dtst-<= 2f0 1f0))
    
    250
    +  (ext:with-float-traps-masked (:invalid)
    
    251
    +    (assert-false (dtst-<= 1f0 *double-float-nan*))
    
    252
    +    (assert-false (dtst-<= *double-float-nan* 1f0))
    
    253
    +    (assert-false (dtst-<= *double-float-nan* *double-float-nan*))))
    
    254
    +  
    
    255
    +(define-test nan-double.>=3
    
    256
    +    (:tag :nan)
    
    257
    +  :Basic tests with regular numbers
    
    258
    +  (assert-true (dtst->=3 1d0 1d0 1d0))
    
    259
    +  (assert-true (dtst->=3 2d0 1d0 1d0))
    
    260
    +  (assert-false (dtst->=3 0d0 1d0 1d0))
    
    261
    +  (assert-false (dtst->=3 2d0 0d0 1d0))
    
    262
    +  
    
    263
    +  (ext:with-float-traps-masked (:invalid)
    
    264
    +    (assert-false (dtst->=3 1d0 *double-float-nan* 2d0))
    
    265
    +    (assert-false (dtst->=3 *double-float-nan* 1d0 2d0))
    
    266
    +    (assert-false (dtst->=3 *double-float-nan* *double-float-nan* 2d0))
    
    267
    +    (assert-false (dtst->=3 2d0 1d0 *double-float-nan*))
    
    268
    +    (assert-false (dtst->=3 2d0 *double-float-nan* 1d0))
    
    269
    +    (assert-false (dtst->=3 2d0 *double-float-nan* *double-float-nan*))))
    
    270
    +  
    
    271
    +(define-test nan-double.<=3
    
    272
    +    (:tag :nan)
    
    273
    +  :Basic tests with regular numbers
    
    274
    +  (assert-true (dtst-<=3 1d0 1d0 1d0))
    
    275
    +  (assert-true (dtst-<=3 1d0 2d0 2d0))
    
    276
    +  (assert-false (dtst-<=3 1d0 3d0 2d0))
    
    277
    +  (assert-false (dtst-<=3 2d0 1d0 1d0))
    
    278
    +
    
    279
    +  (ext:with-float-traps-masked (:invalid)
    
    280
    +    (assert-false (dtst-<=3 1d0 *double-float-nan* 2d0))
    
    281
    +    (assert-false (dtst-<=3 *double-float-nan* 1d0 2d0))
    
    282
    +    (assert-false (dtst-<=3 *double-float-nan* *double-float-nan* 2d0))
    
    283
    +    (assert-false (dtst-<=3 1d0 2d0 *double-float-nan*))
    
    284
    +    (assert-false (dtst-<=3 1d0 *double-float-nan* 1d0))
    
    285
    +    (assert-false (dtst-<=3 1d0 *double-float-nan* *double-float-nan*))))
    
    162 286
       
    
    163 287
     (define-test nan-single.=
    
    164 288
         (:tag :nan)