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.
Merge pull request ggp-org#33 from ggp-org/simple-sentence-form-fixes
Simple sentence form fixes
- Loading branch information
Showing
5 changed files
with
44 additions
and
9 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
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