-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added multiple flags to moodle #20
Conversation
for answer in answers { | ||
match answer.fraction { | ||
33 => { | ||
assert!( | ||
answer.text.contains("task4_prefix:") | ||
|| answer.text.contains("task5_prefix:") | ||
|| answer.text.contains("task6_prefix:") | ||
); | ||
} | ||
67 => { | ||
assert!( | ||
(answer.text.contains("task4_prefix:") | ||
&& answer.text.contains("task5_prefix:")) | ||
|| (answer.text.contains("task6_prefix:") | ||
&& answer.text.contains("task5_prefix:")) | ||
|| (answer.text.contains("task6_prefix:") | ||
&& answer.text.contains("task4_prefix:")) | ||
); | ||
} | ||
100 => { | ||
assert!( | ||
(answer.text.contains("task4_prefix:") | ||
&& answer.text.contains("task5_prefix:") | ||
&& answer.text.contains("task6_prefix:")) | ||
); | ||
} | ||
_ => { | ||
unreachable!("Unexpected fraction value encountered in test") | ||
} | ||
} | ||
} | ||
for answer in answers2 { | ||
assert!(answer.fraction == 100); | ||
assert!(answer.text.contains("task1:")); | ||
} | ||
for answer in answers3 { | ||
match answer.fraction { | ||
50 => { | ||
assert!(answer.text.contains("task2:") || answer.text.contains("task3:")); | ||
} | ||
100 => { | ||
assert!(answer.text.contains("task2:") && answer.text.contains("task3:")); | ||
} | ||
_ => { | ||
unreachable!("Unexpected fraction value encountered in test") | ||
} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. This does not ensure that there are no duplicates but maybe we can trust the logic of itertools. However, tests should always ensure that if we made changes in the code, the end functionality remains and we get confidence that system still works, so tests should be strict enough.
Closes #17
-Added multiple flag support for answers and a test that shows functionality (test_multiple_flags)
Current separator for flags: ";"
Using itertools crate to implement combinations and permutations for flags
Generating answers for 3 flags currently adds total 6+12+12 = 30 answers