-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
112 additions
and
12 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
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
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
34 changes: 34 additions & 0 deletions
34
...s/solver/solver-smtlib/src/test/java/hu/bme/mit/theta/solver/smtlib/SmtLibParserTest.java
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,34 @@ | ||
package hu.bme.mit.theta.solver.smtlib; | ||
|
||
import hu.bme.mit.theta.solver.smtlib.dsl.gen.SMTLIBv2Lexer; | ||
import hu.bme.mit.theta.solver.smtlib.dsl.gen.SMTLIBv2Parser; | ||
import hu.bme.mit.theta.solver.smtlib.solver.parser.GeneralResponse; | ||
import hu.bme.mit.theta.solver.smtlib.solver.parser.ThrowExceptionErrorListener; | ||
import org.antlr.v4.runtime.CharStreams; | ||
import org.antlr.v4.runtime.CommonTokenStream; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class SmtLibParserTest { | ||
@Test | ||
public void ambiguousParsingTest() { | ||
|
||
final var response = "(\n)"; | ||
|
||
final var lexer = new SMTLIBv2Lexer(CharStreams.fromString(response)); | ||
final var parser = new SMTLIBv2Parser(new CommonTokenStream(lexer)); | ||
lexer.removeErrorListeners(); | ||
lexer.addErrorListener(new ThrowExceptionErrorListener()); | ||
parser.removeErrorListeners(); | ||
parser.addErrorListener(new ThrowExceptionErrorListener()); | ||
|
||
var general = GeneralResponse.fromContext(parser.response()); | ||
Assert.assertTrue(general.isSpecific()); | ||
|
||
Assert.assertTrue(general.asSpecific().isGetUnsatCoreResponse()); | ||
Assert.assertEquals(0, general.asSpecific().asGetUnsatCoreResponse().getLabels().size()); | ||
|
||
Assert.assertTrue(general.asSpecific().isGetModelResponse()); | ||
Assert.assertEquals(0, general.asSpecific().asGetModelResponse().getModel().size()); | ||
} | ||
} |