Skip to content

Commit a281744

Browse files
committed
Recreated test files with 8 digits
1 parent 0ec5e53 commit a281744

39 files changed

+3540702
-3543917
lines changed

src/test/java/com/mapcode/ReferenceFileTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ public void checkBoundariesReferenceRecordsPrecision2() throws Exception {
113113
@SuppressWarnings("BusyWait")
114114
private static void checkFile(@Nonnull final String baseFileName) throws Exception {
115115

116+
// High-precision means 8 digits.
117+
final int highPprecision = 8;
118+
116119
// Reset error count.
117120
final AtomicLong deltaNm = new AtomicLong(0);
118121
final AtomicInteger errors = new AtomicInteger(0);
@@ -166,7 +169,7 @@ public void run() {
166169
if (reference.mapcodes.size() != results.size()) {
167170
final ArrayList<MapcodeRec> resultsConverted = new ArrayList<MapcodeRec>(results.size());
168171
for (final Mapcode mapcode : results) {
169-
resultsConverted.add(new MapcodeRec(mapcode.getCode(2), mapcode.getTerritory()));
172+
resultsConverted.add(new MapcodeRec(mapcode.getCode(highPprecision), mapcode.getTerritory()));
170173
}
171174
LOG.error("checkFile: Incorrect number of results:" +
172175
"\n lat/lon = {}" +
@@ -185,7 +188,7 @@ public void run() {
185188
for (final Mapcode result : results) {
186189
boolean found = false;
187190
for (final MapcodeRec referenceMapcodeRec : reference.mapcodes) {
188-
precision = (referenceMapcodeRec.mapcode.lastIndexOf('-') > 4) ? 2 : 0;
191+
precision = (referenceMapcodeRec.mapcode.lastIndexOf('-') > 4) ? highPprecision : 0;
189192

190193
if (referenceMapcodeRec.territory.equals(result.getTerritory())) {
191194
if (referenceMapcodeRec.mapcode.equals(result.getCode(precision))) {
@@ -207,7 +210,7 @@ public void run() {
207210

208211
// For every Mapcode in the reference set, check if it is contained in the result set.
209212
for (final MapcodeRec referenceMapcodeRec : reference.mapcodes) {
210-
precision = (referenceMapcodeRec.mapcode.lastIndexOf('-') > 4) ? 2 : 0;
213+
precision = (referenceMapcodeRec.mapcode.lastIndexOf('-') > 4) ? highPprecision : 0;
211214
boolean found = false;
212215
for (final Mapcode result : results) {
213216
if (referenceMapcodeRec.territory.equals(result.getTerritory())) {
@@ -237,7 +240,7 @@ public void run() {
237240
}
238241

239242
final long maxDeltaNm = (long) (((mapcodeRec.mapcode.lastIndexOf('-') > 4) ?
240-
Mapcode.getSafeMaxOffsetInMeters(2) : Mapcode.getSafeMaxOffsetInMeters(0)) * 1000000.0);
243+
Mapcode.getSafeMaxOffsetInMeters(highPprecision) : Mapcode.getSafeMaxOffsetInMeters(0)) * 1000000.0);
241244
if (distanceNm > maxDeltaNm) {
242245
LOG.error("Mapcode {} {} was generated for point {}, but decodes to point {} " +
243246
"which is {} meters from the original point (max is {} meters).",

src/test/resources/README

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ mapcode --grid 100000 0 > grid_100k.txt
3838

3939
mapcode --boundaries > boundaries.txt
4040

41-
mapcode --random 1000 2 12 > random_hp_1k.txt
42-
mapcode --random 10000 2 12 > random_hp_10k.txt
43-
mapcode --random 100000 2 12 > random_hp_100k.txt
41+
mapcode --random 1000 8 12 > random_hp_1k.txt
42+
mapcode --random 10000 8 12 > random_hp_10k.txt
43+
mapcode --random 100000 8 12 > random_hp_100k.txt
4444

45-
mapcode --grid 1000 2 > grid_hp_1k.txt
46-
mapcode --grid 10000 2 > grid_hp_10k.txt
47-
mapcode --grid 100000 2 > grid_hp_100k.txt
45+
mapcode --grid 1000 8 > grid_hp_1k.txt
46+
mapcode --grid 10000 8 > grid_hp_10k.txt
47+
mapcode --grid 100000 8 > grid_hp_100k.txt
4848

49-
mapcode --boundaries 2 > boundaries_hp.txt
49+
mapcode --boundaries 8 > boundaries_hp.txt
5050

5151
for f in *.txt; do split -l 200000 -a 1 $f $f.; rm $f; done
5252
+----

0 commit comments

Comments
 (0)