1
1
use super :: * ;
2
2
3
3
const PRAGMATIC_PROBLEM_PATH : & str = "../examples/data/pragmatic/simple.basic.problem.json" ;
4
+ const PRAGMATIC_MATRIX_PATH : & str = "../examples/data/pragmatic/simple.basic.matrix.json" ;
4
5
const SOLOMON_PROBLEM_PATH : & str = "../examples/data/scientific/solomon/C101.25.txt" ;
5
6
const LILIM_PROBLEM_PATH : & str = "../examples/data/scientific/lilim/LC101.txt" ;
6
7
@@ -16,7 +17,7 @@ impl Write for DummyWrite {
16
17
}
17
18
}
18
19
19
- fn run_solve_with_out_writer ( matches : & ArgMatches ) {
20
+ fn run_solve_without_writer ( matches : & ArgMatches ) {
20
21
run_solve ( matches, |_| BufWriter :: new ( Box :: new ( DummyWrite { } ) ) ) . unwrap ( ) ;
21
22
}
22
23
@@ -31,20 +32,41 @@ fn can_solve_pragmatic_problem_with_generation_limit() {
31
32
let args = vec ! [ "solve" , "pragmatic" , PRAGMATIC_PROBLEM_PATH , "--max-generations" , "1" ] ;
32
33
let matches = get_solve_app ( ) . try_get_matches_from ( args) . unwrap ( ) ;
33
34
34
- run_solve_with_out_writer ( & matches) ;
35
+ run_solve_without_writer ( & matches) ;
36
+ }
37
+
38
+ #[ test]
39
+ fn can_solve_pragmatic_problem_with_matrix ( ) {
40
+ let args = vec ! [ "solve" , "pragmatic" , PRAGMATIC_PROBLEM_PATH , "--matrix" , PRAGMATIC_MATRIX_PATH ] ;
41
+ let matches = get_solve_app ( ) . try_get_matches_from ( args) . unwrap ( ) ;
42
+
43
+ run_solve_without_writer ( & matches) ;
44
+ }
45
+
46
+ #[ test]
47
+ fn can_solve_pragmatic_problem_with_multiple_matrices ( ) {
48
+ const PRAGMATIC_BASICS_PATH : & str = "../examples/data/pragmatic/basics/" ;
49
+ let problem_path = format ! ( "{PRAGMATIC_BASICS_PATH}profiles.basic.problem.json" ) ;
50
+ let car_matrix_path = format ! ( "{PRAGMATIC_BASICS_PATH}profiles.basic.matrix.car.json" ) ;
51
+ let truck_matrix_path = format ! ( "{PRAGMATIC_BASICS_PATH}profiles.basic.matrix.truck.json" ) ;
52
+
53
+ let args = vec ! [ "solve" , "pragmatic" , & problem_path, "--matrix" , & car_matrix_path, "--matrix" , & truck_matrix_path] ;
54
+ let matches = get_solve_app ( ) . try_get_matches_from ( args) . unwrap ( ) ;
55
+
56
+ run_solve_without_writer ( & matches) ;
35
57
}
36
58
37
59
#[ test]
38
60
fn can_solve_lilim_problem_with_multiple_limits ( ) {
39
61
let args = vec ! [ "solve" , "lilim" , LILIM_PROBLEM_PATH , "--max-time" , "300" , "--max-generations" , "1" ] ;
40
62
let matches = get_solve_app ( ) . try_get_matches_from ( args) . unwrap ( ) ;
41
63
42
- run_solve_with_out_writer ( & matches) ;
64
+ run_solve_without_writer ( & matches) ;
43
65
}
44
66
45
67
#[ test]
46
68
fn can_solve_solomon_problem_with_generation_limit ( ) {
47
- run_solve_with_out_writer ( & get_solomon_matches ( & [ "--max-generations" , "1" ] ) ) ;
69
+ run_solve_without_writer ( & get_solomon_matches ( & [ "--max-generations" , "1" ] ) ) ;
48
70
}
49
71
50
72
#[ test]
0 commit comments