From 680f3386cea7d433eb600d79d208ce7f7c4850b5 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Sun, 10 Mar 2013 16:42:51 +0100 Subject: [PATCH] test/polyline: Added more test cases from official documentation .. and marked those tests as such. URL of the "Encoded Polyline Algorithm Format" page is https://developers.google.com/maps/documentation/utilities/polylinealgorithm --- test/spec/ol/parser/polyline.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/spec/ol/parser/polyline.test.js b/test/spec/ol/parser/polyline.test.js index baba3223a6..cf392bcc85 100644 --- a/test/spec/ol/parser/polyline.test.js +++ b/test/spec/ol/parser/polyline.test.js @@ -10,6 +10,7 @@ describe('ol.parser.polyline', function() { it('returns expected value', function() { var encodeFlatCoordinates = ol.parser.polyline.encodeFlatCoordinates; + // from the "Encoded Polyline Algorithm Format" page at Google expect(encodeFlatCoordinates( flat_points)).toEqual('_p~iF~ps|U_ulLnnqC_mqNvxq`@'); }); @@ -19,6 +20,7 @@ describe('ol.parser.polyline', function() { it('returns expected value', function() { var decodeFlatCoordinates = ol.parser.polyline.decodeFlatCoordinates; + // from the "Encoded Polyline Algorithm Format" page at Google expect(decodeFlatCoordinates( '_p~iF~ps|U_ulLnnqC_mqNvxq`@')).toEqual(flat_points); }); @@ -41,6 +43,9 @@ describe('ol.parser.polyline', function() { expect(encodeFloat(16 * 32 / 1e5)).toEqual('__@'); expect(encodeFloat(16 * 32 * 32 / 1e5)).toEqual('___@'); + + // from the "Encoded Polyline Algorithm Format" page at Google + expect(encodeFloat(-179.9832104)).toEqual('`~oia@'); }); }); @@ -61,6 +66,9 @@ describe('ol.parser.polyline', function() { expect(decodeFloat('__@')).toEqual(16 * 32 / 1e5); expect(decodeFloat('___@')).toEqual(16 * 32 * 32 / 1e5); + + // from the "Encoded Polyline Algorithm Format" page at Google + expect(decodeFloat('`~oia@')).toEqual(-179.98321); }); });