Initial version of filter tests.

This commit is contained in:
Eric Dobson 2014-03-12 20:04:22 -07:00
parent d9aeabdaec
commit f7536ebfbd
2 changed files with 68 additions and 0 deletions

View File

@ -38,4 +38,5 @@
"class-tests.rkt"
"class-util-tests.rkt"
"check-below-tests.rkt"
"filter-tests.rkt"
"rep-tests.rkt")

View File

@ -0,0 +1,67 @@
#lang racket/base
(require "test-utils.rkt"
rackunit
(types abbrev union filter-ops))
(provide tests)
(gen-test-main)
(define (not-opposite? x y) (not (opposite? x y)))
(define (not-implied-atomic? x y) (not (implied-atomic? x y)))
(define tests
(test-suite "Filters"
(test-suite "Opposite"
(check opposite?
(-filter -Symbol 0)
(-not-filter (Un -Symbol -String) 0))
(check opposite?
(-not-filter -Symbol 0)
(-filter -Symbol 0))
(check not-opposite?
(-filter -Symbol 1)
(-not-filter -Symbol 0))
(check not-opposite?
(-filter -String 0)
(-not-filter -Symbol 0))
(check not-opposite?
(-not-filter -Symbol 0)
(-filter -String 0))
)
(test-suite "Implied Atomic"
(check implied-atomic?
-top -top)
(check implied-atomic?
-bot -bot)
(check not-implied-atomic?
-bot -top)
(check implied-atomic?
(-filter (Un -String -Symbol) 0)
(-filter -Symbol 0))
(check not-implied-atomic?
(-filter -Symbol 0)
(-filter (Un -String -Symbol) 0))
(check implied-atomic?
(-not-filter -Symbol 0)
(-not-filter (Un -String -Symbol) 0))
(check not-implied-atomic?
(-not-filter (Un -String -Symbol) 0)
(-not-filter -Symbol 0))
(check not-implied-atomic?
(-filter -Symbol 1)
(-filter -Symbol 0))
(check implied-atomic?
(-filter -Symbol #'x)
(-filter -Symbol #'x))
(check implied-atomic?
(-or (-filter -Symbol 1) (-filter -Symbol #'x))
(-filter -Symbol #'x))
)
))