Add a bunch of unit tests for open-Values.
original commit: 8e63b65fa23b9190a74a282e7c7406186262defa
This commit is contained in:
parent
cdb16d29e7
commit
c709f11b9b
|
@ -2,9 +2,9 @@
|
|||
|
||||
(require "test-utils.rkt"
|
||||
rackunit racket/format
|
||||
(typecheck tc-metafunctions tc-subst)
|
||||
(rep filter-rep type-rep object-rep)
|
||||
(types abbrev union filter-ops tc-result)
|
||||
(typecheck tc-metafunctions)
|
||||
(rep object-rep)
|
||||
(for-syntax racket/base syntax/parse))
|
||||
|
||||
(provide tests)
|
||||
|
@ -39,7 +39,6 @@
|
|||
(list (-or (-filter -String #'y) (-filter -String #'x))
|
||||
(-filter (Un -String -Symbol) #'y) (-filter (Un -String -Symbol) #'x))
|
||||
#t)
|
||||
|
||||
)
|
||||
|
||||
(test-suite "merge-tc-results"
|
||||
|
@ -70,7 +69,68 @@
|
|||
(check-equal?
|
||||
(merge-tc-results (list (ret null null null -Symbol 'x) (ret null null null -String 'x)))
|
||||
(ret null null null (Un -Symbol -String) 'x))
|
||||
)
|
||||
|
||||
|
||||
(test-suite "open-Values"
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result -Symbol))) (list -empty-obj) (list Univ))
|
||||
(ret -Symbol))
|
||||
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result -Symbol) (-result -String)))
|
||||
(list -empty-obj -empty-obj) (list Univ Univ))
|
||||
(ret (list -Symbol -String)))
|
||||
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result -Symbol (-FS -top -bot)))) (list -empty-obj) (list Univ))
|
||||
(ret -Symbol (-FS -top -bot)))
|
||||
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result -Symbol (-FS -top -bot) (make-Path null '(0 0)))))
|
||||
(list -empty-obj) (list Univ))
|
||||
(ret -Symbol (-FS -top -bot)))
|
||||
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result (-opt -Symbol) (-FS (-filter -String '(0 0)) -top))))
|
||||
(list -empty-obj) (list Univ))
|
||||
(ret (-opt -Symbol) -top-filter))
|
||||
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result (-opt -Symbol) (-FS (-not-filter -String '(0 0)) -top))))
|
||||
(list -empty-obj) (list Univ))
|
||||
(ret (-opt -Symbol) -top-filter))
|
||||
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result (-opt -Symbol) (-FS (-imp (-not-filter (-val #f) '(0 0))
|
||||
(-not-filter -String #'x))
|
||||
-top))))
|
||||
(list -empty-obj) (list Univ))
|
||||
(ret (-opt -Symbol) -top-filter))
|
||||
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result (-opt -Symbol) (-FS (-not-filter -String '(0 0)) -top)
|
||||
(make-Path null '(0 0)))))
|
||||
(list (make-Path null #'x)) (list Univ))
|
||||
(ret (-opt -Symbol) (-FS (-not-filter -String #'x) -top) (make-Path null #'x)))
|
||||
|
||||
;; Check additional filters
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result (-opt -Symbol) (-FS (-not-filter -String '(0 0)) -top)
|
||||
(make-Path null '(0 0)))))
|
||||
(list (make-Path null #'x)) (list -String))
|
||||
(ret (-opt -Symbol) -false-filter (make-Path null #'x)))
|
||||
|
||||
;; Substitute into ranges correctly
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result (-opt (-> Univ -Boolean : (-FS (-filter -Symbol '(0 0)) -top))))))
|
||||
(list (make-Path null #'x)) (list Univ))
|
||||
(ret (-opt (-> Univ -Boolean : (-FS (-filter -Symbol '(0 0)) -top)))))
|
||||
|
||||
(check-equal?
|
||||
(open-Values (make-Values (list (-result (-opt (-> Univ -Boolean : (-FS (-filter -Symbol '(1 0)) -top))))))
|
||||
(list (make-Path null #'x)) (list Univ))
|
||||
(ret (-opt (-> Univ -Boolean : (-FS (-filter -Symbol #'x) -top)))))
|
||||
|
||||
)
|
||||
))
|
||||
|
|
Loading…
Reference in New Issue
Block a user