1
1
context(" coord_polar" )
2
2
3
- test_that(" Polar distance calculation " , {
3
+ test_that(" polar distance is calculated correctly " , {
4
4
dat <- data.frame (
5
5
theta = c(0 , 2 * pi , 2 , 6 , 6 , 1 , 1 , 0 ),
6
6
r = c(0 , 0 , 0.5 , 0.5 , 1 , 1 , 0.75 , .5 ))
@@ -26,9 +26,7 @@ test_that("Polar distance calculation", {
26
26
# geom_point(alpha=0.3) + coord_polar()
27
27
})
28
28
29
-
30
-
31
- test_that(" Polar distance calculation ignores NA's" , {
29
+ test_that(" polar distance calculation ignores NA's" , {
32
30
33
31
# These are r and theta values; we'll swap them around for testing
34
32
x1 <- c(0 , 0.5 , 0.5 , NA , 1 )
@@ -39,7 +37,6 @@ test_that("Polar distance calculation ignores NA's", {
39
37
dists <- dist_polar(x2 , x1 )
40
38
expect_equal(is.na(dists ), c(FALSE , FALSE , TRUE , TRUE ))
41
39
42
-
43
40
# NA on the end
44
41
x1 <- c(0 , 0.5 , 0.5 , 1 , NA )
45
42
x2 <- c(0 , 1 , 2 , 0 , 1 )
@@ -48,7 +45,6 @@ test_that("Polar distance calculation ignores NA's", {
48
45
dists <- dist_polar(x2 , x1 )
49
46
expect_equal(is.na(dists ), c(FALSE , FALSE , FALSE , TRUE ))
50
47
51
-
52
48
# NAs in each vector - also have NaN
53
49
x1 <- c(0 , 0.5 , 0.5 , 1 , NA )
54
50
x2 <- c(NaN , 1 , 2 , NA , 1 )
@@ -58,7 +54,6 @@ test_that("Polar distance calculation ignores NA's", {
58
54
expect_equal(is.na(dists ), c(TRUE , FALSE , TRUE , TRUE ))
59
55
})
60
56
61
-
62
57
test_that(" clipping can be turned off and on" , {
63
58
# clip can be turned on and off
64
59
p <- ggplot() + coord_polar()
@@ -73,7 +68,7 @@ test_that("clipping can be turned off and on", {
73
68
74
69
# Visual tests ------------------------------------------------------------
75
70
76
- test_that(" Polar coordinates draws correctly" , {
71
+ test_that(" polar coordinates draw correctly" , {
77
72
theme <- theme_test() +
78
73
theme(
79
74
axis.text.y = element_blank(),
0 commit comments