From 39b1c525ff22a31e84f339b20f2560126dca94f8 Mon Sep 17 00:00:00 2001 From: liam <liam@a3d8a0fb-c1db-0310-ace7-a616afeb9e30> Date: Mon, 29 Jan 2007 04:27:00 +0000 Subject: [PATCH] Make a simple test for histograms, 1D only. git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@3178 a3d8a0fb-c1db-0310-ace7-a616afeb9e30 --- gsll.asd | 4 +- histogram/updating-accessing.lisp | 61 +++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/gsll.asd b/gsll.asd index 8ad41030..ccfb3436 100644 --- a/gsll.asd +++ b/gsll.asd @@ -1,9 +1,9 @@ ;******************************************************** -; file: numerica.asd +; file: gsll.asd ; description: Definition of GSLL system ; date: ; author: Liam Healy -; modified: Mon Jan 1 2007 - 22:08 +; modified: Sun Jan 28 2007 - 22:03 ;******************************************************** ;;; $Id: $ diff --git a/histogram/updating-accessing.lisp b/histogram/updating-accessing.lisp index a6f72e80..069fd09f 100644 --- a/histogram/updating-accessing.lisp +++ b/histogram/updating-accessing.lisp @@ -4,7 +4,7 @@ ; elements. ; date: Mon Jan 1 2007 - 14:43 ; author: Liam M. Healy -; modified: Tue Jan 2 2007 - 21:52 +; modified: Sun Jan 28 2007 - 22:19 ;******************************************************** ;;; $Id: $ @@ -126,23 +126,46 @@ (set-ranges-uniform histo 0.0d0 10.0d0) histo)) -#| +(defun setup-sample-histogram () + (reset *sample-histogram*) + (increment *sample-histogram* 2.7d0) + (increment *sample-histogram* 6.9d0 2.0d0)) (lisp-unit:define-test histogram - (lisp-unit:assert-equal - )) - - -(reset *sample-histogram*) -(increment *sample-histogram* 2.7d0) -(increment *sample-histogram* 6.9d0 2.0d0) -(increment *sample-histogram* -2.0d0) -(gsl-aref *sample-histogram* 1) -(gsl-aref *sample-histogram* 2) -(gsl-aref *sample-histogram* 6) -(gsl-aref *sample-histogram* 16) ; error -(gsl-min-range *sample-histogram*) -(gsl-max-range *sample-histogram*) -(bins *sample-histogram*) -(histogram-find *sample-histogram* 5.5d0) -|# + (lisp-unit:assert-error + 'gsl-warning + (progn + (setup-sample-histogram) + (increment *sample-histogram* -2.0d0))) + (lisp-unit:assert-first-fp-equal + "0.000000000000d+01" + (progn + (setup-sample-histogram) + (gsl-aref *sample-histogram* 1))) + (lisp-unit:assert-first-fp-equal + "0.100000000000d+01" + (progn + (setup-sample-histogram) + (gsl-aref *sample-histogram* 2))) + (lisp-unit:assert-first-fp-equal + "0.200000000000d+01" + (progn + (setup-sample-histogram) + (gsl-aref *sample-histogram* 6))) + (lisp-unit:assert-error + 'gsl-error + (gsl-aref *sample-histogram* 16)) + (lisp-unit:assert-first-fp-equal + "0.000000000000d+01" + (gsl-min-range *sample-histogram*)) + (lisp-unit:assert-first-fp-equal + "0.100000000000d+02" + (gsl-max-range *sample-histogram*)) + (lisp-unit:assert-eql + 10 + (bins *sample-histogram*)) + (lisp-unit:assert-eql + 5 + (histogram-find *sample-histogram* 5.5d0))) + + -- GitLab