forked from ggp-org/ggp-base
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a couple of bugs in the SimpleSentenceForm. Add a regression test.
- Loading branch information
1 parent
cd0301d
commit 5c4a574
Showing
3 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.ggp.base.test; | ||
|
||
import java.util.List; | ||
|
||
import junit.framework.Assert; | ||
|
||
import org.ggp.base.util.gdl.GdlUtils; | ||
import org.ggp.base.util.gdl.factory.GdlFactory; | ||
import org.ggp.base.util.gdl.grammar.GdlPool; | ||
import org.ggp.base.util.gdl.grammar.GdlSentence; | ||
import org.ggp.base.util.gdl.grammar.GdlTerm; | ||
import org.ggp.base.util.gdl.model.SimpleSentenceForm; | ||
import org.junit.Test; | ||
|
||
public class SimpleSentenceFormTest { | ||
@Test | ||
public void testFunctionNesting() throws Exception { | ||
GdlSentence sentence = (GdlSentence) GdlFactory.create("(does player (combine foo (bar b b)))"); | ||
SimpleSentenceForm form = SimpleSentenceForm.create(sentence); | ||
Assert.assertEquals(GdlPool.DOES, form.getName()); | ||
Assert.assertEquals(4, form.getTupleSize()); | ||
Assert.assertTrue(form.matches(sentence)); | ||
|
||
List<GdlTerm> tuple = GdlUtils.getTupleFromSentence(sentence); | ||
Assert.assertEquals(sentence, | ||
form.getSentenceFromTuple(tuple)); | ||
} | ||
} |
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