Skip to content

Commit

Permalink
Updated Test for NonExistingPredicateException
Browse files Browse the repository at this point in the history
  • Loading branch information
CerielJacobs committed Aug 27, 2019
1 parent 078da26 commit 459edee
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/vlog/java/karmaresearch/vlog/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,20 @@ public static void testEmpty() throws Exception {
VLog vlog = new VLog();
vlog.setLogLevel(LogLevel.INFO);
vlog.start("", false);
try (TermQueryResultIterator e = vlog
.query(new Atom("A", new Term(Term.TermType.VARIABLE, "C")))) {
if (e.hasNext()) {
throw new Error("Error in query");
try {
try (TermQueryResultIterator e = vlog.query(
new Atom("A", new Term(Term.TermType.VARIABLE, "C")))) {
System.err.println("vlog should have thrown an exception");
}
} catch (NonExistingPredicateException e) {
// OK
}
}

static void runTest() throws Exception {
testEmpty();
VLog vlog = new VLog();
vlog.setLogLevel(LogLevel.DEBUG);
vlog.setLogLevel(LogLevel.INFO);
try {
vlog.start("blabla", false);
System.err.println("vlog.start() should have thrown an exception.");
Expand Down Expand Up @@ -94,9 +96,14 @@ static void runTest() throws Exception {
throw new Error(
"Error in query, check file 'blabla', should contain 'c,d,e'");
}
vlog.writeQueryResultsToCsv(
new Atom("p3", q1.toArray(new Term[q1.size()])), "blabla");
Files.delete(Paths.get("blabla"));
try {
vlog.writeQueryResultsToCsv(
new Atom("p3", q1.toArray(new Term[q1.size()])), "blabla");
System.err.println("vlog should have thrown an exception");
Files.delete(Paths.get("blabla"));
} catch (NonExistingPredicateException e) {
// OK
}

vlog = new VLog();
vlog.start("", false);
Expand Down Expand Up @@ -254,6 +261,7 @@ static void runTest() throws Exception {

vlog = new VLog();
vlog.start(edbConf, false);

vlog.setRules(parentRules, RuleRewriteStrategy.AGGRESSIVE);
if (!vlog.materialize(false, 100)) {
System.out.println("Timeout ... try again without ...");
Expand Down

0 comments on commit 459edee

Please sign in to comment.