@@ -11,6 +11,7 @@ fn parse_optional_args_test_all() {
1111 experiment_name : "test experiment" . to_string ( ) ,
1212 output_folder : Default :: default ( ) ,
1313 partition : "memory" . to_string ( ) ,
14+ modules : Default :: default ( ) ,
1415 array_size_limit : None ,
1516 max_submit : None ,
1617 account : "test-account" . to_string ( ) ,
@@ -34,6 +35,7 @@ fn parse_optional_args_test_only_begin() {
3435 experiment_name : "test experiment" . to_string ( ) ,
3536 output_folder : Default :: default ( ) ,
3637 partition : "memory" . to_string ( ) ,
38+ modules : Default :: default ( ) ,
3739 array_size_limit : None ,
3840 max_submit : None ,
3941 account : "test-account" . to_string ( ) ,
@@ -69,6 +71,7 @@ fn parse_optional_args_test_custom_args() {
6971 experiment_name : "test experiment" . to_string ( ) ,
7072 output_folder : Default :: default ( ) ,
7173 partition : "memory" . to_string ( ) ,
74+ modules : Default :: default ( ) ,
7275 array_size_limit : None ,
7376 max_submit : None ,
7477 account : "test-account" . to_string ( ) ,
@@ -86,3 +89,47 @@ fn parse_optional_args_test_custom_args() {
8689
8790 assert_eq ! ( output, desired_output)
8891}
92+
93+ #[ test]
94+ fn parse_modules_test_empty ( ) {
95+ let config = SlurmConfig {
96+ experiment_name : "test experiment" . to_string ( ) ,
97+ output_folder : Default :: default ( ) ,
98+ partition : "memory" . to_string ( ) ,
99+ modules : Vec :: new ( ) ,
100+ array_size_limit : None ,
101+ max_submit : None ,
102+ account : "test-account" . to_string ( ) ,
103+ begin : None ,
104+ mail_type : Some ( "ALL" . to_string ( ) ) ,
105+ mail_user : Some ( "testUSER" . to_string ( ) ) ,
106+ additional_args : None ,
107+ } ;
108+ let output = parse_modules ( & config) ;
109+ let desired_output = "" ;
110+
111+ assert_eq ! ( output, desired_output)
112+ }
113+
114+ #[ test]
115+ fn parse_modules_test_not_empty ( ) {
116+ let config = SlurmConfig {
117+ experiment_name : "test experiment" . to_string ( ) ,
118+ output_folder : Default :: default ( ) ,
119+ partition : "memory" . to_string ( ) ,
120+ modules : vec ! [ "2024r1" . to_string( ) , "r/3.4.0" . to_string( ) ] ,
121+ array_size_limit : None ,
122+ max_submit : None ,
123+ account : "test-account" . to_string ( ) ,
124+ begin : None ,
125+ mail_type : Some ( "ALL" . to_string ( ) ) ,
126+ mail_user : Some ( "testUSER" . to_string ( ) ) ,
127+ additional_args : None ,
128+ } ;
129+ let output = parse_modules ( & config) ;
130+ let desired_output = "module load 2024r1
131+ module load r/3.4.0
132+ " ;
133+
134+ assert_eq ! ( output, desired_output)
135+ }
0 commit comments