This is the type of thing that will benefit a lot from unit tests, bacause we'll be able to quickly experiment feeding it malicious data, since that data will come from userland and may not be trusted. We're going to start with the following syntax : <candidate><grade> such as A2 means give grade #2 (passable) to candidate A Grades (when there are 6): 0. TO_REJECT .0 1. POOR .1 2. PASSABLE .2 3. GOOD .3 4. VERY_GOOD .4 5. EXCELLENT .5 This will require showing ABC letters in the results gui… Hmmm.master
parent
d54fd091ce
commit
019dd09158
@ -0,0 +1,40 @@
|
||||
extends WAT.Test
|
||||
|
||||
var provider : MajorityJudgmentChatCommandJudgmentsProvider
|
||||
|
||||
|
||||
func title():
|
||||
return "Test Command Provider"
|
||||
|
||||
|
||||
func start():
|
||||
# Runs before all test related methods once
|
||||
self.provider = MajorityJudgmentChatCommandJudgmentsProvider.new()
|
||||
watch(self.provider, "judgment_emitted")
|
||||
|
||||
|
||||
func pre():
|
||||
# Runs before each test method
|
||||
pass
|
||||
|
||||
|
||||
func test_single_command():
|
||||
do_test_single_command("A0", [0, 0])
|
||||
do_test_single_command("B2", [1, 2])
|
||||
do_test_single_command("e4", [4, 4])
|
||||
|
||||
|
||||
func do_test_single_command(command:String, expected:Array):
|
||||
var author = "Tester"
|
||||
self.provider.process_chat_command(author, command)
|
||||
asserts.signal_was_emitted(
|
||||
self.provider,
|
||||
"judgment_emitted",
|
||||
"Signal was emitted"
|
||||
)
|
||||
asserts.signal_was_emitted_with_arguments(
|
||||
self.provider,
|
||||
"judgment_emitted",
|
||||
[author, expected[0], expected[1]],
|
||||
"Signal was emitted with correct arguments"
|
||||
)
|
Loading…
Reference in new issue