Commit daf855da authored by Liam Healy's avatar Liam Healy

Workaround lisp-unit error

Replace tests with 'let in them that were causing test-time compile
errors. This is apparently due to an error in lisp-unit
https://github.com/OdonataResearchLLC/lisp-unit/issues/41#issuecomment-336667648.
Workaround is to use assert-equal; as fringe benefit, this is now a
more accurate result, rather than simply being non-nil, the actual
result is checked.
parent a1ac5f20
;; Tests of physical quantities
;; Liam Healy 2011-01-09 17:38:41EST tests.lisp
;; Time-stamp: <2015-01-01 12:17:55EST physical-quantities-grid.lisp>
;; Time-stamp: <2017-10-14 17:11:21EDT physical-quantities-grid.lisp>
;; Copyright 2011, 2013, 2014, 2015 Liam M. Healy
;; Copyright 2011, 2013, 2014, 2015, 2017 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
......@@ -24,14 +24,16 @@
;;; These are all scalar units, i.e., the same units apply to each
;;; element of the array.
(lisp-unit:define-test grid-scalar-units
(lisp-unit:assert-true
(lisp-unit:assert-equal
'(1 0 0 0 0 0 0 0 0)
;; An array with pqs as elements
(let ((grid (vector (make-pq 1.0 'm) (make-pq 5.0 'm))))
(let ((grid (vector (make-pq 1.0 'm) (make-pq 5.0 'm))))
(and (arrayp grid)
(equal (grid:dimensions grid) '(2))
(check-pq (grid:aref grid 0) 1.0d0 'meter)
(check-pq (grid:aref grid 1) 5.0d0 'meter))))
(lisp-unit:assert-true
(lisp-unit:assert-equal
'(1 0 0 0 0 0 0 0 0)
;; An array with pqs as elements
(let ((grid (make-array '(2) :initial-contents (list (make-pq 1.0 'm) (make-pq 5.0 'm)))))
(and (arrayp grid)
......@@ -75,7 +77,8 @@
:initial-element #_23.0_m)
(grid:make-foreign-array 'double-float :initial-contents '(23.0d0 23.0d0 23.0d0))
'meter))
(lisp-unit:assert-true
(lisp-unit:assert-equal
'(1 0 0 0 0 0 0 0 0)
;; A physical-quantity using make-grid with :initial-contents
(let ((pq
(grid:make-grid '((grid:foreign-array 3) double-float)
......@@ -95,14 +98,16 @@
'double-float
:initial-contents '(#_6.0_m #_5.0_m #_4_m #_3.0_m/s #_2.0_m/s #_1.0_m/s))
'(3) '(0))))
(lisp-unit:assert-true
(lisp-unit:assert-equal
'(0 1 0 0 0 0 0 0 0)
;; An array with pqs as elements
(let ((grid #(#_1.0d0_m #_5.0d0_s)))
(and (arrayp grid)
(equal (grid:dimensions grid) '(2))
(check-pq (grid:aref grid 0) 1.0d0 'meter)
(check-pq (grid:aref grid 1) 5.0d0 'second))))
(lisp-unit:assert-true
(lisp-unit:assert-equal
'(0 1 0 0 0 0 0 0 0)
;; An array with pqs as elements
(let ((grid (make-array '(2) :initial-contents '(#_1.0d0_m #_5.0d0_s))))
(and (arrayp grid)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment