Package org.codehaus.jparsec.error

Examples of org.codehaus.jparsec.error.Location


  @Test
  public void testLookup_firstCharInSecondLine() {
    DefaultSourceLocator locator = new DefaultSourceLocator("whatever", 2, 3);
    addLineBreaks(locator, 3, 5, 7);
    assertEquals(new Location(3, 1), locator.lookup(4));
  }
View Full Code Here


  @Test
  public void testLookup_lastCharInSecondLine() {
    DefaultSourceLocator locator = new DefaultSourceLocator("whatever", 2, 3);
    addLineBreaks(locator, 3, 5, 7);
    assertEquals(new Location(3, 2), locator.lookup(5));
  }
View Full Code Here

  @Test
  public void testLookup_firstCharInThirdLine() {
    DefaultSourceLocator locator = new DefaultSourceLocator("whatever", 2, 3);
    addLineBreaks(locator, 3, 5, 7);
    assertEquals(new Location(4, 1), locator.lookup(6));
  }
View Full Code Here

  @Test
  public void testLookup_lastCharInThirdLine() {
    DefaultSourceLocator locator = new DefaultSourceLocator("whatever", 2, 3);
    addLineBreaks(locator, 3, 5, 7);
    assertEquals(new Location(4, 2), locator.lookup(7));
  }
View Full Code Here

  @Test
  public void testLookup_firstCharInLastLine() {
    DefaultSourceLocator locator = new DefaultSourceLocator("whatever", 2, 3);
    addLineBreaks(locator, 3, 5, 7);
    assertEquals(new Location(5, 1), locator.lookup(8));
  }
View Full Code Here

  @Test
  public void testLookup_secondCharInLastLine() {
    DefaultSourceLocator locator = new DefaultSourceLocator("whatever", 2, 3);
    addLineBreaks(locator, 3, 5, 7);
    assertEquals(new Location(5, 2), locator.lookup(9));
  }
View Full Code Here

  }

  @Test
  public void testScanTo_indexOnEof() {
    DefaultSourceLocator locator = new DefaultSourceLocator("foo", 2, 3);
    assertEquals(new Location(2, 6), locator.scanTo(3));
    assertEquals(3, locator.nextIndex);
    assertEquals(3, locator.nextColumnIndex);
  }
View Full Code Here

  }

  @Test
  public void testScanTo_spansLines() {
    DefaultSourceLocator locator = new DefaultSourceLocator("foo\nbar\n", 2, 3);
    assertEquals(new Location(3, 1), locator.scanTo(4));
    assertEquals(5, locator.nextIndex);
    assertEquals(1, locator.nextColumnIndex);
  }
View Full Code Here

  }

  @Test
  public void testScanTo_lastCharOfLine() {
    DefaultSourceLocator locator = new DefaultSourceLocator("foo\nbar\n", 2, 3);
    assertEquals(new Location(3, 4), locator.scanTo(7));
    assertEquals(8, locator.nextIndex);
    assertEquals(0, locator.nextColumnIndex);
  }
View Full Code Here

  }

  @Test
  public void testLocate() {
    DefaultSourceLocator locator = new DefaultSourceLocator("foo\nbar\n", 2, 3);
    assertEquals(new Location(3, 4), locator.locate(7));
    assertEquals(new Location(2, 5), locator.locate(2)); // this will call lookup()
  }
View Full Code Here

TOP

Related Classes of org.codehaus.jparsec.error.Location

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.