Permalink
Browse files

Add gen-list and gen-version-space + tests.

  • Loading branch information...
1 parent cabb7ad commit 2409c00986419475d08a99c06c4b7c26d37b054f @arthurschreiber committed Apr 14, 2011
Showing with 30 additions and 0 deletions.
  1. +19 −0 lisp/version_space.lisp
  2. +11 −0 lisp/version_space_test.lisp
View
@@ -59,6 +59,25 @@
) (get-potential-positions g neg s))
)
+;; Generiert eine neue Liste, in der `item` `size` mal vorkommt.
+(defun gen-list (item size)
+ (if (<= size 0)
+ '()
+ (cons
+ item
+ (gen-list item (- size 1))
+ )
+ )
+)
+
+;; Generiert einen neuen, leeren Versionsraum
+(defun gen-version-space (size)
+ (list
+ (list (gen-list "*" size))
+ (list (gen-list "_" size))
+ )
+)
+
; --- how to read an exampleset from a file:
; --- helper / makes the result more readable in case there are "nil" entries
@@ -60,5 +60,16 @@
)
)
+(define-test test-gen-list
+ "should return a list containing the passed `item` `size` times"
+ (assert-equal '("*" "*" "*") (gen-list "*" 3) )
+)
+
+(define-test test-gen-version-space
+ "should create a new version space of the specified `size`"
+ (assert-equal '((("*" "*" "*")) (("_" "_" "_")))
+ (gen-version-space 3)
+ )
+)
(run-tests)

0 comments on commit 2409c00

Please sign in to comment.