[302] | 1 | ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*-
|
---|
| 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 3 | ;;;
|
---|
| 4 | ;;; Copyright (C) 1999, 2002, 2009, 2015 Marek Rychlik <rychlik@u.arizona.edu>
|
---|
| 5 | ;;;
|
---|
| 6 | ;;; This program is free software; you can redistribute it and/or modify
|
---|
| 7 | ;;; it under the terms of the GNU General Public License as published by
|
---|
| 8 | ;;; the Free Software Foundation; either version 2 of the License, or
|
---|
| 9 | ;;; (at your option) any later version.
|
---|
| 10 | ;;;
|
---|
| 11 | ;;; This program is distributed in the hope that it will be useful,
|
---|
| 12 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | ;;; GNU General Public License for more details.
|
---|
| 15 | ;;;
|
---|
| 16 | ;;; You should have received a copy of the GNU General Public License
|
---|
| 17 | ;;; along with this program; if not, write to the Free Software
|
---|
| 18 | ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
| 19 | ;;;
|
---|
| 20 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 21 |
|
---|
[309] | 22 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 23 | ;;
|
---|
[310] | 24 | ;; Run NGROBNER package tests using 5am unit testing framework
|
---|
[309] | 25 | ;;
|
---|
| 26 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 27 |
|
---|
[286] | 28 | (load "~/quicklisp/setup")
|
---|
| 29 | (ql:quickload :fiveam)
|
---|
[301] | 30 |
|
---|
[292] | 31 | (load "ngrobner.asd")
|
---|
[291] | 32 | (asdf:load-system :ngrobner)
|
---|
[286] | 33 |
|
---|
[300] | 34 | (defpackage #:utils-tests
|
---|
[307] | 35 | (:use :cl :it.bese.fiveam :ngrobner))
|
---|
[286] | 36 |
|
---|
[300] | 37 | (in-package #:utils-tests)
|
---|
[287] | 38 |
|
---|
| 39 | (def-suite utils-suite
|
---|
[282] | 40 | :description "Utils Suite")
|
---|
[281] | 41 |
|
---|
[287] | 42 | (in-suite utils-suite)
|
---|
| 43 |
|
---|
[312] | 44 | #+nil
|
---|
[289] | 45 | (test dummy-test
|
---|
[281] | 46 | "Makelist"
|
---|
| 47 | (is (= (+ 2 2)) "2 plus 2 wasn't equal to 4 (using #'= to test equality)")
|
---|
| 48 | (is (= 0 (+ -1 1)))
|
---|
| 49 | (signals
|
---|
| 50 | (error "Trying to add 4 to FOO didn't signal an error")
|
---|
| 51 | (+ 'foo 4))
|
---|
| 52 | (is (= 0 (+ 1 1)) "this should have failed"))
|
---|
[289] | 53 |
|
---|
[293] | 54 | (test makelist-1
|
---|
[303] | 55 | "makelist-1 test"
|
---|
[308] | 56 | (is (equal (ngrobner:makelist-1 (* 2 i) i 0 10) '(0 2 4 6 8 10 12 14 16 18 20)))
|
---|
| 57 | (is (equal (ngrobner:makelist-1 (* 2 i) i 0 10 3) '(0 6 12 18))))
|
---|
[294] | 58 |
|
---|
[303] | 59 | (test makelist
|
---|
[314] | 60 | "makelist"
|
---|
[308] | 61 | (is (equal (ngrobner:makelist (+ (* i i) (* j j)) (i 1 4) (j 1 i)) '(2 5 8 10 13 18 17 20 25 32)))
|
---|
| 62 | (is (equal (ngrobner:makelist (list i j '---> (+ (* i i) (* j j))) (i 1 4) (j 1 i))
|
---|
[303] | 63 | '((1 1 ---> 2) (2 1 ---> 5) (2 2 ---> 8) (3 1 ---> 10) (3 2 ---> 13)
|
---|
| 64 | (3 3 ---> 18) (4 1 ---> 17) (4 2 ---> 20) (4 3 ---> 25) (4 4 ---> 32)))))
|
---|
[290] | 65 |
|
---|
[314] | 66 | (test monom
|
---|
| 67 | "monom"
|
---|
| 68 | (is (equalp (ngrobner::make-monom 3) #(0 0 0)))
|
---|
[315] | 69 | (is (equalp (ngrobner::make-monom 3 :initial-contents '(1 2 3)) #(1 2 3))))
|
---|
[303] | 70 |
|
---|
[289] | 71 | (run!)
|
---|