Package hampi.grammars

Examples of hampi.grammars.Grammar


    assertTrue(solve.isSatisfiable());
    System.out.println(solve);
  }

  public void testGrammarBound8_comment() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 21;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", bound, false);
    Set<Character> alpha = boundedRegexp.getUsedCharacters();
    Hampi h = new Hampi();
View Full Code Here


    assertTrue(solve.isSatisfiable());
    System.out.println(solve);
  }

  public void testGrammarBound9() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 40;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "SelectStmt", bound, false);
    Set<Character> alpha = boundedRegexp.getUsedCharacters();
    Hampi h = new Hampi();
View Full Code Here

   * VAR=1' WHERE '1'='1'-- (length 18 chars)<br>
   * <br>
   * NOTE: out of memory
   */
  public void testGrammarBound10() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 30;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", bound, false);

    assertTrue(boundedRegexp.matches("UPDATE m SET n='1' WHERE '1'='1'--', D='1'"));//make sure the intended solution works
View Full Code Here

   * VAR=1' WHERE '1'='1'-- (length 18 chars)<br>
   * <br>
   * NOTE: way out of memory
   */
  public void testGrammarBound11() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 110; //at least
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", bound, false);

    assertTrue(boundedRegexp
View Full Code Here

   * Comment, Deleted FROM MembersMain WHERE MemberID='1' OR '1'='1'<br>
   * <br>
   * VAR = 1' OR '1'='1<br>
   */
  public void testGrammarBound12() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 110; //at least
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", bound, false);

    assertTrue(boundedRegexp
View Full Code Here

   * Query = SELECT M FROM m WHERE d='1' OR '1'='1' (25 tokens)<br>
   * <br>
   * VAR = 1' OR '1'='1 (length 12 chars)<br>
   */
  public void testGrammarBound12_small() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 25;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "SelectStmt", bound, false);

    assertTrue(boundedRegexp.matches("SELECT M FROM m WHERE d='1' OR '1'='1'"));//make sure the intended solution works
View Full Code Here

   *Intended solution:
   * Query = UPDATE MembersMain SET Vacation = 'x' WHERE '1'='1'--' WHERE Name = '1' (length 56 tokens)
   * VAR = x' WHERE '1'='1'-- (length 18 chars)
   */
  public void testGrammarBound13() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 56;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "SelectStmt", bound, false);

    assertTrue(boundedRegexp.matches("SELECT M FROM m WHERE d='1' OR '1'='1'"));//make sure the intended solution works
View Full Code Here

TOP

Related Classes of hampi.grammars.Grammar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.