Search in sources :

Example 1 with RangeMatcher

use of func.lib.RangeMatcher in project mkgmap by openstreetmap.

the class SimpleTest method testPolish.

@Test
public void testPolish() throws FileNotFoundException {
    Main.mainNoSystemExit(Args.TEST_STYLE_ARG, Args.TEST_RESOURCE_MP + "test1.mp");
    FileSystem fs = openFs(Args.DEF_MAP_FILENAME);
    assertNotNull("file exists", fs);
    List<DirectoryEntry> entries = fs.list();
    int count = 0;
    for (DirectoryEntry ent : entries) {
        String ext = ent.getExt();
        int size = ent.getSize();
        switch(ext) {
            case "RGN":
                count++;
                System.out.println("RGN size " + size);
                assertThat("RGN size", size, new RangeMatcher(2704));
                break;
            case "TRE":
                count++;
                System.out.println("TRE size " + size);
                // Size varies depending on svn modified status
                assertThat("TRE size", size, new RangeMatcher(770, 2));
                break;
            case "LBL":
                count++;
                assertEquals("LBL size", 999, size);
                break;
        }
    }
    assertTrue("enough checks run", count >= 3);
}
Also used : RangeMatcher(func.lib.RangeMatcher) FileSystem(uk.me.parabola.imgfmt.fs.FileSystem) DirectoryEntry(uk.me.parabola.imgfmt.fs.DirectoryEntry) Point(uk.me.parabola.imgfmt.app.trergn.Point) Test(org.junit.Test)

Example 2 with RangeMatcher

use of func.lib.RangeMatcher in project mkgmap by openstreetmap.

the class SimpleRouteTest method testSize.

/**
 * Simple test to ensure that nothing has changed.  Of course
 * if the output should have changed, then this will have to be altered
 * to match.
 */
@Test
public void testSize() throws FileNotFoundException {
    Main.mainNoSystemExit(Args.TEST_STYLE_ARG, "--preserve-element-order", "--route", Args.TEST_RESOURCE_OSM + "uk-test-1.osm.gz", Args.TEST_RESOURCE_MP + "test1.mp");
    FileSystem fs = openFs(Args.DEF_MAP_ID + ".img");
    assertNotNull("file exists", fs);
    List<DirectoryEntry> entries = fs.list();
    int count = 0;
    for (DirectoryEntry ent : entries) {
        String ext = ent.getExt();
        int size = ent.getSize();
        switch(ext) {
            case "RGN":
                count++;
                System.out.println("RGN size " + size);
                assertThat("RGN size", size, new RangeMatcher(127586));
                break;
            case "TRE":
                count++;
                System.out.println("TRE size " + size);
                // Size varies depending on svn modified status
                assertThat("TRE size", size, new RangeMatcher(1427, 2));
                break;
            case "LBL":
                count++;
                assertEquals("LBL size", 28742, size);
                break;
            case "NET":
                count++;
                assertEquals("NET size", 66859, size);
                break;
            case "NOD":
                count++;
                assertEquals("NOD size", 170201, size);
                break;
        }
    }
    assertTrue("enough checks run", count == 5);
    fs = openFs(Args.DEF_MAP_FILENAME2);
    assertNotNull("file exists", fs);
    entries = fs.list();
    count = 0;
    for (DirectoryEntry ent : entries) {
        String ext = ent.getExt();
        int size = ent.getSize();
        switch(ext) {
            case "RGN":
                count++;
                System.out.println("RGN size " + size);
                assertThat("RGN size", size, new RangeMatcher(2727));
                break;
            case "TRE":
                count++;
                System.out.println("TRE size " + size);
                // Size varies depending on svn modified status
                assertThat("TRE size", size, new RangeMatcher(770, 2));
                break;
            case "LBL":
                count++;
                assertEquals("LBL size", 999, size);
                break;
            case "NET":
                count++;
                assertEquals("NET size", 1301, size);
                break;
            case "NOD":
                count++;
                assertEquals("NOD size", 3584, size);
                break;
        }
    }
    assertTrue("enough checks run", count == 5);
}
Also used : RangeMatcher(func.lib.RangeMatcher) FileSystem(uk.me.parabola.imgfmt.fs.FileSystem) DirectoryEntry(uk.me.parabola.imgfmt.fs.DirectoryEntry) Test(org.junit.Test)

Aggregations

RangeMatcher (func.lib.RangeMatcher)2 Test (org.junit.Test)2 DirectoryEntry (uk.me.parabola.imgfmt.fs.DirectoryEntry)2 FileSystem (uk.me.parabola.imgfmt.fs.FileSystem)2 Point (uk.me.parabola.imgfmt.app.trergn.Point)1