Permalink
Browse files

Rename isMoreGeneral to more-general? and add tests.

  • Loading branch information...
1 parent 0551e42 commit 940d1ddda79e3d60c30dead885c2d21a21df2e5f @arthurschreiber committed Apr 14, 2011
Showing with 10 additions and 2 deletions.
  1. +2 −2 lisp/version_space.lisp
  2. +8 −0 lisp/version_space_test.lisp
View
@@ -23,10 +23,10 @@
(defun includes (x y)
(OR (equal x y) (equal x "*")))
-(defun isMoreGeneral (x y)
+(defun more-general? (x y)
(cond ((and (null x)(null y)) t)
((includes (car x) (car y))
- (isMoreGeneral (cdr x)(cdr y)))))
+ (more-general? (cdr x)(cdr y)))))
; --- specialize ---
@@ -27,6 +27,14 @@
)
)
+(define-test test-more-general?
+ "should return true if the first list is equal to the second"
+ (assert-true (more-general? '("a") '("a")))
+ (assert-true (not (more-general? '("a") '("b"))))
+ "should return true if the first list is more general than the second"
+ (assert-true (more-general? '("a" "*" "c") '("a" "b" "c")))
+ (assert-true (not (more-general? '("a" "*" "c") '("a" "b" "d"))))
+)
(run-tests)

0 comments on commit 940d1dd

Please sign in to comment.