1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- (use-modules
- ;; SRFI 64: unit tests
- (srfi srfi-64)
- ((bitboard-model) #:prefix bbm:))
- (test-begin "bitboard-model-test")
- (test-group
- "create-bb"
- ;; failure cases
- (test-error "bits-must-be-integer-test"
- 'invalid-bitboard-creation
- (bbm:create-bb "1000100010001000" 4 4 'unspecified))
- (test-error "bits-must-be-positive-integer-test"
- 'invalid-bitboard-creation
- (bbm:create-bb #b-1000100010001000 4 4 'unspecified))
- (test-error "height-must-be-integer"
- 'invalid-bitboard-creation
- (bbm:create-bb #b1000100010001000 "4" 4 'unspecified))
- (test-error "height-must-be-positive-integer"
- 'invalid-bitboard-creation
- (bbm:create-bb #b1000100010001000 -4 4 'unspecified))
- (test-error "width-must-be-integer"
- 'invalid-bitboard-creation
- (bbm:create-bb #b1000100010001000 4 "4" 'unspecified))
- (test-error "width-must-be-positive-integer"
- 'invalid-bitboard-creation
- (bbm:create-bb #b1000100010001000 4 -4 'unspecified))
- (test-error "kind-must-be-symbol"
- 'invalid-bitboard-creation
- (bbm:create-bb #b1000100010001000 4 4 "unspecified"))
- (test-error "bit-integer-must-be-lower-than-maximum-for-number-of-bits"
- 'invalid-bitboard-creation
- (bbm:create-bb #b11000100010001000 4 4 'unspecified))
- (test-assert "can-create-bitboard-using-create-bb"
- (let ([test-bb (bbm:create-bb #b1000100010001000 4 4 'unspecified)])
- (and
- (= (bbm:bb-bits test-bb) #b1000100010001000)
- (= (bbm:bb-height test-bb) 4)
- (= (bbm:bb-width test-bb) 4)
- (eq? (bbm:bb-kind test-bb) 'unspecified)))))
- ;; (test-group
- ;; "create-uniform-bb"
- ;; )
- (test-end "bitboard-model-test")
|