@@ -6,7 +6,7 @@ testthat::test_that(
66 " p1" , " i1" , " i2" , " processing" ,
77 " p1" , " i1" , " i3" , " processing" ,
88 " p1" , " i4" , " i2" , " processing" ,
9- " p2" , " i1 " , " i5 " , " processing" ,
9+ " p2" , " i5 " , " i6 " , " processing" ,
1010 " ignore" , " ignore" , " ignore" , " seedwaste" ,
1111 " ignore" , " ignore" , " ignore" , " feed" ,
1212 )
@@ -16,20 +16,21 @@ testthat::test_that(
1616 2000 , " a1" , " i1" , 10 , " i2" , 20 ,
1717 2000 , " a1" , " i1" , 10 , " i3" , 30 ,
1818 2000 , " a1" , " i4" , 20 , " i2" , 40 ,
19- 2000 , " a1" , " i1 " , 30 , " i5 " , 20
19+ 2000 , " a1" , " i5 " , 30 , " i6 " , 20
2020 )
2121 expected <- tibble :: tribble(
2222 ~ year , ~ area , ~ proc , ~ item , ~ value , ~ type ,
2323 2000 , " a1" , " p1" , " i1" , 10 , " use" ,
2424 2000 , " a1" , " p1" , " i4" , 20 , " use" ,
25- 2000 , " a1" , " p2" , " i1 " , 30 , " use" ,
25+ 2000 , " a1" , " p2" , " i5 " , 30 , " use" ,
2626 2000 , " a1" , " p1" , " i2" , 60 , " supply" ,
2727 2000 , " a1" , " p1" , " i3" , 30 , " supply" ,
28- 2000 , " a1" , " p2" , " i5 " , 20 , " supply" ,
28+ 2000 , " a1" , " p2" , " i6 " , 20 , " supply" ,
2929 ) | >
3030 dplyr :: arrange(year , area , proc , item , type )
3131
32- .add_supply_use_for_processing(processes_table , coeffs ) | >
32+ tibble :: tibble() | >
33+ .add_supply_use_for_processing(processes_table , coeffs ) | >
3334 dplyr :: arrange(year , area , proc , item , type ) | >
3435 testthat :: expect_equal(expected )
3536 }
@@ -55,7 +56,45 @@ testthat::test_that(".add_use_for_seed works for 'seedwaste' use items", {
5556 ) | >
5657 dplyr :: arrange(year , area , proc , item , type )
5758
58- .add_use_for_seed(processes_table , cbs ) | >
59+ tibble :: tibble() | >
60+ .add_use_for_seed(processes_table , cbs ) | >
5961 dplyr :: arrange(year , area , proc , item , type ) | >
6062 testthat :: expect_equal(expected )
6163})
64+
65+ testthat :: test_that(
66+ " .add_rest_of_supply takes domestic supply of still non checked output items" ,
67+ {
68+ supply_process_table <- tibble :: tribble(
69+ ~ proc , ~ item ,
70+ " p1" , " i1" ,
71+ " p2" , " i2" ,
72+ " p3" , " i3"
73+ )
74+ supply_use <- tibble :: tribble(
75+ ~ year , ~ area , ~ proc , ~ item , ~ value , ~ type ,
76+ 2000 , " a1" , " p1" , " i1" , 10 , " use" ,
77+ 2000 , " a1" , " p1" , " i2" , 10 , " supply" ,
78+ )
79+ cbs <- tibble :: tribble(
80+ ~ year , ~ area , ~ item , ~ item_code , ~ domestic_supply ,
81+ 2000 , " a1" , " i1" , 1 , 30 ,
82+ 2000 , " a1" , " i2" , 2 , 40 ,
83+ 2000 , " a1" , " i3" , 2 , 50 ,
84+ )
85+ expected <- supply_use | >
86+ dplyr :: bind_rows(
87+ tibble :: tribble(
88+ ~ year , ~ area , ~ proc , ~ item , ~ value , ~ type ,
89+ 2000 , " a1" , " p1" , " i1" , 30 , " supply" ,
90+ 2000 , " a1" , " p3" , " i3" , 50 , " supply"
91+ )
92+ ) | >
93+ dplyr :: arrange(year , area , proc , item , type )
94+
95+ supply_use | >
96+ .add_rest_of_supply(supply_process_table , cbs ) | >
97+ dplyr :: arrange(year , area , proc , item , type ) | >
98+ testthat :: expect_equal(expected )
99+ }
100+ )
0 commit comments