;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This file is part of AIslash. ; ; AIslash is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; AIslash is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with AIslash. If not, see . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftest test-make-numeric () (check (samep (make-numeric) "#S(NUMERIC :POS NIL :NAME NIL :IGNOREP NIL :CLASSP NIL :ALL NIL :BEST 0.2 :BEST-NUM NIL :BINS 10 :MAX -536870911 :MIN 536870911 :SUM 0 :SUMSQ 0 :N 0)"))) (deftest test-unknownp () (check (not (unknownp 3)) (unknownp #\?))) (deftest test-list2headers () (check (samep (list2headers '(name age *shoesize)) "(#S(DISCRETE :POS 0 :NAME NAME :IGNOREP NIL :CLASSP NIL :XINDEX #S(XINDEX :UNIQUES NIL :COUNTS NIL :LOCATION NIL) :UNIQUES NIL :CARDINALITY NIL :RANKS NIL) #S(DISCRETE :POS 1 :NAME AGE :IGNOREP NIL :CLASSP NIL :XINDEX #S(XINDEX :UNIQUES NIL :COUNTS NIL :LOCATION NIL) :UNIQUES NIL :CARDINALITY NIL :RANKS NIL) #S(NUMERIC :POS 2 :NAME *SHOESIZE :IGNOREP NIL :CLASSP T :ALL NIL :BEST 0.2 :BEST-NUM NIL :BINS 10 :MAX -536870911 :MIN 536870911 :SUM 0 :SUMSQ 0 :N 0))"))) (deftest test-folds () (reset-seed) (let* ((data '((a a 1) (b b 2) (c c 30) (d d 1) (e e 5) (f f 9) (g g 70) (h h 8) (i i 9) (j j 10) (k k 9))) (data1 (sort-ish data)) (folds (folds data1 3))) (check (equal data1 '((A A 1) (D D 1) (B B 2) (E E 5) (H H 8) (I I 9) (F F 9) (K K 9) (J J 10) (C C 30) (G G 70))) (samep folds "(#S(FOLD :INDEX 2 :TRAIN ((G G 70) (C C 30) (K K 9) (F F 9) (H H 8) (E E 5) (A A 1) (D D 1)) :TEST ((J J 10) (I I 9) (B B 2))) #S(FOLD :INDEX 1 :TRAIN ((C C 30) (J J 10) (F F 9) (I I 9) (E E 5) (B B 2) (D D 1)) :TEST ((G G 70) (K K 9) (H H 8) (A A 1))) #S(FOLD :INDEX 0 :TRAIN ((G G 70) (J J 10) (K K 9) (I I 9) (H H 8) (B B 2) (A A 1)) :TEST ((C C 30) (F F 9) (E E 5) (D D 1))))")))) (defun tab-data0 () '((a *d) (a 1) (a 2) (b 2))) (defun tab-data1 () '((a b c *d) (a c 20 2) (a b 30 2) (b a 40 2) (a b 10 4) (b a 50 4))) (deftest test-data0 () (data (tab-data0))) (deftest test-data1 () (data (tab-data1)))