repos
/
qt.tests
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
Test operator functions
Annotate for file src/operators.lisp
2009-04-12 tobias
1
(in-package :qt.tests)
19:51:20 '
2
'
3
(5am:in-suite :qt.suite)
'
4
'
5
(5am:test cxx-equality
'
6
"Test cxx:= cxx:/="
'
7
(5am:is (eq t (cxx:= (make-instance 'qt:point))))
'
8
(5am:is (eq t (cxx:= (make-instance 'qt:point)
'
9
(make-instance 'qt:point))))
'
10
(5am:is (eq t (cxx:= (make-instance 'qt:point)
'
11
(make-instance 'qt:point)
'
12
(make-instance 'qt:point))))
'
13
(5am:for-all ((x1 (5am:gen-integer))
'
14
(x2 (5am:gen-integer))
'
15
(y1 (5am:gen-integer))
'
16
(y2 (5am:gen-integer)))
'
17
(let ((p1 (make-instance 'qt:point :args (list x1 y1)))
'
18
(p2 (make-instance 'qt:point :args (list x2 y2))))
'
19
(5am:is (eq (and (= x1 x2)
'
20
(= y1 y2))
'
21
(cxx:= p1 p2)))
'
22
(5am:is (eq (or (/= x1 x2)
'
23
(/= y1 y2))
'
24
(cxx:/= p1 p2))))))
'
25
'
26
(5am:test (cxx-+ :depends-on cxx-equality)
'
27
"Test cxx:+"
'
28
(5am:for-all ((x1 (5am:gen-integer))
'
29
(x2 (5am:gen-integer))
'
30
(y1 (5am:gen-integer))
'
31
(y2 (5am:gen-integer)))
'
32
(let ((p1 (make-instance 'qt:point :args (list x1 y1)))
'
33
(p2 (make-instance 'qt:point :args (list x2 y2))))
'
34
(5am:is (eq t (cxx:= (cxx:+ p1 p2)
'
35
(make-instance 'qt:point :args (list
'
36
(+ x1 x2)
'
37
(+ y1 y2)))))))))
'
38
'
39
'
40
(5am:test (cxx-decf :depends-on cxx-equality)
'
41
"Test cxx:decf"
'
42
(5am:for-all ((x1 (5am:gen-integer))
'
43
(x2 (5am:gen-integer))
'
44
(y1 (5am:gen-integer))
'
45
(y2 (5am:gen-integer)))
'
46
(let ((p1 (make-instance 'qt:point :args (list x1 y1)))
'
47
(p2 (make-instance 'qt:point :args (list x2 y2))))
'
48
(cxx:decf p1 p2)
'
49
(5am:is (eq t (cxx:= p1
'
50
(make-instance 'qt:point :args (list
'
51
(- x1 x2)
'
52
(- y1 y2)))))))))
'
53
'
54
(5am:test (cxx-<=)
'
55
"Test cxx:<="
'
56
(let ((p1 (make-instance 'qt:byte-array :args '("")))
'
57
(p2 (make-instance 'qt:byte-array :args '("a")))
'
58
(p3 (make-instance 'qt:byte-array :args '("b"))))
'
59
(5am:is (eq t (cxx:<= p1 p2 p3)))
'
60
(5am:is (eq t (cxx:<= p1 p2 p2 p3)))
'
61
(5am:is (eq nil (cxx:<= p2 p1)))
'
62
(5am:is (eq nil (cxx:<= p1 p2 p1)))))
'
63
'
64
(5am:test cxx-aref
'
65
"Test cxx-aref"
'
66
(let ((byte-array (make-instance 'qt:byte-array :args '("foobar"))))
'
67
(5am:is (eq #\b (cxx:aref byte-array 3)))
'
68
(5am:is (eq #\B
'
69
(setf (cxx:aref byte-array 3)
'
70
#\B)))
'
71
(5am:is (eq #\B (cxx:aref byte-array 3)))))