-
Notifications
You must be signed in to change notification settings - Fork 1
/
2_60.test.rkt
33 lines (28 loc) · 1017 Bytes
/
2_60.test.rkt
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
#lang racket
(require rackunit/text-ui)
(require rackunit)
(require (except-in "../solutions/2_59.rkt" adjoin-set union-set))
(require "../solutions/2_60.rkt")
(define test-set '(1 2 3 x g 2 1 x))
(define test-set-2 '(y z x z x))
(define tests
(test-suite
"Test for exercise 2_59 (Sets)"
(test-case
"Element of set"
(check-true (element-of-set? 'x test-set))
(check-false (element-of-set? 'z test-set)))
(test-case
"Adjoin set"
(check-true (element-of-set? 'z (adjoin-set 'z test-set))))
(test-case
"Union set"
(define test-union-set (union-set test-set-2 test-set))
(check-true (element-of-set? 'z test-union-set))
(check-true (element-of-set? 1 test-union-set)))
(test-case
"Intersection set"
(define test-instersection-set (instersection-set test-set-2 test-set))
(check-true (element-of-set? 'x test-instersection-set))
(check-false (element-of-set? 'y test-instersection-set)))))
(run-tests tests 'verbose)