summaryrefslogtreecommitdiffstats
path: root/sigmod/test/TestNature.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-02-24 15:53:15 -0500
committerBen Boeckel <MathStuf@gmail.com>2009-02-24 15:53:15 -0500
commitdde935e48d44ca1b2b8ce993ae5bc187a8ca30fd (patch)
treef317e6de1e2f2a187221a3f4586a2d00ab174237 /sigmod/test/TestNature.cpp
parentb3082840638dc89d48e621a0bf88f7887163ee08 (diff)
downloadsigen-dde935e48d44ca1b2b8ce993ae5bc187a8ca30fd.tar.gz
sigen-dde935e48d44ca1b2b8ce993ae5bc187a8ca30fd.tar.xz
sigen-dde935e48d44ca1b2b8ce993ae5bc187a8ca30fd.zip
Fixed sigmod tests to also use namespace Sigmod
Diffstat (limited to 'sigmod/test/TestNature.cpp')
-rw-r--r--sigmod/test/TestNature.cpp83
1 files changed, 43 insertions, 40 deletions
diff --git a/sigmod/test/TestNature.cpp b/sigmod/test/TestNature.cpp
index 042e9b13..6dadd156 100644
--- a/sigmod/test/TestNature.cpp
+++ b/sigmod/test/TestNature.cpp
@@ -19,21 +19,24 @@
#include "TestNature.h"
// Sigmod includes
+#include "../Game.h"
#include "../Nature.h"
#include "../Rules.h"
-#include "../Sigmod.h"
// Qt includes
#include <QtCore/QFile>
#include <QtTest/QTest>
+using namespace Sigcore;
+using namespace Sigmod;
+
void TestNature::initTestCase()
{
TestSigmodObject::initTestCase();
- m_nature1 = m_sigmod->newNature();
- m_nature2 = m_sigmod->newNature();
- m_nature3 = m_sigmod->newNature();
+ m_nature1 = m_game->newNature();
+ m_nature2 = m_game->newNature();
+ m_nature3 = m_game->newNature();
}
void TestNature::cleanupTestCase()
@@ -75,7 +78,7 @@ void TestNature::validation()
void TestNature::saving()
{
- QDomDocument xml = Sigmod::Object::xml(m_nature1);
+ QDomDocument xml = Object::xml(m_nature1);
QFile file("nature.xml");
QVERIFY(file.open(QIODevice::WriteOnly));
@@ -88,14 +91,14 @@ void TestNature::loading()
QDomDocument xml;
QFile file("nature.xml");
- m_sigmod->rules()->setSpecialSplit(true);
+ m_game->rules()->setSpecialSplit(true);
m_nature1->setName("Bar");
- m_nature1->setStat(Sigmod::ST_Attack, Sigcore::Fraction(2, 1));
- m_nature1->setStat(Sigmod::ST_Defense, Sigcore::Fraction(2, 1));
- m_nature1->setStat(Sigmod::ST_Speed, Sigcore::Fraction(2, 1));
- m_nature1->setStat(Sigmod::ST_SpecialAttack, Sigcore::Fraction(2, 1));
- m_nature1->setStat(Sigmod::ST_SpecialDefense, Sigcore::Fraction(2, 1));
+ m_nature1->setStat(ST_Attack, Fraction(2, 1));
+ m_nature1->setStat(ST_Defense, Fraction(2, 1));
+ m_nature1->setStat(ST_Speed, Fraction(2, 1));
+ m_nature1->setStat(ST_SpecialAttack, Fraction(2, 1));
+ m_nature1->setStat(ST_SpecialDefense, Fraction(2, 1));
m_nature1->setWeight(25);
QVERIFY(file.open(QIODevice::ReadOnly));
@@ -103,11 +106,11 @@ void TestNature::loading()
m_nature1->load(xml.firstChildElement("Nature"));
QCOMPARE(m_nature1->name(), QString("Foo"));
- QCOMPARE(m_nature1->stat(Sigmod::ST_Attack), Sigcore::Fraction(1, 1));
- QCOMPARE(m_nature1->stat(Sigmod::ST_Defense), Sigcore::Fraction(1, 1));
- QCOMPARE(m_nature1->stat(Sigmod::ST_Speed), Sigcore::Fraction(1, 1));
- QCOMPARE(m_nature1->stat(Sigmod::ST_SpecialAttack), Sigcore::Fraction(1, 1));
- QCOMPARE(m_nature1->stat(Sigmod::ST_SpecialDefense), Sigcore::Fraction(1, 1));
+ QCOMPARE(m_nature1->stat(ST_Attack), Fraction(1, 1));
+ QCOMPARE(m_nature1->stat(ST_Defense), Fraction(1, 1));
+ QCOMPARE(m_nature1->stat(ST_Speed), Fraction(1, 1));
+ QCOMPARE(m_nature1->stat(ST_SpecialAttack), Fraction(1, 1));
+ QCOMPARE(m_nature1->stat(ST_SpecialDefense), Fraction(1, 1));
QCOMPARE(m_nature1->weight(), 1);
}
@@ -126,68 +129,68 @@ void TestNature::setName()
void TestNature::setStat()
{
- m_nature2->setStat(Sigmod::ST_Attack, Sigcore::Fraction(-1, 2));
+ m_nature2->setStat(ST_Attack, Fraction(-1, 2));
QCOMPARE(m_changedCount, 0);
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 1);
- m_sigmod->rules()->setSpecialSplit(false);
+ m_game->rules()->setSpecialSplit(false);
- m_nature2->setStat(Sigmod::ST_SpecialDefense, Sigcore::Fraction(2, 1));
+ m_nature2->setStat(ST_SpecialDefense, Fraction(2, 1));
QCOMPARE(m_changedCount, 0);
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 2);
- m_sigmod->rules()->setSpecialSplit(true);
+ m_game->rules()->setSpecialSplit(true);
- m_nature2->setStat(Sigmod::ST_Attack, Sigcore::Fraction(2, 1));
- m_nature2->setStat(Sigmod::ST_Attack, Sigcore::Fraction(2, 1));
+ m_nature2->setStat(ST_Attack, Fraction(2, 1));
+ m_nature2->setStat(ST_Attack, Fraction(2, 1));
- QCOMPARE(m_nature2->stat(Sigmod::ST_Attack), Sigcore::Fraction(2, 1));
+ QCOMPARE(m_nature2->stat(ST_Attack), Fraction(2, 1));
QCOMPARE(m_changedCount, 1);
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 2);
- m_nature2->setStat(Sigmod::ST_Defense, Sigcore::Fraction(2, 1));
- m_nature2->setStat(Sigmod::ST_Defense, Sigcore::Fraction(2, 1));
+ m_nature2->setStat(ST_Defense, Fraction(2, 1));
+ m_nature2->setStat(ST_Defense, Fraction(2, 1));
- QCOMPARE(m_nature2->stat(Sigmod::ST_Defense), Sigcore::Fraction(2, 1));
+ QCOMPARE(m_nature2->stat(ST_Defense), Fraction(2, 1));
QCOMPARE(m_changedCount, 2);
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 2);
- m_nature2->setStat(Sigmod::ST_Speed, Sigcore::Fraction(2, 1));
- m_nature2->setStat(Sigmod::ST_Speed, Sigcore::Fraction(2, 1));
+ m_nature2->setStat(ST_Speed, Fraction(2, 1));
+ m_nature2->setStat(ST_Speed, Fraction(2, 1));
- QCOMPARE(m_nature2->stat(Sigmod::ST_Speed), Sigcore::Fraction(2, 1));
+ QCOMPARE(m_nature2->stat(ST_Speed), Fraction(2, 1));
QCOMPARE(m_changedCount, 3);
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 2);
- m_nature2->setStat(Sigmod::ST_SpecialAttack, Sigcore::Fraction(2, 1));
- m_nature2->setStat(Sigmod::ST_SpecialAttack, Sigcore::Fraction(2, 1));
+ m_nature2->setStat(ST_SpecialAttack, Fraction(2, 1));
+ m_nature2->setStat(ST_SpecialAttack, Fraction(2, 1));
- QCOMPARE(m_nature2->stat(Sigmod::ST_SpecialAttack), Sigcore::Fraction(2, 1));
+ QCOMPARE(m_nature2->stat(ST_SpecialAttack), Fraction(2, 1));
QCOMPARE(m_changedCount, 4);
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 2);
- m_nature2->setStat(Sigmod::ST_SpecialDefense, Sigcore::Fraction(2, 1));
- m_nature2->setStat(Sigmod::ST_SpecialDefense, Sigcore::Fraction(2, 1));
+ m_nature2->setStat(ST_SpecialDefense, Fraction(2, 1));
+ m_nature2->setStat(ST_SpecialDefense, Fraction(2, 1));
- QCOMPARE(m_nature2->stat(Sigmod::ST_SpecialDefense), Sigcore::Fraction(2, 1));
+ QCOMPARE(m_nature2->stat(ST_SpecialDefense), Fraction(2, 1));
QCOMPARE(m_changedCount, 5);
@@ -218,11 +221,11 @@ void TestNature::assignment()
*m_nature3 = *m_nature2;
QCOMPARE(m_nature3->name(), QString("Foo"));
- QCOMPARE(m_nature3->stat(Sigmod::ST_Attack), Sigcore::Fraction(2, 1));
- QCOMPARE(m_nature3->stat(Sigmod::ST_Defense), Sigcore::Fraction(2, 1));
- QCOMPARE(m_nature3->stat(Sigmod::ST_Speed), Sigcore::Fraction(2, 1));
- QCOMPARE(m_nature3->stat(Sigmod::ST_SpecialAttack), Sigcore::Fraction(2, 1));
- QCOMPARE(m_nature3->stat(Sigmod::ST_SpecialDefense), Sigcore::Fraction(2, 1));
+ QCOMPARE(m_nature3->stat(ST_Attack), Fraction(2, 1));
+ QCOMPARE(m_nature3->stat(ST_Defense), Fraction(2, 1));
+ QCOMPARE(m_nature3->stat(ST_Speed), Fraction(2, 1));
+ QCOMPARE(m_nature3->stat(ST_SpecialAttack), Fraction(2, 1));
+ QCOMPARE(m_nature3->stat(ST_SpecialDefense), Fraction(2, 1));
QCOMPARE(m_nature3->weight(), 5);
}