-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsvg-tst.lisp
56 lines (48 loc) · 2.14 KB
/
svg-tst.lisp
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
(include-book "testing" :dir :teachpacks)
(include-book "doublecheck" :dir :teachpacks)
(include-book "svg")
; Semicolon Tests
(check-expect (semicolon) #\;)
(check-expect t (stringp (semicolon)))
;oppositePoint Tests
(check-expect (oppositePoint (point 0 5 nil) (point -3 1 nil)
(point 3 1 nil)) (point 0 1 nil))
(check-expect (oppositePoint (point 3 4 nil) (point -3 1 nil)
(point 3 1 nil)) (point 3 1 nil))
(check-expect (oppositePoint (point 0 3 nil)
(point -3 -1 nil) (point 0 0 nil)) (POINT 9/10 3/10 NIL))
(check-expect (oppositePoint (point 0 3 nil) (point -3 -1 nil)
(point 3 6 nil)) (POINT 21/85 237/85 NIL))
; appendStrings tests
(check-expect (appendStrings '("hello " "world")) "hello world")
(check-expect (appendStrings '(" " "")) " ")
(check-expect (appendStrings '("a" "b" "c" "d" "e")) "abcde")
(check-expect (appendStrings '("hello")) "hello")
; minXY tests
(check-expect (minXY (list (point 3 3 nil) (point -3 5 nil) (point 4 0 nil)))
(point -3 0 NIL))
(check-expect (minXY (list (point 3 2 nil) (point 3 5 nil) (point 4 2 nil)))
(POINT 3 2 NIL))
(check-expect (minXY (list (point 0 0 nil) (point 3 5 nil) (point 4 2 nil)))
(POINT 0 0 NIL))
(check-expect (minXY (list (point 3 3 nil) (point -3 5 nil) (point 4 0 nil)))
(point -3 0 NIL))
; color->str tests
(check-expect "255,255,255" (color->str '(255 255 255)))
(check-expect "0,0,0" (color->str '(0 0 0) ))
(check-expect "255,134,0" (color->str '(255 134 0) ))
(check-expect "0,23,54" (color->str '(0 23 54) ))
(defproperty color->str-returns-a-string
(c1 :value (random-integer)
c2 :value (random-integer)
c3 :value (random-integer))
(equal (stringp (color->str `(c1 c2 c3))) t))
; svgGradient
(defproperty svgGradient-always-returns-string
(x1 :value (random-integer)
y1 :value (random-integer)
x2 :value (random-integer)
y2 :value (random-integer))
(let* ((p1 (point x1 y1 nil))
(p2 (point x2 y2 nil)))
(equal t (stringp (svgGradient p1 p2 "a" "233,444,222")))))