forked from d3/d3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrotation-test.js
35 lines (32 loc) · 1.04 KB
/
rotation-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var vows = require("vows"),
load = require("../load"),
assert = require("../assert");
var suite = vows.describe("d3.geo.rotation");
suite.addBatch({
"rotation": {
topic: load("geo/rotation").expression("d3.geo.rotation"),
"a rotation of [+90°, 0°]": {
topic: function(rotation) {
return rotation([90, 0]);
},
"only rotates longitude": function(rotation) {
assert.inDelta(rotation([0, 0]), [90, 0], 1e-6);
},
"wraps around when crossing the antimeridian": function(rotation) {
assert.inDelta(rotation([150, 0]), [-120, 0], 1e-6);
}
},
"a rotation of [-45°, -45°]": {
topic: function(rotation) {
return rotation([-45, 45]);
},
"rotates longitude and latitude": function(rotation) {
assert.inDelta(rotation([0, 0]), [-54.73561, 30], 1e-6);
},
"inverse rotation of longitude and latitude": function(rotation) {
assert.inDelta(rotation.invert([-54.73561, 30]), [0, 0], 1e-6);
}
}
}
});
suite.export(module);