Rev 289 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
* Copyright (C) 2006 Steve Ratcliffe
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* Author: Steve Ratcliffe
* Create date: 13-Jan-2007
*/
package test;
import test.display.TreDisplay;
import test.display.TypDisplay;
import uk.me.parabola.imgfmt.ExitException;
import uk.me.parabola.log.Logger;
import uk.me.parabola.mkgmap.main.Main;
import uk.me.parabola.mkgmap.main.MakeTestLangMap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Arrays;
/**
* @author Steve Ratcliffe
*/
public class TestAll
{
private static final Logger log =
Logger.
getLogger(TestAll.
class);
private static final String[] noargs =
new String[0];
public static void main
(String[] args
) {
positive
();
negative
();
}
private static final String TEST_OSM_FILE =
"localtest/osm5/cricklewood-5.osm";
private static final String[][] testArgSets =
{
new String[]{"localtest/osm/czech_test.osm"},
new String[]{"localtest/osm/german_test.osm"},
new String[]{"localtest/osm/sweden_test.osm"},
new String[]{TEST_OSM_FILE
},
new String[]{"localtest/polish/lon.mp"},
new String[]{"localtest/polish/non-existing"},
new String[]{"localtest/osm/63247525"},
new String[]{"localtest/osm/63253506"},
new String[]{"test-map:all-elements"},
new String[]{"test-map:test-points"},
new String[]{"localtest/osm/63253506"},
new String[]{"--charset=no-exist",
"localtest/osm/czech_test.osm"},
new String[]{"--charset=latin2",
"localtest/osm/czech_test.osm"},
new String[]{"--charset=iso-8859-15",
"localtest/osm/czech_test.osm"},
new String[]{"--charset=iso-8859-15",
"--lower-case",
"localtest/osm/czech_test.osm"},
new String[]{"--xcharset=latin1",
"localtest/osm/czech_test.osm"},
new String[]{"--xcharset=latin1",
"localtest/osm/german_test.osm"},
new String[]{"--xcharset=latin1",
"localtest/osm/sweden_test.osm"},
new String[]{"--xcharset=simple8",
"localtest/osm/sweden_test.osm"},
new String[]{"--xcharset=10bit",
"localtest/osm/sweden_test.osm"},
new String[]{"--gmapsupp",
"localtest/osm5/reg40.osm",
"localtest/osm5/reg04.osm"
,
"localtest/osm5/longline.osm"},
new String[]{"--net", TEST_OSM_FILE
},
new String[]{"--list-styles"},
new String[]{"-n",
"00000000", TEST_OSM_FILE
},
new String[]{"--style-file=localtest/style/tstyle.style", TEST_OSM_FILE
},
new String[]{"--style-file=localtest/style/tstyle.style",
"--list-styles"},
};
private static void positive
() {
try {
ListFile.
main(new String[] {
"63240001.img"
});
ExtractFile.
main(new String[] {
"63240001.img"
});
} catch (IOException e
) {
System.
out.
println("could not read img file");
}
Main.
main(new String[] {
"--mapname=12008899",
"vbig.osm"
});
MakeTestLangMap.
main(noargs
);
for (String[] args : testArgSets
) {
try {
Main.
main(args
);
} catch (Exception e
) {
System.
out.
println("Error on " +
Arrays.
toString(args
));
}
}
Logger.
resetLogging("test/log.properties");
Main.
main(new String[] {"-c",
"localtest/args/t1",
"area1.osm"});
Main.
main(new String[] {"-c",
"localtest/args/t1",
TEST_OSM_FILE
});
if (log.
isInfoEnabled()) {
log.
info("info is enabled");
}
log.
warn("info is enabled");
log.
error("error is enabled");
try {
throw new ExitException
("testing");
} catch (ExitException e
) {
log.
error("error is enabled", e
);
}
testDisplayAndReading
();
}
private static void testDisplayAndReading
() {
try {
System.
setOut( new PrintStream("/dev/null"));
} catch (FileNotFoundException e
) {
System.
err.
println("Could not redirect stdout");
}
TreDisplay.
main(new String[] {"63240001.img"});
TypDisplay.
main(new String[] {"localtest/typ/sg.typ"});
}
private static void negative
() {
Main.
main(new String[] {
"nonexistingfile.osm"
});
Main.
main(new String[] {
"README"
});
}
}