|
1 | | -# |
2 | | -# test_that("doubly constrained tested",{ |
3 | | -# |
4 | | -# ## error datas |
5 | | -# error_dist <- cbind(cppSim::distance_test,1:ncol(cppSim::distance_test)) |
6 | | -# |
7 | | -# error_dist_neg <- cppSim::distance_test |
8 | | -# error_dist_neg[100,150] <- -1 |
9 | | -# |
10 | | -# error_flow_neg <- cppSim::flows_test |
11 | | -# error_flow_neg[543,57] <- -1 |
12 | | -# # errors |
13 | | -# testthat::expect_error({ |
14 | | -# cppSim::run_model(flows = cppSim::flows_test |
15 | | -# ,distance = error_dist) |
16 | | -# }) |
17 | | -# |
18 | | -# testthat::expect_error({ |
19 | | -# cppSim::run_model(flows = cppSim::flows_test |
20 | | -# ,distance = cppSim::distance_test |
21 | | -# ,beta = -1) |
22 | | -# }) |
23 | | -# |
24 | | -# testthat::expect_error({ |
25 | | -# cppSim::run_model(flows=cppSim::flows_test |
26 | | -# ,distance = error_dist_neg#cppSim::distance_test |
27 | | -# ) |
28 | | -# }) |
29 | | -# |
30 | | -# testthat::expect_error({ |
31 | | -# cppSim::run_model(flows = error_flow_neg |
32 | | -# ,distance = cppSim::distance_test |
33 | | -# ) |
34 | | -# }) |
35 | | -# |
36 | | -# |
37 | | -# #### Correct |
38 | | -# |
39 | | -# testthat::expect_type({ |
40 | | -# |
41 | | -# cppSim::run_model(flows = cppSim::flows_test |
42 | | -# ,distance = cppSim::distance_test) |
43 | | -# |
44 | | -# },"list") |
45 | | -# |
46 | | -# }) |
47 | | -# |
48 | | -# test_that("singly constrained tested", { |
49 | | -# |
50 | | -# ## error datas |
51 | | -# error_dist <- cbind(cppSim::distance_test,1:ncol(cppSim::distance_test)) |
52 | | -# |
53 | | -# error_dist_neg <- cppSim::distance_test |
54 | | -# error_dist_neg[100,150] <- -1 |
55 | | -# |
56 | | -# orig_flow <- error_flow_neg <- apply(cppSim::flows_test,FUN = sum,MARGIN = 1) |
57 | | -# |
58 | | -# error_flow_neg[543] <- -1 |
59 | | -# |
60 | | -# # errors |
61 | | -# # this test works locally, but does not work with checks... |
62 | | -# # testthat::expect_error({ |
63 | | -# # cppSim::run_model_single(flows = c(orig_flow,1,2) |
64 | | -# # ,distance = error_dist) |
65 | | -# # }) |
66 | | -# |
67 | | -# testthat::expect_error({ |
68 | | -# cppSim::run_model_single(flows = orig_flow |
69 | | -# ,distance = cppSim::distance_test |
70 | | -# ,beta = -1) |
71 | | -# }) |
72 | | -# |
73 | | -# testthat::expect_error({ |
74 | | -# cppSim::run_model_single(flows = orig_flow |
75 | | -# ,distance = error_dist_neg #cppSim::distance_test |
76 | | -# ) |
77 | | -# }) |
78 | | -# |
79 | | -# testthat::expect_error({ |
80 | | -# cppSim::run_model_single(flows = error_flow_neg |
81 | | -# ,distance = cppSim::distance_test |
82 | | -# ) |
83 | | -# }) |
84 | | -# |
85 | | -# #### Correct |
86 | | -# |
87 | | -# testthat::expect_type({ |
88 | | -# |
89 | | -# cppSim::run_model_single(flows = orig_flow |
90 | | -# ,distance = cppSim::distance_test) |
91 | | -# |
92 | | -# },"list") |
93 | | -# |
94 | | -# }) |
| 1 | + |
| 2 | +test_that("doubly constrained tested",{ |
| 3 | + |
| 4 | + ## error datas |
| 5 | + error_dist <- cbind(cppSim::distance_test,1:ncol(cppSim::distance_test)) |
| 6 | + |
| 7 | + error_dist_neg <- cppSim::distance_test |
| 8 | + error_dist_neg[100,150] <- -1 |
| 9 | + |
| 10 | + error_flow_neg <- cppSim::flows_test |
| 11 | + error_flow_neg[543,57] <- -1 |
| 12 | + # errors |
| 13 | + testthat::expect_error({ |
| 14 | + cppSim::run_model(flows = cppSim::flows_test |
| 15 | + ,distance = error_dist) |
| 16 | + }) |
| 17 | + |
| 18 | + testthat::expect_error({ |
| 19 | + cppSim::run_model(flows = cppSim::flows_test |
| 20 | + ,distance = cppSim::distance_test |
| 21 | + ,beta = -1) |
| 22 | + }) |
| 23 | + |
| 24 | + testthat::expect_error({ |
| 25 | + cppSim::run_model(flows=cppSim::flows_test |
| 26 | + ,distance = error_dist_neg#cppSim::distance_test |
| 27 | + ) |
| 28 | + }) |
| 29 | + |
| 30 | + testthat::expect_error({ |
| 31 | + cppSim::run_model(flows = error_flow_neg |
| 32 | + ,distance = cppSim::distance_test |
| 33 | + ) |
| 34 | + }) |
| 35 | + |
| 36 | + |
| 37 | + #### Correct |
| 38 | + |
| 39 | + testthat::expect_type({ |
| 40 | + |
| 41 | + cppSim::run_model(flows = cppSim::flows_test |
| 42 | + ,distance = cppSim::distance_test) |
| 43 | + |
| 44 | + },"list") |
| 45 | + |
| 46 | +}) |
| 47 | + |
| 48 | +test_that("singly constrained tested", { |
| 49 | + |
| 50 | + ## error datas |
| 51 | + error_dist <- cbind(cppSim::distance_test,1:ncol(cppSim::distance_test)) |
| 52 | + |
| 53 | + error_dist_neg <- cppSim::distance_test |
| 54 | + error_dist_neg[100,150] <- -1 |
| 55 | + |
| 56 | + orig_flow <- error_flow_neg <- apply(cppSim::flows_test,FUN = sum,MARGIN = 1) |
| 57 | + |
| 58 | + error_flow_neg[543] <- -1 |
| 59 | + |
| 60 | + # errors |
| 61 | + # this test works locally, but does not work with checks... |
| 62 | + testthat::expect_error({ |
| 63 | + cppSim::run_model_single(flows = c(orig_flow,1,2) |
| 64 | + ,distance = error_dist) |
| 65 | + }) |
| 66 | + |
| 67 | + testthat::expect_error({ |
| 68 | + cppSim::run_model_single(flows = orig_flow |
| 69 | + ,distance = cppSim::distance_test |
| 70 | + ,beta = -1) |
| 71 | + }) |
| 72 | + |
| 73 | + testthat::expect_error({ |
| 74 | + cppSim::run_model_single(flows = orig_flow |
| 75 | + ,distance = error_dist_neg #cppSim::distance_test |
| 76 | + ) |
| 77 | + }) |
| 78 | + |
| 79 | + testthat::expect_error({ |
| 80 | + cppSim::run_model_single(flows = error_flow_neg |
| 81 | + ,distance = cppSim::distance_test |
| 82 | + ) |
| 83 | + }) |
| 84 | + |
| 85 | + #### Correct |
| 86 | + |
| 87 | + testthat::expect_type({ |
| 88 | + |
| 89 | + cppSim::run_model_single(flows = orig_flow |
| 90 | + ,distance = cppSim::distance_test) |
| 91 | + |
| 92 | + },"list") |
| 93 | + |
| 94 | +}) |
0 commit comments