Commit 324adf11 authored by Mirko Vukovic's avatar Mirko Vukovic
Browse files

Improved robustness of lisp-unit:numerical-equal

Substituted grid:copy-to with grid:copy ... :grid-type 'array

The method copies a foreign array to a native array and passes the
contents to lisp-unit:numerical-equal.

If grid default array type is set to foreign array this will lead to
an infinite loop
parent d0f60ec2
;; Additional methods for lisp-unit
;; Liam Healy 2009-04-15 23:23:30EDT augment.lisp
;; Time-stamp: <2014-02-15 18:40:50EST augment.lisp>
;; Time-stamp: <2017-01-03 16:52:08Eastern Standard Time augment.lisp>
;; Copyright 2009, 2011, 2014 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -24,7 +24,8 @@
((result1 grid:foreign-array) (result2 grid:foreign-array) &key (test #'lisp-unit:number-equal))
"Return true if the arrays are numerically equal according to :TEST."
(when (equal (grid:dimensions result1) (grid:dimensions result2))
(lisp-unit:numerical-equal (grid:copy-to result1) (grid:copy-to result2)
(lisp-unit:numerical-equal (grid:copy result1 :grid-type 'array)
(grid:copy result2 :grid-type 'array)
:test test)))
;;; See cdf/test.c, specfunc/test_sf.h
Supports Markdown
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