Skip to content

Commit

Permalink
Fix a bug in alternative generation
Browse files Browse the repository at this point in the history
  • Loading branch information
codelion committed Jan 7, 2017
1 parent f8b0def commit 404eb88
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/main/java/com/sourceclear/gramtest/GeneratorVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ public List<String> visitAlternative(bnfParser.AlternativeContext ctx) {
List<List<String>> comStr = new LinkedList<>();
for(bnfParser.ElementContext ec1 : ctx.element()) {
List<String> slist = visitElement(ec1);
if(slist.isEmpty()) return new LinkedList<>();
else comStr.add(slist);
if(!slist.isEmpty()) comStr.add(slist);
}
List<String> emptyStr = new LinkedList<>();
emptyStr.add("");
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/sourceclear/gramtest/MainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void testMainStrGram() throws IOException {
GeneratorVisitor extractor = new GeneratorVisitor();
extractor.visit(tree);
List<String> generatedTests = extractor.getTests();
Assert.assertEquals(100,generatedTests.size());
Assert.assertEquals(100, generatedTests.size());
}

/**
Expand Down

0 comments on commit 404eb88

Please # to comment.