|
|
|
@ -9,13 +9,19 @@ func title():
|
|
|
|
|
|
|
|
|
|
func start():
|
|
|
|
|
# Runs before all test related methods once
|
|
|
|
|
self.provider = MajorityJudgmentChatCommandJudgmentsProvider.new()
|
|
|
|
|
watch(self.provider, "judgment_emitted")
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func pre():
|
|
|
|
|
# Runs before each test method
|
|
|
|
|
pass
|
|
|
|
|
refresh_provider()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func refresh_provider():
|
|
|
|
|
if self.provider:
|
|
|
|
|
unwatch(self.provider, "judgment_emitted")
|
|
|
|
|
self.provider = MajorityJudgmentChatCommandJudgmentsProvider.new()
|
|
|
|
|
watch(self.provider, "judgment_emitted")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func test_single_command():
|
|
|
|
@ -25,7 +31,13 @@ func test_single_command():
|
|
|
|
|
do_test_single_command("E4", [4, 4])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func test_multi_command():
|
|
|
|
|
do_test_multi_command("A4 B3 C3", [[0, 4],[1, 3],[2, 3]])
|
|
|
|
|
do_test_multi_command("B4b1L0n3", [[1, 4],[1, 1],[11, 0],[13, 3]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func do_test_single_command(command:String, expected:Array):
|
|
|
|
|
refresh_provider()
|
|
|
|
|
var author = "Tester"
|
|
|
|
|
self.provider.process_chat_command(author, command)
|
|
|
|
|
asserts.signal_was_emitted(
|
|
|
|
@ -39,3 +51,23 @@ func do_test_single_command(command:String, expected:Array):
|
|
|
|
|
[author, expected[0], expected[1]],
|
|
|
|
|
"Signal was emitted with correct arguments"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func do_test_multi_command(command:String, expecteds:Array):
|
|
|
|
|
refresh_provider()
|
|
|
|
|
var author = "Tester"
|
|
|
|
|
self.provider.process_chat_command(author, command)
|
|
|
|
|
asserts.signal_was_emitted_x_times(
|
|
|
|
|
self.provider,
|
|
|
|
|
"judgment_emitted",
|
|
|
|
|
expecteds.size(),
|
|
|
|
|
"Signal was emitted %d times" % expecteds.size()
|
|
|
|
|
)
|
|
|
|
|
for expected in expecteds:
|
|
|
|
|
asserts.signal_was_emitted_with_arguments(
|
|
|
|
|
self.provider,
|
|
|
|
|
"judgment_emitted",
|
|
|
|
|
[author, expected[0], expected[1]],
|
|
|
|
|
"Signal was emitted with correct arguments"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|