Skip to content

Commit

Permalink
test: rogaining course with two laps
Browse files Browse the repository at this point in the history
  • Loading branch information
sembruk committed Dec 6, 2024
1 parent 1e0dbfa commit ed67756
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/test_result_checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,33 @@ def test_course_butterfly():
assert dsq(c, [31, 32, 41, 42, 33, 32, 51, 33, 70])


course1 = ['*(31-39)[]', 40, '*(41-49)[]']
course2 = ['*(31-39)[]', '*(41-49)[]']

@pytest.mark.parametrize(
'course, controls, expected',
[
(course1, [31, 32, 33, 34], 4),
(course1, [31, 32, 33, 34, 40], 5),
(course1, [31, 32, 33, 34, 41], 4),
(course1, [31, 32, 33, 34, 40, 41, 42, 43, 44], 9),
(course1, [31, 32, 33, 34, 40, 35, 42, 43, 44], 8),
(course2, [31, 32, 33, 34], 4),
(course2, [31, 32, 33, 34, 40], 4),
(course2, [31, 32, 33, 34, 41], 5),
(course2, [31, 32, 33, 34, 41, 42, 43, 44], 8),
(course2, [31, 32, 33, 34, 41, 35, 42, 43, 44], 8),
]
)
def test_rogaining_course_with_two_laps(course, controls, expected):
create_race()
race().set_setting('result_processing_mode', 'scores')
race().set_setting('result_processing_score_mode', 'fixed')
result = make_result(controls)
assert result.check(make_course(course)) == True
assert ResultChecker.calculate_rogaine_scores(result) == expected


@pytest.mark.parametrize(
'controls, expected',
[
Expand All @@ -381,8 +408,8 @@ def test_course_butterfly():
)
def test_calculate_rogaine_score(controls, expected):
create_race()
race().set_setting('result_processing_score_mode', 'rogain') # wrong spelling
race().set_setting('result_processing_mode', 'scores')
race().set_setting('result_processing_score_mode', 'rogain') # wrong spelling
assert ok(['*[]'], controls)
res = make_result(controls)
assert ResultChecker.calculate_rogaine_scores(res) == expected
Expand Down

0 comments on commit ed67756

Please sign in to comment.