Debian Codegraph @

test/func/files/TdbTest.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2008 Steve Ratcliffe
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 or
6 * version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13 /* Create date: 17-Feb-2009 */
14 package func.files;
15
16 import java.io.File;
17 import java.io.IOException;
18
19 import uk.me.parabola.mkgmap.main.Main;
20 import uk.me.parabola.tdbfmt.TdbFile;
21
22 import func.Base;
23 import func.lib.Args;
24 import func.lib.TestUtils;
25 import org.junit.Test;
26
27 import static org.junit.Assert.*;
28
29
30 public class TdbTest extends Base {
31 private static final String TDBNAME = "osmmap.tdb";
32
33 /**
34 * Basic test that the correct file is created. Check a few
35 * values within it too.
36 */
37 @Test
38 public void testBasic() throws IOException {
39 Main.mainNoSystemExit(Args.TEST_STYLE_ARG, "--tdbfile",
40 Args.TEST_RESOURCE_OSM + "uk-test-1.osm.gz",
41 Args.TEST_RESOURCE_OSM + "uk-test-2.osm.gz");
42
43 File f = new File(TDBNAME);
44 assertTrue("TDB was created", f.exists());
45
46 TdbFile tdb = TdbFile.read(TDBNAME);
47 assertEquals("tdb version", 407, tdb.getTdbVersion());
48 }
49
50
51 /**
52 * Check for each possible option.
53 */
54 @Test
55 public void testOptions() {
56 int thisMapname = 11112222;
57 TestUtils.registerFile(thisMapname + ".img", thisMapname + ".tdb");
58 Main.mainNoSystemExit(Args.TEST_STYLE_ARG, "--tdbfile", "--overview-mapname=" + thisMapname, "--family-id=198", "--product-id=2", "--series-name=Test series", "--family-name=Test family", Args.TEST_RESOURCE_OSM + "uk-test-1.osm.gz");
59
60 File f = new File(thisMapname + ".tdb");
61 assertTrue("TDB was created", f.exists());
62
63 // more to do here...
64 }
65 }