Added loose operators
This commit is contained in:
parent
717e5e0954
commit
a9bb6e0338
6 changed files with 95 additions and 47 deletions
|
@ -1,10 +1,13 @@
|
|||
package prolog.logic
|
||||
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertFalse
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Test
|
||||
import prolog.ast.terms.Atom
|
||||
import prolog.ast.terms.Functor
|
||||
import prolog.ast.terms.Structure
|
||||
import prolog.ast.arithmetic.Integer
|
||||
|
||||
/**
|
||||
* Based on [Predicates for analyzing/constructing terms](https://github.com/dtonhofer/prolog_notes/blob/master/swipl_notes/about_term_analysis_and_construction/term_analysis_construction.png)
|
||||
|
@ -19,7 +22,7 @@ class TermAnalysisConstructionTest {
|
|||
assertTrue(atomic(atom))
|
||||
assertFalse(compound(atom))
|
||||
|
||||
assertTrue(functor(atom, Atom("foo"), 0))
|
||||
assertEquals(Functor("foo", 0), atom.functor)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -37,6 +40,6 @@ class TermAnalysisConstructionTest {
|
|||
assertFalse(atomic(structure))
|
||||
assertTrue(compound(structure))
|
||||
|
||||
assertTrue(functor(structure, Atom("foo"), 1))
|
||||
assertEquals(Functor("foo", 1), structure.functor)
|
||||
}
|
||||
}
|
Reference in a new issue