@@ -174,3 +174,37 @@ def test_no_gen_parameters(capsys, create_package):
174174 run (["--no-ingen" ])
175175 assert os .path .exists (os .path .join (create_package , "in" , "abc2a.in" ))
176176 assert os .path .exists (os .path .join (create_package , "out" , "abc2a.out" ))
177+
178+ @pytest .mark .parametrize ("create_package" , [util .get_score_package ()], indirect = True )
179+ def test_total_score_in_config (capsys , create_package ):
180+ """
181+ Test if total_score overwrites default 100 for verification if contest type is OIJ.
182+ """
183+ run ()
184+
185+ if os .path .exists (paths .get_cache_path ()):
186+ shutil .rmtree (paths .get_cache_path ())
187+ cache .create_cache_dirs ()
188+ config = package_util .get_config ()
189+ config ["total_score" ] = 25
190+ sm_util .save_config (config )
191+ with pytest .raises (SystemExit ) as e :
192+ run ()
193+ assert e .value .code == 1
194+ out = capsys .readouterr ().out
195+ assert "Total score in config is 40, but should be 25." in out
196+
197+
198+ @pytest .mark .parametrize ("create_package" , [util .get_score_package ()], indirect = True )
199+ def test_total_score_in_config_oi (capsys , create_package ):
200+ """
201+ Test if total_score does not overwrite default 100 for verification if contest type is OI.
202+ """
203+ config = package_util .get_config ()
204+ config ["sinol_contest_type" ] = "oi"
205+ sm_util .save_config (config )
206+ with pytest .raises (SystemExit ) as e :
207+ run ()
208+ assert e .value .code == 1
209+ out = capsys .readouterr ().out
210+ assert "Total score in config is 40, but should be 100." in out
0 commit comments