Created
November 1, 2013 18:14
-
-
Save nickmain/7269478 to your computer and use it in GitHub Desktop.
How can a meaningful unit test be written for this CLIPS rule ? The rule is declarative - it states the preconditions that must exist and is explicit about what the post-conditions are (the asserted facts). How can a unit test add value to this and not be merely a test that CLIPS itself actually works ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defrule make-group | |
(make-graphic ?sheet ?id) | |
(dict-entry ?id Class "Group") | |
(not (dict-entry ?id isSubgraph ?)) | |
(dict-entry ?id Graphics ?array) | |
(array ?array $?graphics) | |
=> | |
(assert (group ?id)) | |
(foreach ?graphic $?graphics | |
(assert (make-graphic ?sheet ?graphic)) | |
(assert (graphic-parent ?id ?graphic)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment