[gbrainy] Unit tests for cheat answers (bug#661309)
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Unit tests for cheat answers (bug#661309)
- Date: Sun, 13 Nov 2011 12:29:35 +0000 (UTC)
commit ccfc9c7fda250c0bd6c9195b2aadcc04601f5459
Author: Jordi Mas <jmas softcatala org>
Date: Sun Nov 13 13:28:18 2011 +0100
Unit tests for cheat answers (bug#661309)
tests/Core/GameAnswerTest.cs | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/tests/Core/GameAnswerTest.cs b/tests/Core/GameAnswerTest.cs
index 281b05b..3ae7b54 100644
--- a/tests/Core/GameAnswerTest.cs
+++ b/tests/Core/GameAnswerTest.cs
@@ -127,6 +127,28 @@ namespace gbrainy.Test.Core
Assert.AreEqual (true, answer.CheckAnswer ("30 20 10"));
}
+ [Test]
+ public void MatchAllCheatNumbers ()
+ {
+ GameAnswer answer = new GameAnswer ();
+
+ answer.CheckAttributes = GameAnswerCheckAttributes.MatchAll;
+ answer.CheckExpression = "[0-9]+";
+ answer.Correct = "10 | 20 | 30";
+ Assert.AreEqual (false, answer.CheckAnswer ("10 20 30 40 50"));
+ }
+
+ [Test]
+ public void MatchAllCheatMultiOption ()
+ {
+ GameAnswer answer = new GameAnswer ();
+
+ answer.CheckAttributes |= GameAnswerCheckAttributes.MatchAll | GameAnswerCheckAttributes.MultiOption | GameAnswerCheckAttributes.IgnoreSpaces;
+ answer.CheckExpression = "[ABCDEFGH]";
+ answer.Correct = "A | B | C";
+ Assert.AreEqual (false, answer.CheckAnswer ("A B C D"));
+ }
+
// Test attributes as used in real games
[Test]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]