Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MasloMaslane committed Apr 4, 2024
1 parent afb7fb8 commit d158f97
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/sinol_make/contest_types/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_possible_score(self, groups: List[int], scores: Dict[int, int]) -> int:
:param scores: Dictionary: {"<group>": <points>}
:return: Maximum possible score.
"""
if groups[0] == 0 and len(groups) == 1:
if len(groups) == 0 or (groups[0] == 0 and len(groups) == 1):
return 0

possible_score = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/gen/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def test_fsanitize(create_package):
pytest.skip("-fsanitize=address,undefined is not supported on Apple Silicon")
for ingen in ["prog/geningen3.cpp", "prog/geningen4.cpp"]:
with pytest.raises(SystemExit) as e:
simple_run([ingen])
simple_run(["--fsanitize", ingen])
assert e.type == SystemExit
assert e.value.code == 1

Expand Down
28 changes: 5 additions & 23 deletions tests/commands/inwer/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ def test_default(capsys, create_package):
parser = configure_parsers()
args = parser.parse_args(["inwer"])
command = Command()

with pytest.raises(SystemExit) as e:
command.run(args)

assert e.type == SystemExit
assert e.value.code == 0
command.run(args)

out = capsys.readouterr().out
assert "Verification successful." in out
Expand All @@ -42,12 +37,7 @@ def test_specified_inwer(capsys, create_package):
for inwer_path in ["prog/werinwer.cpp", "prog/werinwer7.cpp"]:
args = parser.parse_args(["inwer", inwer_path])
command = Command()

with pytest.raises(SystemExit) as e:
command.run(args)

assert e.type == SystemExit
assert e.value.code == 0
command.run(args)

out = capsys.readouterr().out
assert "Verification successful." in out
Expand Down Expand Up @@ -98,12 +88,7 @@ def test_flag_tests(capsys, create_package):
parser = configure_parsers()
args = parser.parse_args(["inwer", "prog/werinwer.cpp", "--tests", "in/wer2a.in"])
command = Command()

with pytest.raises(SystemExit) as e:
command.run(args)

assert e.type == SystemExit
assert e.value.code == 0
command.run(args)

out = capsys.readouterr().out
assert "Verification successful." in out
Expand Down Expand Up @@ -137,10 +122,7 @@ def test_no_output(capsys, create_package):
parser = configure_parsers()
args = parser.parse_args(["inwer", "prog/werinwer4.cpp"])
command = Command()

with pytest.raises(SystemExit) as e:
command.run(args)
assert e.value.code == 0
command.run(args)
out = capsys.readouterr().out
assert "No output" in out

Expand All @@ -154,7 +136,7 @@ def test_fsanitize(create_package):
pytest.skip("-fsanitize=address,undefined is not supported on Apple Silicon")
for inwer in ["prog/werinwer5.cpp", "prog/werinwer6.cpp"]:
parser = configure_parsers()
args = parser.parse_args(["inwer", inwer])
args = parser.parse_args(["inwer", "--fsanitize", inwer])
command = Command()
with pytest.raises(SystemExit) as e:
command.run(args)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_multiple_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_simple_package(create_package):

@pytest.mark.parametrize("create_package", [util.get_inwer_package_path()], indirect=True)
def test_inwer_package(create_package):
run("sinol-make ingen inwer run")
run("sinol-make gen inwer run")
run("sinol-make ingen prog/weringen.cpp inwer prog/werinwer.cpp --tests wer1a.in run --tests wer2a.in")
run("sinol-make ingen inwer run export --no-statement")

Expand Down

0 comments on commit d158f97

Please sign in to comment.