@@ -18,8 +18,55 @@ test_that("gcf_grid works", {
1818 expect_error(gcf_grid(cos(r ^ 2 )* exp(- r / (2 * pi )), bar = T ), NA )
1919 # pts
2020 expect_error(gcf_grid(cos(r ^ 2 )* exp(- r / (2 * pi )), pts = matrix (c(.1 ,.2 ,.3 ,.4 ),2 ,2 )), NA )
21+ expect_error(gcf_grid(cos(r ^ 2 )* exp(- r / (2 * pi )), pts = c(.1 ,.2 ,.3 ,.4 )), NA )
2122 # Can't reset.par
2223 expect_error(gcf_grid(cos(r ^ 2 )* exp(- r / (2 * pi )), reset.par = F ))
2324 # afterplotfunc, not useful, maybe should remove
24- expect_error(gcf_grid(cos(r ^ 2 )* exp(- r / (2 * pi )), afterplotfunc = function (){print(" after" )}), NA )
25+ expect_error(gcf_grid(cos(r ^ 2 )* exp(- r / (2 * pi )), afterplotfunc = function (){(" after" )}), NA )
26+
27+ # Lines
28+ expect_error(gcf_grid(cos(r ^ 2 )* exp(- r / (2 * pi )), lines_only = T ), NA )
29+ expect_error(gcf_grid(cos(r ^ 2 )* exp(- r / (2 * pi )), with_lines = T ), NA )
30+ expect_error(gcf_grid(cos(r ^ 2 )* exp(- r / (2 * pi )), with_lines = T , lines_only = T ), NA )
31+
32+ # Errors
33+ expect_error(gcf_grid()) # No z given
34+ expect_error(gcf_grid(x )) # No z given
35+ expect_error(gcf_grid(rev(x ), y , cos(r ^ 2 )* exp(- r / (2 * pi ))))
36+ expect_error(gcf_grid(x , rev(y ), cos(r ^ 2 )* exp(- r / (2 * pi ))))
37+
2538})
39+
40+ test_that(" gcf_func" , {
41+ p1 <- gcf_func(function (xx ){exp(- sum((xx - .5 )^ 2 / .1 ))})
42+ p2 <- cf_func(function (xx ){exp(- sum((xx - .5 )^ 2 / .1 ))}, gg = T )
43+ expect_is(p1 , " gg" )
44+ expect_is(p2 , " gg" )
45+ })
46+
47+ test_that(" gcf_data" , {
48+ x <- runif(20 )
49+ y <- runif(20 )
50+ z <- exp(- (x - .5 )^ 2 - 5 * (y - .5 )^ 2 )# + rnorm(20,0,.05)
51+ p1 <- gcf_data(x ,y ,z )
52+ p2 <- cf_data(x ,y ,z , gg = T )
53+ expect_is(p1 , " gg" )
54+ expect_is(p2 , " gg" )
55+ })
56+
57+ test_that(" gcf" , {
58+ # Func
59+ p1 <- gcf(function (xx ){exp(- sum((xx - .5 )^ 2 / .1 ))})
60+ p2 <- cf(function (xx ){exp(- sum((xx - .5 )^ 2 / .1 ))}, gg = T )
61+ expect_is(p1 , " gg" )
62+ expect_is(p2 , " gg" )
63+
64+ # Data
65+ x <- runif(20 )
66+ y <- runif(20 )
67+ z <- exp(- (x - .5 )^ 2 - 5 * (y - .5 )^ 2 )# + rnorm(20,0,.05)
68+ p3 <- gcf_data(x ,y ,z )
69+ p4 <- cf_data(x ,y ,z , gg = T )
70+ expect_is(p3 , " gg" )
71+ expect_is(p4 , " gg" )
72+ })
0 commit comments