- The last commit in cross.cpp fixed a bug but introduced another one, now both are fixed

- Added unit tests for both bugs
 - Fixed another bug preventing to enter some letters in the training rack
This commit is contained in:
Olivier Teulière 2008-10-15 19:43:23 +00:00
parent 0de2e6256f
commit 350666b568
8 changed files with 44 additions and 1 deletions

View file

@ -50,6 +50,7 @@ public:
bool isEmpty() const { return m_char == kTILE_DUMMY; }
bool isJoker() const { return m_joker; }
bool isPureJoker() const { return m_char == kTILE_JOKER; }
bool isVowel() const;
bool isConsonant() const;
unsigned int maxNumber() const;

View file

@ -55,7 +55,7 @@ string Cross::getHexContent() const
bool Cross::check(const Tile& iTile) const
{
return m_mask & (1 << iTile.toCode());
return m_mask & (1 << iTile.toCode()) || (iTile.isPureJoker() && m_mask);
}

View file

@ -263,6 +263,8 @@ QValidator::State RackValidator::validate(QString &input, int &) const
if (m_bag == NULL)
return Invalid;
input = input.toUpper();
if (!m_bag->getDic().validateLetters(qtw(input)))
return Invalid;

View file

@ -39,6 +39,8 @@ training_cross 0
training_cross2 0
# Board cross backward joker
training_cross3 0
# Search with best word having a joker on the cross-set
training_cross4 0
# Joker problem on game load
training_joker 0

View file

@ -0,0 +1,8 @@
e
t maison
j MAISON h4
t wu?
r
a r
q
q

22
test/training_cross4.ref Normal file
View file

@ -0,0 +1,22 @@
[?] pour l'aide
commande> e
mode entraînement
[?] pour l'aide
commande> t maison
commande> j MAISON h4
commande> t wu?
commande> r
commande> a r
1: WUs 38 10F
2: WUs 25 I3
3: WU 24 I3
4: Wu 22 I3
5: WUrM 13 4E
6: WUS 13 7F
7: dAUW 12 5G
8: dAW 11 5G
9: kWA 11 5F
10: WAd 11 5G
commande> q
fin du mode entraînement
commande> q

View file

@ -27,6 +27,9 @@ a t
t ADEEPSS
j DEPASSE b12
a t
t W?
j WuS i5
a t
a g
q
q

View file

@ -73,6 +73,11 @@ commande> j DEPASSE b12
Mot incorrect ou mal placé (12)
commande> a t
ADEEPSS
commande> t W?
commande> j WuS i5
Mot incorrect ou mal placé (7)
commande> a t
W?
commande> a g
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
A - - - - - - - - - - - - - - -