Package org.codehaus.jparsec.error

Examples of org.codehaus.jparsec.error.Location


* @author Ben Yu
*/
public class DefaultSourceLocatorTest extends TestCase {
  public void testLocate_onlyOneLineBreakCharacter() {
    DefaultSourceLocator locator = new DefaultSourceLocator("\n");
    Location location = locator.locate(0);
    assertEquals(new Location(1, 1), location);
    assertEquals(location, locator.locate(0));
    assertEquals(new Location(2, 1), locator.locate(1));
  }
View Full Code Here


    assertEquals(new Location(2, 1), locator.locate(1));
  }
 
  public void testLocate_emptySource() {
    DefaultSourceLocator locator = new DefaultSourceLocator("");
    Location location = locator.locate(0);
    assertEquals(new Location(1, 1), location);
    assertEquals(location, locator.locate(0));
  }
View Full Code Here

    assertEquals(0, DefaultSourceLocator.binarySearch(intList(), 1));
  }
 
  public void testLookup_noLineBreaksScanned() {
    DefaultSourceLocator locator = new DefaultSourceLocator("whatever", 2, 3);
    assertEquals(new Location(2, 4), locator.lookup(1));
  }
View Full Code Here

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

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

  }
 
  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

  }
 
  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

  }
 
  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

  }
 
  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

  }
 
  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

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.