Added ior and xor tests to the repository.
[picobit.git] / tests / arithmetic / ior.scm
blob8aabae4a024e9d9169b1ef1d1477109090bffd69
1 ;; bitwise or tests
3 (define-macro (test-cond condition name) ;; TODO watch out for name capture
4   `(let ((DUMMY-x ,condition))
5      (display ,name)
6      (if DUMMY-x
7          (display " : PASSED\n")
8          (begin (display " : FAILED, got : ")
9                 (display DUMMY-x)
10                 (display "\n")))))
12 (define-macro (test-= lhs rhs name) ;; TODO watch out for name capture
13   `(let ((DUMMY-lhs ,lhs)
14          (DUMMY-rhs ,rhs))
15      (display ,name)
16      (if (= DUMMY-lhs DUMMY-rhs)
17          (display " : PASSED\n")
18          (begin (display " : FAILED, got : ")
19                 (display DUMMY-lhs)
20                 (display " and ")
21                 (display DUMMY-rhs)
22                 (display "\n")))))
24 (test-= (bitwise-ior #xf0 #x0f) #xff "#xf0 | #x0f = #xff")
25 (test-= (bitwise-ior #x30 #x00) #x30 "#x30 | #x00 = #x30")
26 (test-= (bitwise-ior #x00 #x05) #x05 "#x00 | #x05 = #x05")
27 (test-= (bitwise-ior #x08 #x05) #x0D "#x08 | #x05 = #x0D")
28 (test-= (bitwise-ior #x18 #x05) #x1D "#x18 | #x05 = #x1D")
29 (test-= (bitwise-ior #x18 #x25) #x3D "#x18 | #x25 = #x3D")
30 (test-= (bitwise-ior #x18 #x35) #x3D "#x18 | #x35 = #x3D")
31 (test-= (bitwise-ior #x1823122312 #x351234123456) 58386709362518
32         "#x1823122312 | #x351234123456 = 58386709362518")