@@ -469,59 +469,24 @@ test_that("numeric scale transforms can produce breaks", {
469
469
scale $ get_transformation()$ inverse(view $ get_breaks())
470
470
}
471
471
472
- expect_equal(test_breaks(" asn" , limits = c(0 , 1 )),
473
- seq(0 , 1 , by = 0.25 ))
474
-
475
- expect_equal(test_breaks(" sqrt" , limits = c(0 , 10 )),
476
- seq(0 , 10 , by = 2.5 ))
477
-
478
- expect_equal(test_breaks(" atanh" , limits = c(- 0.9 , 0.9 )),
479
- c(NA , - 0.5 , 0 , 0.5 , NA ))
480
-
481
- expect_equal(test_breaks(transform_boxcox(0 ), limits = c(1 , 10 )),
482
- c(NA , 2.5 , 5.0 , 7.5 , 10 ))
483
-
484
- expect_equal(test_breaks(transform_modulus(0 ), c(- 10 , 10 )),
485
- seq(- 10 , 10 , by = 5 ))
486
-
487
- expect_equal(test_breaks(transform_yj(0 ), c(- 10 , 10 )),
488
- seq(- 10 , 10 , by = 5 ))
489
-
490
- expect_equal(test_breaks(" exp" , c(- 10 , 10 )),
491
- seq(- 10 , 10 , by = 5 ))
492
-
493
- expect_equal(test_breaks(" identity" , limits = c(- 10 , 10 )),
494
- seq(- 10 , 10 , by = 5 ))
495
-
496
- # irrational numbers, so snapshot values
472
+ expect_snapshot(test_breaks(" asn" , limits = c(0 , 1 )))
473
+ expect_snapshot(test_breaks(" sqrt" , limits = c(0 , 10 )))
474
+ expect_snapshot(test_breaks(" atanh" , limits = c(- 0.9 , 0.9 )))
475
+ expect_snapshot(test_breaks(transform_boxcox(0 ), limits = c(1 , 10 )))
476
+ expect_snapshot(test_breaks(transform_modulus(0 ), c(- 10 , 10 )))
477
+ expect_snapshot(test_breaks(transform_yj(0 ), c(- 10 , 10 )))
478
+ expect_snapshot(test_breaks(" exp" , c(- 10 , 10 )))
479
+ expect_snapshot(test_breaks(" identity" , limits = c(- 10 , 10 )))
497
480
expect_snapshot(test_breaks(" log" , limits = c(0.1 , 1000 )))
498
-
499
- expect_equal(test_breaks(" log10" , limits = c(0.1 , 1000 )),
500
- 10 ^ seq(- 1 , 3 ))
501
-
502
- expect_equal(test_breaks(" log2" , limits = c(0.5 , 32 )),
503
- c(0.5 , 2 , 8 , 32 ))
504
-
505
- expect_equal(test_breaks(" log1p" , limits = c(0 , 10 )),
506
- seq(0 , 10 , by = 2.5 ))
507
-
508
- expect_equal(test_breaks(" pseudo_log" , limits = c(- 10 , 10 )),
509
- seq(- 10 , 10 , by = 5 ))
510
-
511
- expect_equal(test_breaks(" logit" , limits = c(0.001 , 0.999 )),
512
- c(NA , 0.25 , 0.5 , 0.75 , NA ))
513
-
514
- expect_equal(test_breaks(" probit" , limits = c(0.001 , 0.999 )),
515
- c(NA , 0.25 , 0.5 , 0.75 , NA ))
516
-
517
- expect_equal(test_breaks(" reciprocal" , limits = c(1 , 10 )),
518
- c(NA , 2.5 , 5 , 7.5 , 10 ))
519
-
520
- expect_equal(test_breaks(" reverse" , limits = c(- 10 , 10 )),
521
- seq(- 10 , 10 , by = 5 ))
522
-
523
- expect_equal(test_breaks(" sqrt" , limits = c(0 , 10 )),
524
- seq(0 , 10 , by = 2.5 ))
481
+ expect_snapshot(test_breaks(" log10" , limits = c(0.1 , 1000 )))
482
+ expect_snapshot(test_breaks(" log2" , limits = c(0.5 , 32 )))
483
+ expect_snapshot(test_breaks(" log1p" , limits = c(0 , 10 )))
484
+ expect_snapshot(test_breaks(" pseudo_log" , limits = c(- 10 , 10 )))
485
+ expect_snapshot(test_breaks(" logit" , limits = c(0.001 , 0.999 )))
486
+ expect_snapshot(test_breaks(" probit" , limits = c(0.001 , 0.999 )))
487
+ expect_snapshot(test_breaks(" reciprocal" , limits = c(1 , 10 )))
488
+ expect_snapshot(test_breaks(" reverse" , limits = c(- 10 , 10 )))
489
+ expect_snapshot(test_breaks(" sqrt" , limits = c(0 , 10 )))
525
490
})
526
491
527
492
test_that(" scale functions accurately report their calls" , {
0 commit comments