Skip to content

Commit 4ca6a7e

Browse files
committed
test logging, use correct fields
1 parent cf60f72 commit 4ca6a7e

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

js/closure/openlocationcode_test.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,17 @@ testSuite({
8585
const got = OpenLocationCode.encode(latDegrees, lngDegrees, length);
8686
// Did we get the same code?
8787
if (code != got) {
88-
console.log(
88+
console.warn(
8989
'ENCODING DIFFERENCE: Expected code ' + code +', got ' + got
9090
);
9191
errors++;
9292
}
9393
asyncTestCase.continueTesting();
9494
}
95+
console.info('testEncodeDegrees error rate is ' + (errors / lines.length));
9596
assertTrue(
9697
'testEncodeDegrees: too many errors ' + errors / lines.length,
97-
errors / lines.length < allowedErrorRate
98+
(errors / lines.length) < allowedErrorRate
9899
);
99100
});
100101
asyncTestCase.waitForAsync('Waiting for xhr to respond');
@@ -118,11 +119,11 @@ testSuite({
118119
// Due to floating point precision limitations, we may get values 1 less
119120
// than expected.
120121
assertTrue(
121-
'testEncodeIntegers: expected latitude ' + latIntegers + ', got ' + got[0],
122+
'testLocationToIntegers: expected latitude ' + latIntegers + ', got ' + got[0],
122123
got[0] == latIntegers || got[0] == latIntegers - 1
123124
);
124125
assertTrue(
125-
'testEncodeIntegers: expected longitude ' + lngIntegers + ', got ' + got[1],
126+
'testLocationToIntegers: expected longitude ' + lngIntegers + ', got ' + got[1],
126127
got[1] == lngIntegers || got[1] == lngIntegers - 1
127128
);
128129
asyncTestCase.continueTesting();
@@ -139,8 +140,8 @@ testSuite({
139140
const fields = lines[i].split(',');
140141
const latIntegers = parseInt(fields[2], 10);
141142
const lngIntegers = parseInt(fields[3], 10);
142-
const length = parseInt(fields[2], 10);
143-
const code = fields[3];
143+
const length = parseInt(fields[4], 10);
144+
const code = fields[5];
144145

145146
const got = OpenLocationCode._encodeIntegers(
146147
latIntegers,

0 commit comments

Comments
 (0)