Skip to content

Commit a8f5173

Browse files
committed
Cleaned up unit test
1 parent 6774d26 commit a8f5173

File tree

5 files changed

+148
-80
lines changed

5 files changed

+148
-80
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,19 @@ of the Mapcode library by Rijn Buve and Matthew Lowden.
3535

3636
# Javascript Files for Mapcode Support
3737

38+
The following files provide the Javascript interfaces for mapcodes:
39+
3840
mapcode.js - Key routines for mapcode support
3941
ndata.js - Data table for mapcode support
4042

4143
sample.html - Sample code to interpret / generate mapcodes
4244
ctrynams.js - Optional js array with the names of territories (in English)
4345

46+
To run the Javascript unit tests, simply open the file `unittest/unittest/html`.
47+
4448
# Version History
4549

46-
* 2.2
50+
* 2.2.0
4751

4852
Solved 1-microdegree gap in a few spots on Earth, noticable now extreme precision is possible;
4953

mapcode.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
15-
*/
15+
*/
1616
var entity_iso = [
1717
'VAT','MCO','GIB','TKL','CCK','BLM','NRU','TUV','MAC','SXM',
1818
'MAF','NFK','PCN','BVT','BMU','IOT','SMR','GGY','AIA','MSR',
@@ -116,11 +116,11 @@ var parents2 = "US,IN,CA,AU,MX,BR,RU,CN,";
116116

117117
var ccode_start = 112; // NLD
118118
var mapcode_cversion = "2.0.2";
119-
var mapcode_dataversion = "2.2";
119+
var mapcode_dataversion = "2.2.0";
120120

121121
// *************************** mapcode_org *********************
122122

123-
var mapcode_javaversion = '2.2.1/Data' + mapcode_dataversion;
123+
var mapcode_javaversion = '2.2.2/Data' + mapcode_dataversion;
124124

125125
/// PRIVATE returns string without leading spaces and plus-signs, and trailing spaces
126126
function trim(str) {
@@ -670,7 +670,7 @@ function mzSetFromFractions(y, x, yDelta, xDelta) {
670670
fmaxx: x + xDelta,
671671
fminy: y + 1 + yDelta, // y+yDelta can NOT be represented
672672
fmaxy: y + 1 // y CAN be represented
673-
};
673+
};
674674
}
675675
else {
676676
return {

unittest/test_encodes.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116

217
var testdata = [
318

@@ -22,14 +37,14 @@ var testdata = [
2237
"", 55.015025, 20.950025, 0,0,
2338
"", 21.6199995, -102.02419949999999, 0,0,
2439
"", 21.6200035, -102.0242375, 0,0,
25-
"", 29.727055, 73.87498650000001,0,0 ,
40+
"", 29.727055, 73.87498650000001,0,0 ,
2641
"", 29.727025, 73.87502499999999,0,0,
2742
"", 28.679995, 78.71705600000000,0,0,
2843
"", 28.680025, 78.71702500000001,0,0,
2944
"", 5.785780,169.79175, 0,0 , // grid
3045
"", -9.34015920,-171.99626665, 0,0 , // encompassing
3146
"", 49.4632595, -2.55989, 0,0 , // inner grid
32-
"", 49.4632625, -2.5599018, 0,0 , // old
47+
"", 49.4632625, -2.5599018, 0,0 , // old
3348
"", 47.1495405, 9.5319995, 0,0 , // inner grid AUT
3449
"", 41.9035, 12.45200000000000 , 0,0,
3550
"", 12.168921, -68.26226699999999, 0,0,
@@ -15883,6 +15898,6 @@ var testdata = [
1588315898
"CN-XJ 123.XXX",46.1175215,84.492761000,3,7,
1588415899
"CN-XJ 12.XXXX",45.925468,80.918028500,2,5,
1588515900
"CN-XJ 0123.XX",40.917864,79.977318500,3,6,
15886-
15901+
1588715902
-1];
1588815903

unittest/test_territories.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116

217
function test_territories() {
318
test_territory("AAA", 533, 0, 0, 0);

0 commit comments

Comments
 (0)