diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-02-24 15:53:15 -0500 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-02-24 15:53:15 -0500 |
commit | dde935e48d44ca1b2b8ce993ae5bc187a8ca30fd (patch) | |
tree | f317e6de1e2f2a187221a3f4586a2d00ab174237 /sigmod | |
parent | b3082840638dc89d48e621a0bf88f7887163ee08 (diff) | |
download | sigen-dde935e48d44ca1b2b8ce993ae5bc187a8ca30fd.tar.gz sigen-dde935e48d44ca1b2b8ce993ae5bc187a8ca30fd.tar.xz sigen-dde935e48d44ca1b2b8ce993ae5bc187a8ca30fd.zip |
Fixed sigmod tests to also use namespace Sigmod
Diffstat (limited to 'sigmod')
35 files changed, 872 insertions, 793 deletions
diff --git a/sigmod/test/TestAbility.cpp b/sigmod/test/TestAbility.cpp index fe8cbf3b..ca1b955d 100644 --- a/sigmod/test/TestAbility.cpp +++ b/sigmod/test/TestAbility.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,19 +20,22 @@ // Sigmod includes #include "../Ability.h" -#include "../Sigmod.h" +#include "../Game.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestAbility::initTestCase() { TestSigmodObject::initTestCase(); - m_ability1 = m_sigmod->newAbility(); - m_ability2 = m_sigmod->newAbility(); - m_ability3 = m_sigmod->newAbility(); + m_ability1 = m_game->newAbility(); + m_ability2 = m_game->newAbility(); + m_ability3 = m_game->newAbility(); } void TestAbility::cleanupTestCase() @@ -74,7 +77,7 @@ void TestAbility::validation() void TestAbility::saving() { - QDomDocument xml = Sigmod::Object::xml(m_ability1); + QDomDocument xml = Object::xml(m_ability1); QFile file("ability.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -90,9 +93,9 @@ void TestAbility::loading() m_ability1->setName("Bar"); m_ability1->setPriority(4); m_ability1->setDescription("Brief description."); - m_ability1->setBattleScript(Sigcore::Script("python", "import os")); - m_ability1->setWorldScript(Sigcore::Script("python", "import os")); - m_ability1->setPriorityScript(Sigcore::Script("python", "import os")); + m_ability1->setBattleScript(Script("python", "import os")); + m_ability1->setWorldScript(Script("python", "import os")); + m_ability1->setPriorityScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); @@ -101,9 +104,9 @@ void TestAbility::loading() QCOMPARE(m_ability1->name(), QString("Foo")); QCOMPARE(m_ability1->priority(), 0); QCOMPARE(m_ability1->description(), QString("")); - QCOMPARE(m_ability1->battleScript(), Sigcore::Script()); - QCOMPARE(m_ability1->worldScript(), Sigcore::Script()); - QCOMPARE(m_ability1->priorityScript(), Sigcore::Script()); + QCOMPARE(m_ability1->battleScript(), Script()); + QCOMPARE(m_ability1->worldScript(), Script()); + QCOMPARE(m_ability1->priorityScript(), Script()); } void TestAbility::setName() @@ -147,12 +150,12 @@ void TestAbility::setDescription() void TestAbility::setBattleScript() { - QCOMPARE(m_ability2->battleScript(), Sigcore::Script()); + QCOMPARE(m_ability2->battleScript(), Script()); - m_ability2->setBattleScript(Sigcore::Script("python", "import os")); - m_ability2->setBattleScript(Sigcore::Script("python", "import os")); + m_ability2->setBattleScript(Script("python", "import os")); + m_ability2->setBattleScript(Script("python", "import os")); - QCOMPARE(m_ability2->battleScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_ability2->battleScript(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -162,12 +165,12 @@ void TestAbility::setBattleScript() void TestAbility::setWorldScript() { - QCOMPARE(m_ability2->worldScript(), Sigcore::Script()); + QCOMPARE(m_ability2->worldScript(), Script()); - m_ability2->setWorldScript(Sigcore::Script("python", "import os")); - m_ability2->setWorldScript(Sigcore::Script("python", "import os")); + m_ability2->setWorldScript(Script("python", "import os")); + m_ability2->setWorldScript(Script("python", "import os")); - QCOMPARE(m_ability2->worldScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_ability2->worldScript(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -177,12 +180,12 @@ void TestAbility::setWorldScript() void TestAbility::setPriorityScript() { - QCOMPARE(m_ability2->priorityScript(), Sigcore::Script()); + QCOMPARE(m_ability2->priorityScript(), Script()); - m_ability2->setPriorityScript(Sigcore::Script("python", "import os")); - m_ability2->setPriorityScript(Sigcore::Script("python", "import os")); + m_ability2->setPriorityScript(Script("python", "import os")); + m_ability2->setPriorityScript(Script("python", "import os")); - QCOMPARE(m_ability2->priorityScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_ability2->priorityScript(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -197,9 +200,9 @@ void TestAbility::assignment() QCOMPARE(m_ability3->name(), QString("Foo")); QCOMPARE(m_ability3->priority(), 4); QCOMPARE(m_ability3->description(), QString("Brief description.")); - QCOMPARE(m_ability3->battleScript(), Sigcore::Script("python", "import os")); - QCOMPARE(m_ability3->worldScript(), Sigcore::Script("python", "import os")); - QCOMPARE(m_ability3->priorityScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_ability3->battleScript(), Script("python", "import os")); + QCOMPARE(m_ability3->worldScript(), Script("python", "import os")); + QCOMPARE(m_ability3->priorityScript(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestAbility) diff --git a/sigmod/test/TestAuthor.cpp b/sigmod/test/TestAuthor.cpp index c3f27e8b..8b81a983 100644 --- a/sigmod/test/TestAuthor.cpp +++ b/sigmod/test/TestAuthor.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,19 +20,21 @@ // Sigmod includes #include "../Author.h" -#include "../Sigmod.h" +#include "../Game.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestAuthor::initTestCase() { TestSigmodObject::initTestCase(); - m_author1 = m_sigmod->newAuthor(); - m_author2 = m_sigmod->newAuthor(); - m_author3 = m_sigmod->newAuthor(); + m_author1 = m_game->newAuthor(); + m_author2 = m_game->newAuthor(); + m_author3 = m_game->newAuthor(); } void TestAuthor::cleanupTestCase() @@ -92,7 +94,7 @@ void TestAuthor::validation() void TestAuthor::saving() { - QDomDocument xml = Sigmod::Object::xml(m_author1); + QDomDocument xml = Object::xml(m_author1); QFile file("author.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); diff --git a/sigmod/test/TestBadge.cpp b/sigmod/test/TestBadge.cpp index ebdad7ff..d60bd480 100644 --- a/sigmod/test/TestBadge.cpp +++ b/sigmod/test/TestBadge.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,20 +20,23 @@ // Sigmod includes #include "../Badge.h" +#include "../Game.h" #include "../Rules.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestBadge::initTestCase() { TestSigmodObject::initTestCase(); - m_badge1 = m_sigmod->newBadge(); - m_badge2 = m_sigmod->newBadge(); - m_badge3 = m_sigmod->newBadge(); + m_badge1 = m_game->newBadge(); + m_badge2 = m_game->newBadge(); + m_badge3 = m_game->newBadge(); } void TestBadge::cleanupTestCase() @@ -72,8 +75,8 @@ void TestBadge::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); - m_sigmod->newSprite(); - m_sigmod->newSprite(); + m_game->newSprite(); + m_game->newSprite(); m_badge1->setFace(0); m_badge1->validate(); @@ -93,7 +96,7 @@ void TestBadge::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 9); - m_sigmod->rules()->setMaxLevel(25); + m_game->rules()->setMaxLevel(25); m_badge1->setObey(15); m_badge1->validate(); @@ -101,7 +104,7 @@ void TestBadge::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 9); - m_sigmod->rules()->setMaxLevel(10); + m_game->rules()->setMaxLevel(10); m_badge1->validate(); @@ -111,7 +114,7 @@ void TestBadge::validation() void TestBadge::saving() { - QDomDocument xml = Sigmod::Object::xml(m_badge1); + QDomDocument xml = Object::xml(m_badge1); QFile file("badge.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -124,17 +127,17 @@ void TestBadge::loading() QDomDocument xml; QFile file("badge.xml"); - m_sigmod->rules()->setSpecialSplit(true); + m_game->rules()->setSpecialSplit(true); m_badge1->setName("Bar"); m_badge1->setFace(1); m_badge1->setBadge(0); m_badge1->setObey(5); - m_badge1->setStat(Sigmod::ST_Attack, Sigcore::Fraction(2, 1)); - m_badge1->setStat(Sigmod::ST_Defense, Sigcore::Fraction(2, 1)); - m_badge1->setStat(Sigmod::ST_Speed, Sigcore::Fraction(2, 1)); - m_badge1->setStat(Sigmod::ST_SpecialAttack, Sigcore::Fraction(2, 1)); - m_badge1->setStat(Sigmod::ST_SpecialDefense, Sigcore::Fraction(2, 1)); + m_badge1->setStat(ST_Attack, Fraction(2, 1)); + m_badge1->setStat(ST_Defense, Fraction(2, 1)); + m_badge1->setStat(ST_Speed, Fraction(2, 1)); + m_badge1->setStat(ST_SpecialAttack, Fraction(2, 1)); + m_badge1->setStat(ST_SpecialDefense, Fraction(2, 1)); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); @@ -144,11 +147,11 @@ void TestBadge::loading() QCOMPARE(m_badge1->face(), 0); QCOMPARE(m_badge1->badge(), 1); QCOMPARE(m_badge1->obey(), 15); - QCOMPARE(m_badge1->stat(Sigmod::ST_Attack), Sigcore::Fraction(1, 1)); - QCOMPARE(m_badge1->stat(Sigmod::ST_Defense), Sigcore::Fraction(1, 1)); - QCOMPARE(m_badge1->stat(Sigmod::ST_Speed), Sigcore::Fraction(1, 1)); - QCOMPARE(m_badge1->stat(Sigmod::ST_SpecialAttack), Sigcore::Fraction(1, 1)); - QCOMPARE(m_badge1->stat(Sigmod::ST_SpecialDefense), Sigcore::Fraction(1, 1)); + QCOMPARE(m_badge1->stat(ST_Attack), Fraction(1, 1)); + QCOMPARE(m_badge1->stat(ST_Defense), Fraction(1, 1)); + QCOMPARE(m_badge1->stat(ST_Speed), Fraction(1, 1)); + QCOMPARE(m_badge1->stat(ST_SpecialAttack), Fraction(1, 1)); + QCOMPARE(m_badge1->stat(ST_SpecialDefense), Fraction(1, 1)); } void TestBadge::setName() @@ -173,7 +176,7 @@ void TestBadge::setFace() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newSprite(); + m_game->newSprite(); m_badge2->setFace(2); m_badge2->setFace(2); @@ -195,7 +198,7 @@ void TestBadge::setBadge() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newSprite(); + m_game->newSprite(); m_badge2->setBadge(3); m_badge2->setBadge(3); @@ -217,7 +220,7 @@ void TestBadge::setObey() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->rules()->setMaxLevel(100); + m_game->rules()->setMaxLevel(100); m_badge2->setObey(50); m_badge2->setObey(50); @@ -232,68 +235,68 @@ void TestBadge::setObey() void TestBadge::setStat() { - m_badge2->setStat(Sigmod::ST_Attack, Sigcore::Fraction(1, 2)); + m_badge2->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_badge2->setStat(Sigmod::ST_SpecialDefense, Sigcore::Fraction(2, 1)); + m_badge2->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_badge2->setStat(Sigmod::ST_Attack, Sigcore::Fraction(2, 1)); - m_badge2->setStat(Sigmod::ST_Attack, Sigcore::Fraction(2, 1)); + m_badge2->setStat(ST_Attack, Fraction(2, 1)); + m_badge2->setStat(ST_Attack, Fraction(2, 1)); - QCOMPARE(m_badge2->stat(Sigmod::ST_Attack), Sigcore::Fraction(2, 1)); + QCOMPARE(m_badge2->stat(ST_Attack), Fraction(2, 1)); QCOMPARE(m_changedCount, 1); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_badge2->setStat(Sigmod::ST_Defense, Sigcore::Fraction(2, 1)); - m_badge2->setStat(Sigmod::ST_Defense, Sigcore::Fraction(2, 1)); + m_badge2->setStat(ST_Defense, Fraction(2, 1)); + m_badge2->setStat(ST_Defense, Fraction(2, 1)); - QCOMPARE(m_badge2->stat(Sigmod::ST_Defense), Sigcore::Fraction(2, 1)); + QCOMPARE(m_badge2->stat(ST_Defense), Fraction(2, 1)); QCOMPARE(m_changedCount, 2); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_badge2->setStat(Sigmod::ST_Speed, Sigcore::Fraction(2, 1)); - m_badge2->setStat(Sigmod::ST_Speed, Sigcore::Fraction(2, 1)); + m_badge2->setStat(ST_Speed, Fraction(2, 1)); + m_badge2->setStat(ST_Speed, Fraction(2, 1)); - QCOMPARE(m_badge2->stat(Sigmod::ST_Speed), Sigcore::Fraction(2, 1)); + QCOMPARE(m_badge2->stat(ST_Speed), Fraction(2, 1)); QCOMPARE(m_changedCount, 3); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_badge2->setStat(Sigmod::ST_SpecialAttack, Sigcore::Fraction(2, 1)); - m_badge2->setStat(Sigmod::ST_SpecialAttack, Sigcore::Fraction(2, 1)); + m_badge2->setStat(ST_SpecialAttack, Fraction(2, 1)); + m_badge2->setStat(ST_SpecialAttack, Fraction(2, 1)); - QCOMPARE(m_badge2->stat(Sigmod::ST_SpecialAttack), Sigcore::Fraction(2, 1)); + QCOMPARE(m_badge2->stat(ST_SpecialAttack), Fraction(2, 1)); QCOMPARE(m_changedCount, 4); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_badge2->setStat(Sigmod::ST_SpecialDefense, Sigcore::Fraction(2, 1)); - m_badge2->setStat(Sigmod::ST_SpecialDefense, Sigcore::Fraction(2, 1)); + m_badge2->setStat(ST_SpecialDefense, Fraction(2, 1)); + m_badge2->setStat(ST_SpecialDefense, Fraction(2, 1)); - QCOMPARE(m_badge2->stat(Sigmod::ST_SpecialDefense), Sigcore::Fraction(2, 1)); + QCOMPARE(m_badge2->stat(ST_SpecialDefense), Fraction(2, 1)); QCOMPARE(m_changedCount, 5); @@ -309,11 +312,11 @@ void TestBadge::assignment() QCOMPARE(m_badge3->face(), 2); QCOMPARE(m_badge3->badge(), 3); QCOMPARE(m_badge3->obey(), 50); - QCOMPARE(m_badge3->stat(Sigmod::ST_Attack), Sigcore::Fraction(2, 1)); - QCOMPARE(m_badge3->stat(Sigmod::ST_Defense), Sigcore::Fraction(2, 1)); - QCOMPARE(m_badge3->stat(Sigmod::ST_Speed), Sigcore::Fraction(2, 1)); - QCOMPARE(m_badge3->stat(Sigmod::ST_SpecialAttack), Sigcore::Fraction(2, 1)); - QCOMPARE(m_badge3->stat(Sigmod::ST_SpecialDefense), Sigcore::Fraction(2, 1)); + QCOMPARE(m_badge3->stat(ST_Attack), Fraction(2, 1)); + QCOMPARE(m_badge3->stat(ST_Defense), Fraction(2, 1)); + QCOMPARE(m_badge3->stat(ST_Speed), Fraction(2, 1)); + QCOMPARE(m_badge3->stat(ST_SpecialAttack), Fraction(2, 1)); + QCOMPARE(m_badge3->stat(ST_SpecialDefense), Fraction(2, 1)); } QTEST_APPLESS_MAIN(TestBadge) diff --git a/sigmod/test/TestCoinList.cpp b/sigmod/test/TestCoinList.cpp index f423fc06..d64b7dcc 100644 --- a/sigmod/test/TestCoinList.cpp +++ b/sigmod/test/TestCoinList.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,19 +21,22 @@ // Sigmod includes #include "../CoinList.h" #include "../CoinListItem.h" -#include "../Sigmod.h" +#include "../Game.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestCoinList::initTestCase() { TestSigmodObject::initTestCase(); - m_coinList1 = m_sigmod->newCoinList(); - m_coinList2 = m_sigmod->newCoinList(); - m_coinList3 = m_sigmod->newCoinList(); + m_coinList1 = m_game->newCoinList(); + m_coinList2 = m_game->newCoinList(); + m_coinList3 = m_game->newCoinList(); } void TestCoinList::cleanupTestCase() @@ -81,7 +84,7 @@ void TestCoinList::validation() void TestCoinList::saving() { - QDomDocument xml = Sigmod::Object::xml(m_coinList1); + QDomDocument xml = Object::xml(m_coinList1); QFile file("coinList.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -95,7 +98,7 @@ void TestCoinList::loading() QFile file("coinList.xml"); m_coinList1->setName("Bar"); - m_coinList1->setScript(Sigcore::Script("python", "import os")); + m_coinList1->setScript(Script("python", "import os")); m_coinList1->newItem(); QVERIFY(file.open(QIODevice::ReadOnly)); @@ -103,7 +106,7 @@ void TestCoinList::loading() m_coinList1->load(xml.firstChildElement("CoinList")); QCOMPARE(m_coinList1->name(), QString("Foo")); - QCOMPARE(m_coinList1->script(), Sigcore::Script()); + QCOMPARE(m_coinList1->script(), Script()); QCOMPARE(m_coinList1->itemCount(), 1); } @@ -122,10 +125,10 @@ void TestCoinList::setName() void TestCoinList::setScript() { - m_coinList2->setScript(Sigcore::Script("python", "import os")); - m_coinList2->setScript(Sigcore::Script("python", "import os")); + m_coinList2->setScript(Script("python", "import os")); + m_coinList2->setScript(Script("python", "import os")); - QCOMPARE(m_coinList2->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_coinList2->script(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -162,7 +165,7 @@ void TestCoinList::assignment() *m_coinList3 = *m_coinList2; QCOMPARE(m_coinList3->name(), QString("Foo")); - QCOMPARE(m_coinList3->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_coinList3->script(), Script("python", "import os")); QCOMPARE(m_coinList3->itemCount(), 2); } diff --git a/sigmod/test/TestCoinListItem.cpp b/sigmod/test/TestCoinListItem.cpp index c1939cde..67d478e7 100644 --- a/sigmod/test/TestCoinListItem.cpp +++ b/sigmod/test/TestCoinListItem.cpp @@ -21,17 +21,19 @@ // Sigmod includes #include "../CoinList.h" #include "../CoinListItem.h" -#include "../Sigmod.h" +#include "../Game.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestCoinListItem::initTestCase() { TestSigmodObject::initTestCase(); - Sigmod::CoinList* coinList = m_sigmod->newCoinList(); + CoinList* coinList = m_game->newCoinList(); m_item1 = coinList->newItem(); m_item2 = coinList->newItem(); @@ -68,7 +70,7 @@ void TestCoinListItem::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_sigmod->newItem(); + m_game->newItem(); m_item1->setObject(0); m_item1->validate(); @@ -76,13 +78,13 @@ void TestCoinListItem::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_item1->setType(Sigmod::CoinListItem::Species); + m_item1->setType(CoinListItem::Species); m_item1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 5); - m_sigmod->newSpecies(); + m_game->newSpecies(); m_item1->validate(); QCOMPARE(m_warnings.size(), 0); @@ -97,7 +99,7 @@ void TestCoinListItem::validation() void TestCoinListItem::saving() { - QDomDocument xml = Sigmod::Object::xml(m_item1); + QDomDocument xml = Object::xml(m_item1); QFile file("coinListItem.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -110,9 +112,9 @@ void TestCoinListItem::loading() QDomDocument xml; QFile file("coinListItem.xml"); - m_sigmod->newItem(); + m_game->newItem(); - m_item1->setType(Sigmod::CoinListItem::Item); + m_item1->setType(CoinListItem::Item); m_item1->setObject(1); m_item1->setCost(25); @@ -120,17 +122,17 @@ void TestCoinListItem::loading() QVERIFY(xml.setContent(&file)); m_item1->load(xml.firstChildElement("CoinListItem")); - QCOMPARE(m_item1->type(), Sigmod::CoinListItem::Species); + QCOMPARE(m_item1->type(), CoinListItem::Species); QCOMPARE(m_item1->object(), 0); QCOMPARE(m_item1->cost(), 20); } void TestCoinListItem::setType() { - m_item2->setType(Sigmod::CoinListItem::Species); - m_item2->setType(Sigmod::CoinListItem::Species); + m_item2->setType(CoinListItem::Species); + m_item2->setType(CoinListItem::Species); - QCOMPARE(m_item2->type(), Sigmod::CoinListItem::Species); + QCOMPARE(m_item2->type(), CoinListItem::Species); QCOMPARE(m_changedCount, 1); @@ -168,7 +170,7 @@ void TestCoinListItem::assignment() { *m_item3 = *m_item2; - QCOMPARE(m_item3->type(), Sigmod::CoinListItem::Species); + QCOMPARE(m_item3->type(), CoinListItem::Species); QCOMPARE(m_item3->object(), 0); QCOMPARE(m_item3->cost(), 15); } diff --git a/sigmod/test/TestEggGroup.cpp b/sigmod/test/TestEggGroup.cpp index b84226e3..5883312c 100644 --- a/sigmod/test/TestEggGroup.cpp +++ b/sigmod/test/TestEggGroup.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,19 +20,21 @@ // Sigmod includes #include "../EggGroup.h" -#include "../Sigmod.h" +#include "../Game.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestEggGroup::initTestCase() { TestSigmodObject::initTestCase(); - m_eggGroup1 = m_sigmod->newEggGroup(); - m_eggGroup2 = m_sigmod->newEggGroup(); - m_eggGroup3 = m_sigmod->newEggGroup(); + m_eggGroup1 = m_game->newEggGroup(); + m_eggGroup2 = m_game->newEggGroup(); + m_eggGroup3 = m_game->newEggGroup(); } void TestEggGroup::cleanupTestCase() @@ -74,7 +76,7 @@ void TestEggGroup::validation() void TestEggGroup::saving() { - QDomDocument xml = Sigmod::Object::xml(m_eggGroup1); + QDomDocument xml = Object::xml(m_eggGroup1); QFile file("eggGroup.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); diff --git a/sigmod/test/TestGlobalScript.cpp b/sigmod/test/TestGlobalScript.cpp index 8556e4ad..81dd50a5 100644 --- a/sigmod/test/TestGlobalScript.cpp +++ b/sigmod/test/TestGlobalScript.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,20 +19,23 @@ #include "TestGlobalScript.h" // Sigmod includes +#include "../Game.h" #include "../GlobalScript.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestGlobalScript::initTestCase() { TestSigmodObject::initTestCase(); - m_globalScript1 = m_sigmod->newGlobalScript(); - m_globalScript2 = m_sigmod->newGlobalScript(); - m_globalScript3 = m_sigmod->newGlobalScript(); + m_globalScript1 = m_game->newGlobalScript(); + m_globalScript2 = m_game->newGlobalScript(); + m_globalScript3 = m_game->newGlobalScript(); } void TestGlobalScript::cleanupTestCase() @@ -74,7 +77,7 @@ void TestGlobalScript::validation() void TestGlobalScript::saving() { - QDomDocument xml = Sigmod::Object::xml(m_globalScript1); + QDomDocument xml = Object::xml(m_globalScript1); QFile file("globalScript.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -88,14 +91,14 @@ void TestGlobalScript::loading() QFile file("globalScript.xml"); m_globalScript1->setName("Bar"); - m_globalScript1->setScript(Sigcore::Script("python", "import os")); + m_globalScript1->setScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); m_globalScript1->load(xml.firstChildElement("GlobalScript")); QCOMPARE(m_globalScript1->name(), QString("Foo")); - QCOMPARE(m_globalScript1->script(), Sigcore::Script()); + QCOMPARE(m_globalScript1->script(), Script()); } void TestGlobalScript::setName() @@ -113,10 +116,10 @@ void TestGlobalScript::setName() void TestGlobalScript::setScript() { - m_globalScript2->setScript(Sigcore::Script("python", "import os")); - m_globalScript2->setScript(Sigcore::Script("python", "import os")); + m_globalScript2->setScript(Script("python", "import os")); + m_globalScript2->setScript(Script("python", "import os")); - QCOMPARE(m_globalScript2->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_globalScript2->script(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -129,7 +132,7 @@ void TestGlobalScript::assignment() *m_globalScript3 = *m_globalScript2; QCOMPARE(m_globalScript3->name(), QString("Foo")); - QCOMPARE(m_globalScript3->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_globalScript3->script(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestGlobalScript) diff --git a/sigmod/test/TestItem.cpp b/sigmod/test/TestItem.cpp index c2f4a639..f5cf12b3 100644 --- a/sigmod/test/TestItem.cpp +++ b/sigmod/test/TestItem.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,24 +19,25 @@ #include "TestItem.h" // Sigmod includes +#include "../Game.h" #include "../Item.h" #include "../ItemType.h" #include "../Rules.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> -#include <QtCore/QtDebug> +using namespace Sigcore; +using namespace Sigmod; void TestItem::initTestCase() { TestSigmodObject::initTestCase(); - m_item1 = m_sigmod->newItem(); - m_item2 = m_sigmod->newItem(); - m_item3 = m_sigmod->newItem(); + m_item1 = m_game->newItem(); + m_item2 = m_game->newItem(); + m_item3 = m_game->newItem(); } void TestItem::cleanupTestCase() @@ -75,7 +76,7 @@ void TestItem::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 5); - m_sigmod->newItemType(); + m_game->newItemType(); m_item1->setType(0); m_item1->validate(); @@ -83,7 +84,7 @@ void TestItem::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 6); - m_sigmod->rules()->setMaxMoney(1000); + m_game->rules()->setMaxMoney(1000); m_item1->setPrice(500); m_item1->validate(); @@ -113,8 +114,8 @@ void TestItem::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); - m_sigmod->rules()->setMaxTotalWeight(100); - m_sigmod->itemType(0)->setMaxWeight(50); + m_game->rules()->setMaxTotalWeight(100); + m_game->itemType(0)->setMaxWeight(50); m_item1->setWeight(20); m_item1->validate(); @@ -122,14 +123,14 @@ void TestItem::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); - m_sigmod->itemType(0)->setMaxWeight(10); + m_game->itemType(0)->setMaxWeight(10); m_item1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 8); - m_sigmod->itemType(0)->setMaxWeight(50); + m_game->itemType(0)->setMaxWeight(50); m_item1->validate(); @@ -139,7 +140,7 @@ void TestItem::validation() void TestItem::saving() { - QDomDocument xml = Sigmod::Object::xml(m_item1); + QDomDocument xml = Object::xml(m_item1); QFile file("item.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -152,7 +153,7 @@ void TestItem::loading() QDomDocument xml; QFile file("item.xml"); - m_sigmod->newItemType(); + m_game->newItemType(); m_item1->setName("Bar"); m_item1->setSellable(false); @@ -161,7 +162,7 @@ void TestItem::loading() m_item1->setSellPrice(10); m_item1->setWeight(10); m_item1->setDescription("An item."); - m_item1->setScript(Sigcore::Script("python", "import os")); + m_item1->setScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); @@ -174,7 +175,7 @@ void TestItem::loading() QCOMPARE(m_item1->sellPrice(), 250); QCOMPARE(m_item1->weight(), 20); QCOMPARE(m_item1->description(), QString("")); - QCOMPARE(m_item1->script(), Sigcore::Script()); + QCOMPARE(m_item1->script(), Script()); } void TestItem::setName() @@ -210,7 +211,7 @@ void TestItem::setType() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newItemType(); + m_game->newItemType(); m_item2->setType(2); m_item2->setType(2); @@ -281,7 +282,7 @@ void TestItem::setWeight() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_sigmod->itemType(2)->setMaxWeight(50); + m_game->itemType(2)->setMaxWeight(50); m_item2->setWeight(20); m_item2->setWeight(20); @@ -309,10 +310,10 @@ void TestItem::setDescription() void TestItem::setScript() { - m_item2->setScript(Sigcore::Script("python", "import os")); - m_item2->setScript(Sigcore::Script("python", "import os")); + m_item2->setScript(Script("python", "import os")); + m_item2->setScript(Script("python", "import os")); - QCOMPARE(m_item2->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_item2->script(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -331,7 +332,7 @@ void TestItem::assignment() QCOMPARE(m_item3->sellPrice(), 50); QCOMPARE(m_item3->weight(), 20); QCOMPARE(m_item3->description(), QString("An item.")); - QCOMPARE(m_item3->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_item3->script(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestItem) diff --git a/sigmod/test/TestItemType.cpp b/sigmod/test/TestItemType.cpp index a198a906..f2fc9463 100644 --- a/sigmod/test/TestItemType.cpp +++ b/sigmod/test/TestItemType.cpp @@ -19,23 +19,25 @@ #include "TestItemType.h" // Sigmod includes +#include "../Game.h" #include "../ItemType.h" #include "../Rules.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestItemType::initTestCase() { TestSigmodObject::initTestCase(); - m_itemType1 = m_sigmod->newItemType(); - m_itemType2 = m_sigmod->newItemType(); - m_itemType3 = m_sigmod->newItemType(); + m_itemType1 = m_game->newItemType(); + m_itemType2 = m_game->newItemType(); + m_itemType3 = m_game->newItemType(); - m_itemType1->setCount(Sigmod::ItemType::Total); + m_itemType1->setCount(ItemType::Total); } void TestItemType::cleanupTestCase() @@ -74,7 +76,7 @@ void TestItemType::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->rules()->setMaxTotalWeight(100); + m_game->rules()->setMaxTotalWeight(100); m_itemType1->setMaxWeight(50); m_itemType1->validate(); @@ -82,14 +84,14 @@ void TestItemType::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->rules()->setMaxTotalWeight(25); + m_game->rules()->setMaxTotalWeight(25); m_itemType1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_sigmod->rules()->setMaxTotalWeight(100); + m_game->rules()->setMaxTotalWeight(100); m_itemType1->validate(); @@ -99,7 +101,7 @@ void TestItemType::validation() void TestItemType::saving() { - QDomDocument xml = Sigmod::Object::xml(m_itemType1); + QDomDocument xml = Object::xml(m_itemType1); QFile file("itemType.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -116,7 +118,7 @@ void TestItemType::loading() m_itemType1->setComputer(10); m_itemType1->setPlayer(25); m_itemType1->setMaxWeight(75); - m_itemType1->setCount(Sigmod::ItemType::Distinct); + m_itemType1->setCount(ItemType::Distinct); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); @@ -126,7 +128,7 @@ void TestItemType::loading() QCOMPARE(m_itemType1->computer(), 0); QCOMPARE(m_itemType1->player(), 1); QCOMPARE(m_itemType1->maxWeight(), 50); - QCOMPARE(m_itemType1->count(), Sigmod::ItemType::Total); + QCOMPARE(m_itemType1->count(), ItemType::Total); } void TestItemType::setName() @@ -198,10 +200,10 @@ void TestItemType::setMaxWeight() void TestItemType::setCount() { - m_itemType2->setCount(Sigmod::ItemType::Total); - m_itemType2->setCount(Sigmod::ItemType::Total); + m_itemType2->setCount(ItemType::Total); + m_itemType2->setCount(ItemType::Total); - QCOMPARE(m_itemType2->count(), Sigmod::ItemType::Total); + QCOMPARE(m_itemType2->count(), ItemType::Total); QCOMPARE(m_changedCount, 1); @@ -217,7 +219,7 @@ void TestItemType::assignment() QCOMPARE(m_itemType3->computer(), 10); QCOMPARE(m_itemType3->player(), 5); QCOMPARE(m_itemType3->maxWeight(), 25); - QCOMPARE(m_itemType3->count(), Sigmod::ItemType::Total); + QCOMPARE(m_itemType3->count(), ItemType::Total); } QTEST_APPLESS_MAIN(TestItemType) diff --git a/sigmod/test/TestMap.cpp b/sigmod/test/TestMap.cpp index b96fd371..95cbae13 100644 --- a/sigmod/test/TestMap.cpp +++ b/sigmod/test/TestMap.cpp @@ -19,25 +19,27 @@ #include "TestMap.h" // Sigmod includes +#include "../Game.h" #include "../Map.h" #include "../MapEffect.h" #include "../MapTile.h" #include "../MapTrainer.h" #include "../MapWarp.h" #include "../MapWildList.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestMap::initTestCase() { TestSigmodObject::initTestCase(); - m_map1 = m_sigmod->newMap(); - m_map2 = m_sigmod->newMap(); - m_map3 = m_sigmod->newMap(); + m_map1 = m_game->newMap(); + m_map2 = m_game->newMap(); + m_map3 = m_game->newMap(); } void TestMap::cleanupTestCase() @@ -114,7 +116,7 @@ void TestMap::validation() void TestMap::saving() { - QDomDocument xml = Sigmod::Object::xml(m_map1); + QDomDocument xml = Object::xml(m_map1); QFile file("map.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -134,7 +136,7 @@ void TestMap::loading() m_map1->newWildList(); m_map1->setName("Bar"); - m_map1->setType(Sigmod::Map::Dungeon); + m_map1->setType(Map::Dungeon); m_map1->setWidth(5); m_map1->setHeight(5); @@ -143,7 +145,7 @@ void TestMap::loading() m_map1->load(xml.firstChildElement("Map")); QCOMPARE(m_map1->name(), QString("Foo")); - QCOMPARE(m_map1->type(), Sigmod::Map::Outdoor); + QCOMPARE(m_map1->type(), Map::Outdoor); QCOMPARE(m_map1->width(), 1); QCOMPARE(m_map1->height(), 1); QCOMPARE(m_map1->effectCount(), 1); @@ -168,10 +170,10 @@ void TestMap::setName() void TestMap::setType() { - m_map2->setType(Sigmod::Map::Dungeon); - m_map2->setType(Sigmod::Map::Dungeon); + m_map2->setType(Map::Dungeon); + m_map2->setType(Map::Dungeon); - QCOMPARE(m_map2->type(), Sigmod::Map::Dungeon); + QCOMPARE(m_map2->type(), Map::Dungeon); QCOMPARE(m_changedCount, 1); @@ -340,7 +342,7 @@ void TestMap::assignment() *m_map3 = *m_map2; QCOMPARE(m_map3->name(), QString("Foo")); - QCOMPARE(m_map3->type(), Sigmod::Map::Dungeon); + QCOMPARE(m_map3->type(), Map::Dungeon); QCOMPARE(m_map3->width(), 5); QCOMPARE(m_map3->height(), 5); QCOMPARE(m_map3->effectCount(), 2); diff --git a/sigmod/test/TestMapEffect.cpp b/sigmod/test/TestMapEffect.cpp index 95ad3c12..362167d9 100644 --- a/sigmod/test/TestMapEffect.cpp +++ b/sigmod/test/TestMapEffect.cpp @@ -19,19 +19,22 @@ #include "TestMapEffect.h" // Sigmod includes +#include "../Game.h" #include "../Map.h" #include "../MapEffect.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestMapEffect::initTestCase() { TestSigmodObject::initTestCase(); - Sigmod::Map* map = m_sigmod->newMap(); + Map* map = m_game->newMap(); m_effect1 = map->newEffect(); m_effect2 = map->newEffect(); @@ -74,8 +77,8 @@ void TestMapEffect::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_sigmod->map(0)->setWidth(25); - m_sigmod->map(0)->setHeight(25); + m_game->map(0)->setWidth(25); + m_game->map(0)->setHeight(25); m_effect1->setPosition(QPoint(20, 20)); m_effect1->validate(); @@ -83,23 +86,23 @@ void TestMapEffect::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 4); - m_sigmod->map(0)->setWidth(20); - m_sigmod->map(0)->setHeight(20); + m_game->map(0)->setWidth(20); + m_game->map(0)->setHeight(20); m_effect1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 6); - m_sigmod->map(0)->setWidth(25); - m_sigmod->map(0)->setHeight(25); + m_game->map(0)->setWidth(25); + m_game->map(0)->setHeight(25); m_effect1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); - m_sigmod->newSkin(); + m_game->newSkin(); m_effect1->setSkin(0); m_effect1->validate(); @@ -110,7 +113,7 @@ void TestMapEffect::validation() void TestMapEffect::saving() { - QDomDocument xml = Sigmod::Object::xml(m_effect1); + QDomDocument xml = Object::xml(m_effect1); QFile file("mapEffect.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -123,13 +126,13 @@ void TestMapEffect::loading() QDomDocument xml; QFile file("mapEffect.xml"); - m_sigmod->newSkin(); + m_game->newSkin(); m_effect1->setName("Bar"); m_effect1->setPosition(QPoint(3, 3)); m_effect1->setSkin(1); m_effect1->setIsGhost(true); - m_effect1->setScript(Sigcore::Script("python", "import os")); + m_effect1->setScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); @@ -139,7 +142,7 @@ void TestMapEffect::loading() QCOMPARE(m_effect1->position(), QPoint(20, 20)); QCOMPARE(m_effect1->skin(), 0); QCOMPARE(m_effect1->isGhost(), false); - QCOMPARE(m_effect1->script(), Sigcore::Script()); + QCOMPARE(m_effect1->script(), Script()); } void TestMapEffect::setName() @@ -185,7 +188,7 @@ void TestMapEffect::setSkin() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newSkin(); + m_game->newSkin(); m_effect2->setSkin(2); m_effect2->setSkin(2); @@ -213,10 +216,10 @@ void TestMapEffect::setIsGhost() void TestMapEffect::setScript() { - m_effect2->setScript(Sigcore::Script("python", "import os")); - m_effect2->setScript(Sigcore::Script("python", "import os")); + m_effect2->setScript(Script("python", "import os")); + m_effect2->setScript(Script("python", "import os")); - QCOMPARE(m_effect2->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_effect2->script(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -232,7 +235,7 @@ void TestMapEffect::assignment() QCOMPARE(m_effect3->position(), QPoint(20, 20)); QCOMPARE(m_effect3->skin(), 2); QCOMPARE(m_effect3->isGhost(), true); - QCOMPARE(m_effect3->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_effect3->script(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestMapEffect) diff --git a/sigmod/test/TestMapTile.cpp b/sigmod/test/TestMapTile.cpp index 2df855b5..dea3cde3 100644 --- a/sigmod/test/TestMapTile.cpp +++ b/sigmod/test/TestMapTile.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,19 +19,21 @@ #include "TestMapTile.h" // Sigmod includes +#include "../Game.h" #include "../Map.h" #include "../MapTile.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestMapTile::initTestCase() { TestSigmodObject::initTestCase(); - Sigmod::Map* map = m_sigmod->newMap(); + Map* map = m_game->newMap(); m_mapTile1 = map->newTile(); m_mapTile2 = map->newTile(); @@ -68,7 +70,7 @@ void TestMapTile::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newTile(); + m_game->newTile(); m_mapTile1->setTile(0); m_mapTile1->validate(); @@ -76,8 +78,8 @@ void TestMapTile::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->map(0)->setHeight(20); - m_sigmod->map(0)->setWidth(20); + m_game->map(0)->setHeight(20); + m_game->map(0)->setWidth(20); m_mapTile1->setPosition(QPoint(10, 10)); m_mapTile1->validate(); @@ -85,8 +87,8 @@ void TestMapTile::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->map(0)->setHeight(5); - m_sigmod->map(0)->setWidth(5); + m_game->map(0)->setHeight(5); + m_game->map(0)->setWidth(5); m_mapTile1->validate(); @@ -96,7 +98,7 @@ void TestMapTile::validation() void TestMapTile::saving() { - QDomDocument xml = Sigmod::Object::xml(m_mapTile1); + QDomDocument xml = Object::xml(m_mapTile1); QFile file("mapTile.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -109,7 +111,7 @@ void TestMapTile::loading() QDomDocument xml; QFile file("mapTile.xml"); - m_sigmod->newTile(); + m_game->newTile(); m_mapTile1->setTile(1); m_mapTile1->setPosition(QPoint(2, 2)); @@ -131,7 +133,7 @@ void TestMapTile::setTile() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newTile(); + m_game->newTile(); m_mapTile2->setTile(2); m_mapTile2->setTile(2); @@ -156,8 +158,8 @@ void TestMapTile::setPosition() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_sigmod->map(0)->setHeight(50); - m_sigmod->map(0)->setWidth(50); + m_game->map(0)->setHeight(50); + m_game->map(0)->setWidth(50); m_mapTile2->setPosition(QPoint(25, 25)); m_mapTile2->setPosition(QPoint(25, 25)); diff --git a/sigmod/test/TestMapTrainer.cpp b/sigmod/test/TestMapTrainer.cpp index 29ec2c17..80127756 100644 --- a/sigmod/test/TestMapTrainer.cpp +++ b/sigmod/test/TestMapTrainer.cpp @@ -19,21 +19,24 @@ #include "TestMapTrainer.h" // Sigmod includes +#include "../Game.h" #include "../Map.h" #include "../MapTrainer.h" #include "../MapTrainerTeamMember.h" #include "../Rules.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestMapTrainer::initTestCase() { TestSigmodObject::initTestCase(); - Sigmod::Map* map = m_sigmod->newMap(); + Map* map = m_game->newMap(); m_trainer1 = map->newTrainer(); m_trainer2 = map->newTrainer(); @@ -76,7 +79,7 @@ void TestMapTrainer::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); - m_sigmod->newTrainer(); + m_game->newTrainer(); m_trainer1->setTrainerClass(0); m_trainer1->validate(); @@ -84,8 +87,8 @@ void TestMapTrainer::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 9); - m_sigmod->map(0)->setWidth(25); - m_sigmod->map(0)->setHeight(25); + m_game->map(0)->setWidth(25); + m_game->map(0)->setHeight(25); m_trainer1->setPosition(QPoint(20, 20)); m_trainer1->validate(); @@ -93,24 +96,24 @@ void TestMapTrainer::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 11); - m_sigmod->map(0)->setWidth(20); - m_sigmod->map(0)->setHeight(20); + m_game->map(0)->setWidth(20); + m_game->map(0)->setHeight(20); m_trainer1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 14); - m_sigmod->map(0)->setWidth(25); - m_sigmod->map(0)->setHeight(25); + m_game->map(0)->setWidth(25); + m_game->map(0)->setHeight(25); m_trainer1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 16); - m_sigmod->rules()->setMaxParty(6); - m_sigmod->rules()->setMaxFight(6); + m_game->rules()->setMaxParty(6); + m_game->rules()->setMaxFight(6); m_trainer1->setNumberFight(3); m_trainer1->validate(); @@ -118,14 +121,14 @@ void TestMapTrainer::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 18); - m_sigmod->rules()->setMaxFight(2); + m_game->rules()->setMaxFight(2); m_trainer1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 21); - m_sigmod->rules()->setMaxFight(6); + m_game->rules()->setMaxFight(6); m_trainer1->validate(); QCOMPARE(m_warnings.size(), 0); @@ -153,7 +156,7 @@ void TestMapTrainer::validation() QCOMPARE(m_warnings.size(), 2); QCOMPARE(m_errors.size(), 25); - m_sigmod->rules()->setMaxFight(2); + m_game->rules()->setMaxFight(2); m_trainer1->newTeamMember(); m_trainer1->setLeadTeamMember(1, true); @@ -162,7 +165,7 @@ void TestMapTrainer::validation() QCOMPARE(m_warnings.size(), 3); QCOMPARE(m_errors.size(), 26); - m_sigmod->rules()->setMaxFight(2); + m_game->rules()->setMaxFight(2); QCOMPARE(m_warnings.size(), 3); QCOMPARE(m_errors.size(), 26); @@ -170,7 +173,7 @@ void TestMapTrainer::validation() void TestMapTrainer::saving() { - QDomDocument xml = Sigmod::Object::xml(m_trainer1); + QDomDocument xml = Object::xml(m_trainer1); QFile file("mapTrainer.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -183,14 +186,14 @@ void TestMapTrainer::loading() QDomDocument xml; QFile file("mapTrainer.xml"); - m_sigmod->newTrainer(); + m_game->newTrainer(); m_trainer1->newTeamMember(); m_trainer1->setName("Bar"); m_trainer1->setTrainerClass(1); m_trainer1->setPosition(QPoint(3, 3)); m_trainer1->setNumberFight(1); - m_trainer1->setScript(Sigcore::Script("python", "import os")); + m_trainer1->setScript(Script("python", "import os")); m_trainer1->setLeadTeamMember(0, false); m_trainer1->setLeadTeamMember(1, false); m_trainer1->setLeadTeamMember(2, true); @@ -203,7 +206,7 @@ void TestMapTrainer::loading() QCOMPARE(m_trainer1->trainerClass(), 0); QCOMPARE(m_trainer1->position(), QPoint(20, 20)); QCOMPARE(m_trainer1->numberFight(), 3); - QCOMPARE(m_trainer1->script(), Sigcore::Script()); + QCOMPARE(m_trainer1->script(), Script()); QCOMPARE(m_trainer1->leadTeamMember(0), true); QCOMPARE(m_trainer1->leadTeamMember(1), true); QCOMPARE(m_trainer1->leadTeamMember(2), false); @@ -230,7 +233,7 @@ void TestMapTrainer::setTrainerClass() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newTrainer(); + m_game->newTrainer(); m_trainer2->setTrainerClass(2); m_trainer2->setTrainerClass(2); @@ -268,7 +271,7 @@ void TestMapTrainer::setPosition() void TestMapTrainer::setNumberFight() { - m_sigmod->rules()->setMaxFight(4); + m_game->rules()->setMaxFight(4); m_trainer2->setNumberFight(10); @@ -288,10 +291,10 @@ void TestMapTrainer::setNumberFight() void TestMapTrainer::setScript() { - m_trainer2->setScript(Sigcore::Script("python", "import os")); - m_trainer2->setScript(Sigcore::Script("python", "import os")); + m_trainer2->setScript(Script("python", "import os")); + m_trainer2->setScript(Script("python", "import os")); - QCOMPARE(m_trainer2->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_trainer2->script(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -301,7 +304,7 @@ void TestMapTrainer::setScript() void TestMapTrainer::setLeadTeamMember() { - m_sigmod->rules()->setMaxFight(1); + m_game->rules()->setMaxFight(1); m_trainer2->setLeadTeamMember(0, true); @@ -360,7 +363,7 @@ void TestMapTrainer::assignment() QCOMPARE(m_trainer3->trainerClass(), 2); QCOMPARE(m_trainer3->position(), QPoint(20, 20)); QCOMPARE(m_trainer3->numberFight(), 3); - QCOMPARE(m_trainer3->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_trainer3->script(), Script("python", "import os")); QCOMPARE(m_trainer3->leadTeamMember(0), true); QCOMPARE(m_trainer3->leadTeamMember(1), false); QCOMPARE(m_trainer3->teamMemberCount(), 4); diff --git a/sigmod/test/TestMapTrainerTeamMember.cpp b/sigmod/test/TestMapTrainerTeamMember.cpp index 413033c4..3adc2d24 100644 --- a/sigmod/test/TestMapTrainerTeamMember.cpp +++ b/sigmod/test/TestMapTrainerTeamMember.cpp @@ -19,12 +19,12 @@ #include "TestMapTrainerTeamMember.h" // Sigmod includes +#include "../Game.h" #include "../Item.h" #include "../Map.h" #include "../MapTrainer.h" #include "../MapTrainerTeamMember.h" #include "../Rules.h" -#include "../Sigmod.h" #include "../Species.h" #include "../SpeciesMove.h" @@ -32,11 +32,13 @@ #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestMapTrainerTeamMember::initTestCase() { TestSigmodObject::initTestCase(); - Sigmod::MapTrainer* trainer = m_sigmod->newMap()->newTrainer(); + MapTrainer* trainer = m_game->newMap()->newTrainer(); m_teamMember1 = trainer->newTeamMember(); m_teamMember2 = trainer->newTeamMember(); @@ -73,7 +75,7 @@ void TestMapTrainerTeamMember::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_sigmod->newSpecies(); + m_game->newSpecies(); m_teamMember1->setSpecies(0); m_teamMember1->validate(); @@ -81,7 +83,7 @@ void TestMapTrainerTeamMember::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_sigmod->rules()->setMaxLevel(100); + m_game->rules()->setMaxLevel(100); m_teamMember1->setLevel(50); m_teamMember1->validate(); @@ -89,7 +91,7 @@ void TestMapTrainerTeamMember::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_sigmod->rules()->setMaxLevel(40); + m_game->rules()->setMaxLevel(40); m_teamMember1->validate(); @@ -102,8 +104,8 @@ void TestMapTrainerTeamMember::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 4); - m_sigmod->rules()->setMaxAbilities(1); - m_sigmod->newAbility(); + m_game->rules()->setMaxAbilities(1); + m_game->newAbility(); m_teamMember1->setAbility(0, true); m_teamMember1->validate(); @@ -111,24 +113,24 @@ void TestMapTrainerTeamMember::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 4); - m_sigmod->rules()->setMaxAbilities(0); + m_game->rules()->setMaxAbilities(0); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 5); - m_sigmod->rules()->setMaxAbilities(1); + m_game->rules()->setMaxAbilities(1); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 5); - m_sigmod->rules()->setMaxHeldItems(1); - m_sigmod->species(0)->setMaxHoldWeight(10); - m_sigmod->newItem(); - m_sigmod->item(0)->setWeight(5); + m_game->rules()->setMaxHeldItems(1); + m_game->species(0)->setMaxHoldWeight(10); + m_game->newItem(); + m_game->item(0)->setWeight(5); m_teamMember1->setItem(0, 1); m_teamMember1->validate(); @@ -136,39 +138,39 @@ void TestMapTrainerTeamMember::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 5); - m_sigmod->rules()->setMaxHeldItems(0); + m_game->rules()->setMaxHeldItems(0); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); - m_sigmod->rules()->setMaxHeldItems(1); + m_game->rules()->setMaxHeldItems(1); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); - m_sigmod->item(0)->setWeight(25); + m_game->item(0)->setWeight(25); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 8); - m_sigmod->item(0)->setWeight(5); + m_game->item(0)->setWeight(5); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 8); - m_sigmod->rules()->setMaxMoves(2); - m_sigmod->newMove(); - m_sigmod->newMove(); - m_sigmod->species(0)->newMove()->setMove(0); - m_sigmod->species(0)->newMove()->setMove(1); + m_game->rules()->setMaxMoves(2); + m_game->newMove(); + m_game->newMove(); + m_game->species(0)->newMove()->setMove(0); + m_game->species(0)->newMove()->setMove(1); m_teamMember1->setMove(0, true); m_teamMember1->setMove(1, true); @@ -177,36 +179,36 @@ void TestMapTrainerTeamMember::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 8); - m_sigmod->rules()->setMaxMoves(1); + m_game->rules()->setMaxMoves(1); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 9); - m_sigmod->rules()->setMaxMoves(2); + m_game->rules()->setMaxMoves(2); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 9); - m_sigmod->species(0)->deleteMove(1); + m_game->species(0)->deleteMove(1); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 10); - m_sigmod->species(0)->newMove()->setMove(1); + m_game->species(0)->newMove()->setMove(1); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 10); - m_sigmod->rules()->setMaxNatures(1); - m_sigmod->newNature(); + m_game->rules()->setMaxNatures(1); + m_game->newNature(); m_teamMember1->setNature(0, true); m_teamMember1->validate(); @@ -214,14 +216,14 @@ void TestMapTrainerTeamMember::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 10); - m_sigmod->rules()->setMaxNatures(0); + m_game->rules()->setMaxNatures(0); m_teamMember1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 11); - m_sigmod->rules()->setMaxNatures(1); + m_game->rules()->setMaxNatures(1); m_teamMember1->validate(); @@ -231,7 +233,7 @@ void TestMapTrainerTeamMember::validation() void TestMapTrainerTeamMember::saving() { - QDomDocument xml = Sigmod::Object::xml(m_teamMember1); + QDomDocument xml = Object::xml(m_teamMember1); QFile file("mapTrainerTeamMember.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -244,11 +246,11 @@ void TestMapTrainerTeamMember::loading() QDomDocument xml; QFile file("mapTrainerTeamMember.xml"); - m_sigmod->newAbility(); - m_sigmod->newItem(); - m_sigmod->newMove(); - m_sigmod->newNature(); - m_sigmod->newSpecies(); + m_game->newAbility(); + m_game->newItem(); + m_game->newMove(); + m_game->newNature(); + m_game->newSpecies(); m_teamMember1->setSpecies(1); m_teamMember1->setLevel(25); @@ -286,7 +288,7 @@ void TestMapTrainerTeamMember::setSpecies() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newSpecies(); + m_game->newSpecies(); m_teamMember2->setSpecies(2); m_teamMember2->setSpecies(2); @@ -324,7 +326,7 @@ void TestMapTrainerTeamMember::setLevel() void TestMapTrainerTeamMember::abilities() { - m_sigmod->newAbility(); + m_game->newAbility(); m_teamMember2->setAbility(0, true); m_teamMember2->setAbility(0, true); @@ -345,7 +347,7 @@ void TestMapTrainerTeamMember::abilities() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->rules()->setMaxAbilities(2); + m_game->rules()->setMaxAbilities(2); m_teamMember2->setAbility(1, true); @@ -377,9 +379,9 @@ void TestMapTrainerTeamMember::abilities() void TestMapTrainerTeamMember::items() { - m_sigmod->species(2)->setMaxHoldWeight(9); - m_sigmod->rules()->setMaxHeldItems(2); - m_sigmod->newItem(); + m_game->species(2)->setMaxHoldWeight(9); + m_game->rules()->setMaxHeldItems(2); + m_game->newItem(); m_teamMember2->setItem(0, 1); m_teamMember2->setItem(0, 1); @@ -439,9 +441,9 @@ void TestMapTrainerTeamMember::items() void TestMapTrainerTeamMember::moves() { - m_sigmod->species(2)->newMove()->setMove(0); - m_sigmod->species(2)->newMove()->setMove(1); - m_sigmod->rules()->setMaxMoves(1); + m_game->species(2)->newMove()->setMove(0); + m_game->species(2)->newMove()->setMove(1); + m_game->rules()->setMaxMoves(1); m_teamMember2->setMove(0, true); m_teamMember2->setMove(0, true); @@ -462,7 +464,7 @@ void TestMapTrainerTeamMember::moves() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->rules()->setMaxMoves(3); + m_game->rules()->setMaxMoves(3); m_teamMember2->setMove(1, true); @@ -482,7 +484,7 @@ void TestMapTrainerTeamMember::moves() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_sigmod->species(2)->newMove()->setMove(2); + m_game->species(2)->newMove()->setMove(2); m_teamMember2->setMove(2, true); @@ -514,7 +516,7 @@ void TestMapTrainerTeamMember::moves() void TestMapTrainerTeamMember::natures() { - m_sigmod->newNature(); + m_game->newNature(); m_teamMember2->setNature(0, true); m_teamMember2->setNature(0, true); @@ -535,7 +537,7 @@ void TestMapTrainerTeamMember::natures() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->rules()->setMaxNatures(2); + m_game->rules()->setMaxNatures(2); m_teamMember2->setNature(1, true); diff --git a/sigmod/test/TestMapWarp.cpp b/sigmod/test/TestMapWarp.cpp index 4aac1443..4b3fdef7 100644 --- a/sigmod/test/TestMapWarp.cpp +++ b/sigmod/test/TestMapWarp.cpp @@ -19,19 +19,22 @@ #include "TestMapWarp.h" // Sigmod includes +#include "../Game.h" #include "../Map.h" #include "../MapWarp.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestMapWarp::initTestCase() { TestSigmodObject::initTestCase(); - Sigmod::Map* map = m_sigmod->newMap(); + Map* map = m_game->newMap(); m_warp1 = map->newWarp(); m_warp2 = map->newWarp(); @@ -74,8 +77,8 @@ void TestMapWarp::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); - m_sigmod->map(0)->setWidth(20); - m_sigmod->map(0)->setHeight(20); + m_game->map(0)->setWidth(20); + m_game->map(0)->setHeight(20); m_warp1->setArea(QRect(0, 0, 5, 5)); m_warp1->validate(); @@ -83,16 +86,16 @@ void TestMapWarp::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 9); - m_sigmod->map(0)->setWidth(3); - m_sigmod->map(0)->setHeight(3); + m_game->map(0)->setWidth(3); + m_game->map(0)->setHeight(3); m_warp1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 12); - m_sigmod->map(0)->setWidth(20); - m_sigmod->map(0)->setHeight(20); + m_game->map(0)->setWidth(20); + m_game->map(0)->setHeight(20); m_warp1->validate(); @@ -114,7 +117,7 @@ void TestMapWarp::validation() void TestMapWarp::saving() { - QDomDocument xml = Sigmod::Object::xml(m_warp1); + QDomDocument xml = Object::xml(m_warp1); QFile file("mapWarp.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -127,14 +130,14 @@ void TestMapWarp::loading() QDomDocument xml; QFile file("mapWarp.xml"); - m_sigmod->newMap()->newWarp(); + m_game->newMap()->newWarp(); m_warp1->setName("Bar"); m_warp1->setArea(QRect(1, 1, 3, 3)); - m_warp1->setType(Sigmod::MapWarp::Warp); + m_warp1->setType(MapWarp::Warp); m_warp1->setToMap(1); m_warp1->setToWarp(0); - m_warp1->setScript(Sigcore::Script("python", "import os")); + m_warp1->setScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); @@ -142,10 +145,10 @@ void TestMapWarp::loading() QCOMPARE(m_warp1->name(), QString("Foo")); QCOMPARE(m_warp1->area(), QRect(0, 0, 5, 5)); - QCOMPARE(m_warp1->type(), Sigmod::MapWarp::Door); + QCOMPARE(m_warp1->type(), MapWarp::Door); QCOMPARE(m_warp1->toMap(), 0); QCOMPARE(m_warp1->toWarp(), 2); - QCOMPARE(m_warp1->script(), Sigcore::Script()); + QCOMPARE(m_warp1->script(), Script()); } void TestMapWarp::setName() @@ -196,10 +199,10 @@ void TestMapWarp::setArea() void TestMapWarp::setType() { - m_warp2->setType(Sigmod::MapWarp::Warp); - m_warp2->setType(Sigmod::MapWarp::Warp); + m_warp2->setType(MapWarp::Warp); + m_warp2->setType(MapWarp::Warp); - QCOMPARE(m_warp2->type(), Sigmod::MapWarp::Warp); + QCOMPARE(m_warp2->type(), MapWarp::Warp); QCOMPARE(m_changedCount, 1); @@ -214,7 +217,7 @@ void TestMapWarp::setToMap() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newMap(); + m_game->newMap(); m_warp2->setToMap(2); m_warp2->setToMap(2); @@ -234,7 +237,7 @@ void TestMapWarp::setToWarp() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->map(2)->newWarp(); + m_game->map(2)->newWarp(); m_warp2->setToWarp(0); m_warp2->setToWarp(0); @@ -249,10 +252,10 @@ void TestMapWarp::setToWarp() void TestMapWarp::setScript() { - m_warp2->setScript(Sigcore::Script("python", "import os")); - m_warp2->setScript(Sigcore::Script("python", "import os")); + m_warp2->setScript(Script("python", "import os")); + m_warp2->setScript(Script("python", "import os")); - QCOMPARE(m_warp2->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_warp2->script(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -266,10 +269,10 @@ void TestMapWarp::assignment() QCOMPARE(m_warp3->name(), QString("Foo")); QCOMPARE(m_warp3->area(), QRect(0, 0, 5, 5)); - QCOMPARE(m_warp3->type(), Sigmod::MapWarp::Warp); + QCOMPARE(m_warp3->type(), MapWarp::Warp); QCOMPARE(m_warp3->toMap(), 2); QCOMPARE(m_warp3->toWarp(), 0); - QCOMPARE(m_warp3->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_warp3->script(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestMapWarp) diff --git a/sigmod/test/TestMapWildList.cpp b/sigmod/test/TestMapWildList.cpp index a39bf743..fe514c9a 100644 --- a/sigmod/test/TestMapWildList.cpp +++ b/sigmod/test/TestMapWildList.cpp @@ -19,20 +19,22 @@ #include "TestMapWildList.h" // Sigmod includes +#include "../Game.h" #include "../Map.h" #include "../MapWildList.h" #include "../MapWildListEncounter.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestMapWildList::initTestCase() { TestSigmodObject::initTestCase(); - Sigmod::Map* map = m_sigmod->newMap(); + Map* map = m_game->newMap(); m_wildList1 = map->newWildList(); m_wildList2 = map->newWildList(); @@ -84,7 +86,7 @@ void TestMapWildList::validation() void TestMapWildList::saving() { - QDomDocument xml = Sigmod::Object::xml(m_wildList1); + QDomDocument xml = Object::xml(m_wildList1); QFile file("wildList.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); diff --git a/sigmod/test/TestMapWildListEncounter.cpp b/sigmod/test/TestMapWildListEncounter.cpp index 69037af4..42855fb1 100644 --- a/sigmod/test/TestMapWildListEncounter.cpp +++ b/sigmod/test/TestMapWildListEncounter.cpp @@ -19,21 +19,23 @@ #include "TestMapWildListEncounter.h" // Sigmod includes +#include "../Game.h" #include "../Map.h" #include "../MapWildList.h" #include "../MapWildListEncounter.h" #include "../Rules.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestMapWildListEncounter::initTestCase() { TestSigmodObject::initTestCase(); - Sigmod::MapWildList* wildList = m_sigmod->newMap()->newWildList(); + MapWildList* wildList = m_game->newMap()->newWildList(); m_encounter1 = wildList->newEncounter(); m_encounter2 = wildList->newEncounter(); @@ -70,7 +72,7 @@ void TestMapWildListEncounter::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newSpecies(); + m_game->newSpecies(); m_encounter1->setSpecies(0); m_encounter1->validate(); @@ -78,7 +80,7 @@ void TestMapWildListEncounter::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->rules()->setMaxLevel(100); + m_game->rules()->setMaxLevel(100); m_encounter1->setLevel(50); m_encounter1->validate(); @@ -86,7 +88,7 @@ void TestMapWildListEncounter::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->rules()->setMaxLevel(40); + m_game->rules()->setMaxLevel(40); m_encounter1->validate(); @@ -96,7 +98,7 @@ void TestMapWildListEncounter::validation() void TestMapWildListEncounter::saving() { - QDomDocument xml = Sigmod::Object::xml(m_encounter1); + QDomDocument xml = Object::xml(m_encounter1); QFile file("encounter.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -109,7 +111,7 @@ void TestMapWildListEncounter::loading() QDomDocument xml; QFile file("encounter.xml"); - m_sigmod->newSpecies(); + m_game->newSpecies(); m_encounter1->setSpecies(1); m_encounter1->setLevel(5); @@ -131,7 +133,7 @@ void TestMapWildListEncounter::setSpecies() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newSpecies(); + m_game->newSpecies(); m_encounter2->setSpecies(2); m_encounter2->setSpecies(2); diff --git a/sigmod/test/TestMove.cpp b/sigmod/test/TestMove.cpp index d3309c59..fe459578 100644 --- a/sigmod/test/TestMove.cpp +++ b/sigmod/test/TestMove.cpp @@ -19,20 +19,23 @@ #include "TestMove.h" // Sigmod includes +#include "../Game.h" #include "../Move.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestMove::initTestCase() { TestSigmodObject::initTestCase(); - m_move1 = m_sigmod->newMove(); - m_move2 = m_sigmod->newMove(); - m_move3 = m_sigmod->newMove(); + m_move1 = m_game->newMove(); + m_move2 = m_game->newMove(); + m_move3 = m_game->newMove(); } void TestMove::cleanupTestCase() @@ -71,7 +74,7 @@ void TestMove::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 5); - m_sigmod->newType(); + m_game->newType(); m_move1->setType(0); m_move1->validate(); @@ -88,7 +91,7 @@ void TestMove::validation() void TestMove::saving() { - QDomDocument xml = Sigmod::Object::xml(m_move1); + QDomDocument xml = Object::xml(m_move1); QFile file("move.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -101,35 +104,35 @@ void TestMove::loading() QDomDocument xml; QFile file("move.xml"); - m_sigmod->newType(); + m_game->newType(); m_move1->setName("Bar"); - m_move1->setAccuracy(Sigcore::Fraction(1, 2)); + m_move1->setAccuracy(Fraction(1, 2)); m_move1->setPower(10); m_move1->setType(1); m_move1->setSpecial(true); m_move1->setPowerPoints(50); m_move1->setPriority(1); m_move1->setDescription("blah"); - m_move1->setBattleScript(Sigcore::Script("python", "import os")); - m_move1->setWorldScript(Sigcore::Script("python", "import os")); - m_move1->setPriorityScript(Sigcore::Script("python", "import os")); + m_move1->setBattleScript(Script("python", "import os")); + m_move1->setWorldScript(Script("python", "import os")); + m_move1->setPriorityScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); m_move1->load(xml.firstChildElement("Move")); QCOMPARE(m_move1->name(), QString("Foo")); - QCOMPARE(m_move1->accuracy(), Sigcore::Fraction(1, 1)); + QCOMPARE(m_move1->accuracy(), Fraction(1, 1)); QCOMPARE(m_move1->power(), 0); QCOMPARE(m_move1->type(), 0); QCOMPARE(m_move1->special(), false); QCOMPARE(m_move1->powerPoints(), 25); QCOMPARE(m_move1->priority(), 0); QCOMPARE(m_move1->description(), QString("")); - QCOMPARE(m_move1->battleScript(), Sigcore::Script("", "")); - QCOMPARE(m_move1->worldScript(), Sigcore::Script("", "")); - QCOMPARE(m_move1->priorityScript(), Sigcore::Script("", "")); + QCOMPARE(m_move1->battleScript(), Script("", "")); + QCOMPARE(m_move1->worldScript(), Script("", "")); + QCOMPARE(m_move1->priorityScript(), Script("", "")); } void TestMove::setName() @@ -147,25 +150,25 @@ void TestMove::setName() void TestMove::setAccuracy() { - m_move2->setAccuracy(Sigcore::Fraction(3, 2)); + m_move2->setAccuracy(Fraction(3, 2)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_move2->setAccuracy(Sigcore::Fraction(-1, 2)); + m_move2->setAccuracy(Fraction(-1, 2)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_move2->setAccuracy(Sigcore::Fraction(0, 2)); + m_move2->setAccuracy(Fraction(0, 2)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_move2->setAccuracy(Sigcore::Fraction(1, 2)); - m_move2->setAccuracy(Sigcore::Fraction(1, 2)); + m_move2->setAccuracy(Fraction(1, 2)); + m_move2->setAccuracy(Fraction(1, 2)); - QCOMPARE(m_move2->accuracy(), Sigcore::Fraction(1, 2)); + QCOMPARE(m_move2->accuracy(), Fraction(1, 2)); QCOMPARE(m_changedCount, 1); @@ -198,7 +201,7 @@ void TestMove::setType() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newType(); + m_game->newType(); m_move2->setType(2); m_move2->setType(2); @@ -270,10 +273,10 @@ void TestMove::setDescription() void TestMove::setBattleScript() { - m_move2->setBattleScript(Sigcore::Script("python", "import os")); - m_move2->setBattleScript(Sigcore::Script("python", "import os")); + m_move2->setBattleScript(Script("python", "import os")); + m_move2->setBattleScript(Script("python", "import os")); - QCOMPARE(m_move2->battleScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_move2->battleScript(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -283,10 +286,10 @@ void TestMove::setBattleScript() void TestMove::setWorldScript() { - m_move2->setWorldScript(Sigcore::Script("python", "import os")); - m_move2->setWorldScript(Sigcore::Script("python", "import os")); + m_move2->setWorldScript(Script("python", "import os")); + m_move2->setWorldScript(Script("python", "import os")); - QCOMPARE(m_move2->worldScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_move2->worldScript(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -296,10 +299,10 @@ void TestMove::setWorldScript() void TestMove::setPriorityScript() { - m_move2->setPriorityScript(Sigcore::Script("python", "import os")); - m_move2->setPriorityScript(Sigcore::Script("python", "import os")); + m_move2->setPriorityScript(Script("python", "import os")); + m_move2->setPriorityScript(Script("python", "import os")); - QCOMPARE(m_move2->priorityScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_move2->priorityScript(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -312,16 +315,16 @@ void TestMove::assignment() *m_move3 = *m_move2; QCOMPARE(m_move3->name(), QString("Foo")); - QCOMPARE(m_move3->accuracy(), Sigcore::Fraction(1, 2)); + QCOMPARE(m_move3->accuracy(), Fraction(1, 2)); QCOMPARE(m_move3->power(), 10); QCOMPARE(m_move3->type(), 2); QCOMPARE(m_move3->special(), true); QCOMPARE(m_move3->powerPoints(), 10); QCOMPARE(m_move3->priority(), 25); QCOMPARE(m_move3->description(), QString("blah")); - QCOMPARE(m_move3->battleScript(), Sigcore::Script("python", "import os")); - QCOMPARE(m_move3->worldScript(), Sigcore::Script("python", "import os")); - QCOMPARE(m_move3->priorityScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_move3->battleScript(), Script("python", "import os")); + QCOMPARE(m_move3->worldScript(), Script("python", "import os")); + QCOMPARE(m_move3->priorityScript(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestMove) 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); } diff --git a/sigmod/test/TestRules.cpp b/sigmod/test/TestRules.cpp index b87b46c0..dfa07468 100644 --- a/sigmod/test/TestRules.cpp +++ b/sigmod/test/TestRules.cpp @@ -19,20 +19,22 @@ #include "TestRules.h" // Sigmod includes +#include "../Game.h" #include "../Rules.h" -#include "../Sigmod.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestRules::initTestCase() { TestSigmodObject::initTestCase(); - m_rules1 = (new Sigmod::Sigmod)->rules(); - m_rules2 = (new Sigmod::Sigmod)->rules(); - m_rules3 = (new Sigmod::Sigmod)->rules(); + m_rules1 = (new Game)->rules(); + m_rules2 = (new Game)->rules(); + m_rules3 = (new Game)->rules(); } void TestRules::cleanupTestCase() @@ -76,7 +78,7 @@ void TestRules::validation() void TestRules::saving() { - QDomDocument xml = Sigmod::Object::xml(m_rules1); + QDomDocument xml = Object::xml(m_rules1); QFile file("rules.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); diff --git a/sigmod/test/TestSigmod.cpp b/sigmod/test/TestSigmod.cpp index bfc3e149..86a3c676 100644 --- a/sigmod/test/TestSigmod.cpp +++ b/sigmod/test/TestSigmod.cpp @@ -19,61 +19,63 @@ #include "TestSigmod.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> -void TestSigmod::initTestCase() +using namespace Sigmod; + +void TestinitTestCase() { TestSigmodObject::initTestCase(); - m_sigmod1 = m_sigmod->newSigmod(); - m_sigmod2 = m_sigmod->newSigmod(); - m_sigmod3 = m_sigmod->newSigmod(); + m_game1 = m_game->newSigmod(); + m_game2 = m_game->newSigmod(); + m_game3 = m_game->newSigmod(); } -void TestSigmod::cleanupTestCase() +void TestcleanupTestCase() { TestSigmodObject::cleanupTestCase(); } -void TestSigmod::init() +void Testinit() { TestSigmodObject::init(); - makeConnections(m_sigmod1); - makeConnections(m_sigmod2); - makeConnections(m_sigmod3); + makeConnections(m_game1); + makeConnections(m_game2); + makeConnections(m_game3); } -void TestSigmod::cleanup() +void Testcleanup() { - closeConnections(m_sigmod1); - closeConnections(m_sigmod2); - closeConnections(m_sigmod3); + closeConnections(m_game1); + closeConnections(m_game2); + closeConnections(m_game3); TestSigmodObject::cleanup(); } -void TestSigmod::validation() +void Testvalidation() { - m_sigmod1->validate(); + m_game1->validate(); QCOMPARE(m_warnings.size(), ); QCOMPARE(m_errors.size(), ); - m_sigmod1->set(); - m_sigmod1->validate(); + m_game1->set(); + m_game1->validate(); QCOMPARE(m_warnings.size(), ); QCOMPARE(m_errors.size(), ); } -void TestSigmod::saving() +void Testsaving() { - QDomDocument xml = Sigmod::Object::xml(m_sigmod1); + QDomDocument xml = Object::xml(m_game1); QFile file("sigmod.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -81,26 +83,26 @@ void TestSigmod::saving() file.close(); } -void TestSigmod::loading() +void Testloading() { QDomDocument xml; QFile file("sigmod.xml"); - m_sigmod1->set(); + m_game1->set(); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); - m_sigmod1->load(xml.firstChildElement("Sigmod")); + m_game1->load(xml.firstChildElement("Sigmod")); - QCOMPARE(m_sigmod1->(), ); + QCOMPARE(m_game1->(), ); } -void TestSigmod::set() +void Testset() { - m_sigmod2->set(); - m_sigmod2->set(); + m_game2->set(); + m_game2->set(); - QCOMPARE(m_sigmod2->(), ); + QCOMPARE(m_game2->(), ); QCOMPARE(m_changedCount, 1); @@ -108,11 +110,11 @@ void TestSigmod::set() QCOMPARE(m_errors.size(), 0); } -void TestSigmod::assignment() +void Testassignment() { - *m_sigmod3 = *m_sigmod2; + *m_game3 = *m_game2; - QCOMPARE(m_sigmod3->(), ); + QCOMPARE(m_game3->(), ); } QTEST_APPLESS_MAIN(TestSigmod) diff --git a/sigmod/test/TestSigmodObject.cpp b/sigmod/test/TestSigmodObject.cpp index 07bc1500..600d70b5 100644 --- a/sigmod/test/TestSigmodObject.cpp +++ b/sigmod/test/TestSigmodObject.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,16 +19,18 @@ #include "TestSigmodObject.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" -void TestSigmodObject::makeConnections(Sigmod::Object* object) +using namespace Sigmod; + +void TestSigmodObject::makeConnections(Object* object) { connect(object, SIGNAL(warning(QString)), this, SLOT(warning(QString))); connect(object, SIGNAL(error(QString)), this, SLOT(error(QString))); connect(object, SIGNAL(changed()), this, SLOT(changed())); } -void TestSigmodObject::closeConnections(Sigmod::Object* object) +void TestSigmodObject::closeConnections(Object* object) { disconnect(object, 0, this, 0); } @@ -50,12 +52,12 @@ void TestSigmodObject::changed() void TestSigmodObject::initTestCase() { - m_sigmod = new Sigmod::Sigmod; + m_game = new Game; } void TestSigmodObject::cleanupTestCase() { - delete m_sigmod; + delete m_game; } void TestSigmodObject::init() diff --git a/sigmod/test/TestSigmodObject.h b/sigmod/test/TestSigmodObject.h index 65e023c5..cf6bf912 100644 --- a/sigmod/test/TestSigmodObject.h +++ b/sigmod/test/TestSigmodObject.h @@ -29,8 +29,8 @@ // Forward declarations namespace Sigmod { +class Game; class Object; -class Sigmod; } class SIGMODTEST_EXPORT TestSigmodObject : public QObject @@ -41,7 +41,7 @@ class SIGMODTEST_EXPORT TestSigmodObject : public QObject void makeConnections(Sigmod::Object* object); void closeConnections(Sigmod::Object* object); - Sigmod::Sigmod* m_sigmod; + Sigmod::Game* m_game; QList<QString> m_warnings; QList<QString> m_errors; diff --git a/sigmod/test/TestSkin.cpp b/sigmod/test/TestSkin.cpp index 53417bb0..34536cc1 100644 --- a/sigmod/test/TestSkin.cpp +++ b/sigmod/test/TestSkin.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,20 +19,23 @@ #include "TestSkin.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" #include "../Skin.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestSkin::initTestCase() { TestSigmodObject::initTestCase(); - m_skin1 = m_sigmod->newSkin(); - m_skin2 = m_sigmod->newSkin(); - m_skin3 = m_sigmod->newSkin(); + m_skin1 = m_game->newSkin(); + m_skin2 = m_game->newSkin(); + m_skin3 = m_game->newSkin(); } void TestSkin::cleanupTestCase() @@ -74,7 +77,7 @@ void TestSkin::validation() void TestSkin::saving() { - QDomDocument xml = Sigmod::Object::xml(m_skin1); + QDomDocument xml = Object::xml(m_skin1); QFile file("skin.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -88,14 +91,14 @@ void TestSkin::loading() QFile file("skin.xml"); m_skin1->setName("Bar"); - m_skin1->setScript(Sigcore::Script("python", "import os")); + m_skin1->setScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); m_skin1->load(xml.firstChildElement("Skin")); QCOMPARE(m_skin1->name(), QString("Foo")); - QCOMPARE(m_skin1->script(), Sigcore::Script()); + QCOMPARE(m_skin1->script(), Script()); } void TestSkin::setName() @@ -113,10 +116,10 @@ void TestSkin::setName() void TestSkin::setScript() { - m_skin2->setScript(Sigcore::Script("python", "import os")); - m_skin2->setScript(Sigcore::Script("python", "import os")); + m_skin2->setScript(Script("python", "import os")); + m_skin2->setScript(Script("python", "import os")); - QCOMPARE(m_skin2->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_skin2->script(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -129,7 +132,7 @@ void TestSkin::assignment() *m_skin3 = *m_skin2; QCOMPARE(m_skin3->name(), QString("Foo")); - QCOMPARE(m_skin3->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_skin3->script(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestSkin) diff --git a/sigmod/test/TestSound.cpp b/sigmod/test/TestSound.cpp index 37c42809..85318fa4 100644 --- a/sigmod/test/TestSound.cpp +++ b/sigmod/test/TestSound.cpp @@ -19,22 +19,24 @@ #include "TestSound.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" #include "../Sound.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestSound::initTestCase() { TestSigmodObject::initTestCase(); - m_sound1 = m_sigmod->newSound(); - m_sound2 = m_sigmod->newSound(); - m_sound3 = m_sigmod->newSound(); + m_sound1 = m_game->newSound(); + m_sound2 = m_game->newSound(); + m_sound3 = m_game->newSound(); - m_sound1->setType(Sigmod::Sound::Music); + m_sound1->setType(Sound::Music); } void TestSound::cleanupTestCase() @@ -82,7 +84,7 @@ void TestSound::validation() void TestSound::saving() { - QDomDocument xml = Sigmod::Object::xml(m_sound1); + QDomDocument xml = Object::xml(m_sound1); QFile file("sound.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -96,7 +98,7 @@ void TestSound::loading() QFile file("sound.xml"); m_sound1->setName("Bar"); - m_sound1->setType(Sigmod::Sound::SoundEffect); + m_sound1->setType(Sound::SoundEffect); m_sound1->setData("blargh"); QVERIFY(file.open(QIODevice::ReadOnly)); @@ -104,7 +106,7 @@ void TestSound::loading() m_sound1->load(xml.firstChildElement("Sound")); QCOMPARE(m_sound1->name(), QString("Foo")); - QCOMPARE(m_sound1->type(), Sigmod::Sound::Music); + QCOMPARE(m_sound1->type(), Sound::Music); QCOMPARE(m_sound1->data(), QByteArray("blah")); } @@ -123,10 +125,10 @@ void TestSound::setName() void TestSound::setType() { - m_sound2->setType(Sigmod::Sound::Music); - m_sound2->setType(Sigmod::Sound::Music); + m_sound2->setType(Sound::Music); + m_sound2->setType(Sound::Music); - QCOMPARE(m_sound2->type(), Sigmod::Sound::Music); + QCOMPARE(m_sound2->type(), Sound::Music); QCOMPARE(m_changedCount, 1); @@ -152,7 +154,7 @@ void TestSound::assignment() *m_sound3 = *m_sound2; QCOMPARE(m_sound3->name(), QString("Foo")); - QCOMPARE(m_sound3->type(), Sigmod::Sound::Music); + QCOMPARE(m_sound3->type(), Sound::Music); QCOMPARE(m_sound3->data(), QByteArray("blah")); } diff --git a/sigmod/test/TestSpecies.cpp b/sigmod/test/TestSpecies.cpp index 085575b0..af473083 100644 --- a/sigmod/test/TestSpecies.cpp +++ b/sigmod/test/TestSpecies.cpp @@ -19,8 +19,8 @@ #include "TestSpecies.h" // Sigmod includes +#include "../Game.h" #include "../Rules.h" -#include "../Sigmod.h" #include "../Species.h" #include "../SpeciesMove.h" @@ -28,13 +28,16 @@ #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestSpecies::initTestCase() { TestSigmodObject::initTestCase(); - m_species1 = m_sigmod->newSpecies(); - m_species2 = m_sigmod->newSpecies(); - m_species3 = m_sigmod->newSpecies(); + m_species1 = m_game->newSpecies(); + m_species2 = m_game->newSpecies(); + m_species3 = m_game->newSpecies(); } void TestSpecies::cleanupTestCase() @@ -75,106 +78,106 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 9); - m_sigmod->rules()->setMaxEVPerStat(10); + m_game->rules()->setMaxEVPerStat(10); - m_species1->setEffortValue(Sigmod::ST_HP, 5); + m_species1->setEffortValue(ST_HP, 5); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 13); - m_sigmod->rules()->setMaxEVPerStat(2); + m_game->rules()->setMaxEVPerStat(2); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 18); - m_sigmod->rules()->setMaxEVPerStat(20); + m_game->rules()->setMaxEVPerStat(20); - m_species1->setEffortValue(Sigmod::ST_Attack, 15); + m_species1->setEffortValue(ST_Attack, 15); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 22); - m_sigmod->rules()->setMaxEVPerStat(10); + m_game->rules()->setMaxEVPerStat(10); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 27); - m_sigmod->rules()->setMaxEVPerStat(30); + m_game->rules()->setMaxEVPerStat(30); - m_species1->setEffortValue(Sigmod::ST_Defense, 25); + m_species1->setEffortValue(ST_Defense, 25); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 31); - m_sigmod->rules()->setMaxEVPerStat(20); + m_game->rules()->setMaxEVPerStat(20); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 36); - m_sigmod->rules()->setMaxEVPerStat(40); + m_game->rules()->setMaxEVPerStat(40); - m_species1->setEffortValue(Sigmod::ST_Speed, 35); + m_species1->setEffortValue(ST_Speed, 35); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 40); - m_sigmod->rules()->setMaxEVPerStat(30); + m_game->rules()->setMaxEVPerStat(30); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 45); - m_sigmod->rules()->setMaxEVPerStat(50); + m_game->rules()->setMaxEVPerStat(50); - m_species1->setEffortValue(Sigmod::ST_SpecialAttack, 45); + m_species1->setEffortValue(ST_SpecialAttack, 45); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 49); - m_sigmod->rules()->setMaxEVPerStat(40); + m_game->rules()->setMaxEVPerStat(40); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 54); - m_sigmod->rules()->setSpecialSplit(true); - m_sigmod->rules()->setMaxEVPerStat(60); + m_game->rules()->setSpecialSplit(true); + m_game->rules()->setMaxEVPerStat(60); - m_species1->setEffortValue(Sigmod::ST_SpecialDefense, 55); + m_species1->setEffortValue(ST_SpecialDefense, 55); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 58); - m_sigmod->rules()->setSpecialSplit(true); - m_sigmod->rules()->setMaxEVPerStat(50); + m_game->rules()->setSpecialSplit(true); + m_game->rules()->setMaxEVPerStat(50); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 63); - m_sigmod->rules()->setSpecialSplit(false); + m_game->rules()->setSpecialSplit(false); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 67); - m_sigmod->newSprite(); + m_game->newSprite(); m_species1->setFrontMaleSprite(0); m_species1->validate(); @@ -182,7 +185,7 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 70); - m_sigmod->newSprite(); + m_game->newSprite(); m_species1->setBackMaleSprite(1); m_species1->validate(); @@ -190,14 +193,14 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 72); - m_sigmod->rules()->setGenderAllowed(true); + m_game->rules()->setGenderAllowed(true); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 76); - m_sigmod->newSprite(); + m_game->newSprite(); m_species1->setFrontFemaleSprite(2); m_species1->validate(); @@ -205,7 +208,7 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 79); - m_sigmod->newSprite(); + m_game->newSprite(); m_species1->setBackFemaleSprite(3); m_species1->validate(); @@ -213,7 +216,7 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 81); - m_sigmod->newSkin(); + m_game->newSkin(); m_species1->setSkin(0); m_species1->validate(); @@ -234,14 +237,14 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 84); - m_sigmod->rules()->setBreedingAllowed(true); + m_game->rules()->setBreedingAllowed(true); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 85); - m_sigmod->newEggGroup(); + m_game->newEggGroup(); m_species1->setEggGroup(0, true); m_species1->validate(); @@ -249,7 +252,7 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 87); - m_sigmod->newSpecies(); + m_game->newSpecies(); m_species1->setEggSpecies(1); m_species1->validate(); @@ -257,14 +260,14 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 89); - m_sigmod->species(1)->setGrowth(Sigmod::Species::Fast); + m_game->species(1)->setGrowth(Species::Fast); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 92); - m_species1->setGrowth(Sigmod::Species::Fast); + m_species1->setGrowth(Species::Fast); m_species1->validate(); QCOMPARE(m_warnings.size(), 0); @@ -276,14 +279,14 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 95); - m_sigmod->rules()->setMaxAbilities(1); + m_game->rules()->setMaxAbilities(1); m_species1->validate(); QCOMPARE(m_warnings.size(), 1); QCOMPARE(m_errors.size(), 96); - m_sigmod->newAbility(); + m_game->newAbility(); m_species1->setAbility(0, 1); m_species1->validate(); @@ -291,14 +294,14 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 1); QCOMPARE(m_errors.size(), 97); - m_sigmod->rules()->setMaxHeldItems(1); + m_game->rules()->setMaxHeldItems(1); m_species1->validate(); QCOMPARE(m_warnings.size(), 2); QCOMPARE(m_errors.size(), 98); - m_sigmod->newItem(); + m_game->newItem(); m_species1->setItem(0, 1); m_species1->validate(); @@ -312,8 +315,8 @@ void TestSpecies::validation() QCOMPARE(m_warnings.size(), 2); QCOMPARE(m_errors.size(), 99); - m_sigmod->newType(); - m_sigmod->newEggGroup(); + m_game->newType(); + m_game->newEggGroup(); m_species1->setType(0, true); m_species1->setEggGroup(0, true); @@ -321,7 +324,7 @@ void TestSpecies::validation() void TestSpecies::saving() { - QDomDocument xml = Sigmod::Object::xml(m_species1); + QDomDocument xml = Object::xml(m_species1); QFile file("species.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -334,32 +337,32 @@ void TestSpecies::loading() QDomDocument xml; QFile file("species.xml"); - m_sigmod->rules()->setSpecialSplit(true); - m_sigmod->rules()->setMaxEVPerStat(60); - m_sigmod->newSkin(); - m_sigmod->newType(); - m_sigmod->newEggGroup(); + m_game->rules()->setSpecialSplit(true); + m_game->rules()->setMaxEVPerStat(60); + m_game->newSkin(); + m_game->newType(); + m_game->newEggGroup(); m_species1->setName("Bar"); - m_species1->setEffortValue(Sigmod::ST_HP, 10); - m_species1->setEffortValue(Sigmod::ST_Attack, 10); - m_species1->setEffortValue(Sigmod::ST_Defense, 10); - m_species1->setEffortValue(Sigmod::ST_Speed, 10); - m_species1->setEffortValue(Sigmod::ST_SpecialAttack, 10); - m_species1->setEffortValue(Sigmod::ST_SpecialDefense, 10); - m_species1->setEffortValue(Sigmod::ST_HP, 18); - m_species1->setEffortValue(Sigmod::ST_Attack, 18); - m_species1->setEffortValue(Sigmod::ST_Defense, 18); - m_species1->setEffortValue(Sigmod::ST_Speed, 18); - m_species1->setEffortValue(Sigmod::ST_SpecialAttack, 18); - m_species1->setEffortValue(Sigmod::ST_SpecialDefense, 18); - m_species1->setGrowth(Sigmod::Species::Normal); + m_species1->setEffortValue(ST_HP, 10); + m_species1->setEffortValue(ST_Attack, 10); + m_species1->setEffortValue(ST_Defense, 10); + m_species1->setEffortValue(ST_Speed, 10); + m_species1->setEffortValue(ST_SpecialAttack, 10); + m_species1->setEffortValue(ST_SpecialDefense, 10); + m_species1->setEffortValue(ST_HP, 18); + m_species1->setEffortValue(ST_Attack, 18); + m_species1->setEffortValue(ST_Defense, 18); + m_species1->setEffortValue(ST_Speed, 18); + m_species1->setEffortValue(ST_SpecialAttack, 18); + m_species1->setEffortValue(ST_SpecialDefense, 18); + m_species1->setGrowth(Species::Normal); m_species1->setExperienceValue(10); m_species1->setCatchValue(10); m_species1->setMaxHoldWeight(100); - m_species1->setRunChance(Sigcore::Fraction(1, 2)); - m_species1->setFleeChance(Sigcore::Fraction(1, 2)); - m_species1->setItemChance(Sigcore::Fraction(1, 2)); + m_species1->setRunChance(Fraction(1, 2)); + m_species1->setFleeChance(Fraction(1, 2)); + m_species1->setItemChance(Fraction(1, 2)); m_species1->setEncyclopediaNumber(1); m_species1->setWeight(100); m_species1->setHeight(100); @@ -369,14 +372,14 @@ void TestSpecies::loading() m_species1->setBackFemaleSprite(0); m_species1->setSkin(1); m_species1->setEncyclopediaEntry("Bar"); - m_species1->setGenderFactor(Sigcore::Fraction(3, 4)); + m_species1->setGenderFactor(Fraction(3, 4)); m_species1->setEggSpecies(2); m_species1->setEggSteps(100); m_species1->setType(0, false); m_species1->setType(1, true); m_species1->setEggGroup(0, false); m_species1->setEggGroup(1, true); - m_species1->setEvolution(Sigcore::Script("python", "import os")); + m_species1->setEvolution(Script("python", "import os")); m_species1->setAbility(0, 0); m_species1->setItem(0, 0); @@ -385,25 +388,25 @@ void TestSpecies::loading() m_species1->load(xml.firstChildElement("Species")); QCOMPARE(m_species1->name(), QString("Foo")); - QCOMPARE(m_species1->baseStat(Sigmod::ST_HP), 1); - QCOMPARE(m_species1->baseStat(Sigmod::ST_Attack), 1); - QCOMPARE(m_species1->baseStat(Sigmod::ST_Defense), 1); - QCOMPARE(m_species1->baseStat(Sigmod::ST_Speed), 1); - QCOMPARE(m_species1->baseStat(Sigmod::ST_SpecialAttack), 1); - QCOMPARE(m_species1->baseStat(Sigmod::ST_SpecialDefense), 1); - QCOMPARE(m_species1->effortValue(Sigmod::ST_HP), 5); - QCOMPARE(m_species1->effortValue(Sigmod::ST_Attack), 15); - QCOMPARE(m_species1->effortValue(Sigmod::ST_Defense), 25); - QCOMPARE(m_species1->effortValue(Sigmod::ST_Speed), 35); - QCOMPARE(m_species1->effortValue(Sigmod::ST_SpecialAttack), 45); - QCOMPARE(m_species1->effortValue(Sigmod::ST_SpecialDefense), 55); - QCOMPARE(m_species1->growth(), Sigmod::Species::Fast); + QCOMPARE(m_species1->baseStat(ST_HP), 1); + QCOMPARE(m_species1->baseStat(ST_Attack), 1); + QCOMPARE(m_species1->baseStat(ST_Defense), 1); + QCOMPARE(m_species1->baseStat(ST_Speed), 1); + QCOMPARE(m_species1->baseStat(ST_SpecialAttack), 1); + QCOMPARE(m_species1->baseStat(ST_SpecialDefense), 1); + QCOMPARE(m_species1->effortValue(ST_HP), 5); + QCOMPARE(m_species1->effortValue(ST_Attack), 15); + QCOMPARE(m_species1->effortValue(ST_Defense), 25); + QCOMPARE(m_species1->effortValue(ST_Speed), 35); + QCOMPARE(m_species1->effortValue(ST_SpecialAttack), 45); + QCOMPARE(m_species1->effortValue(ST_SpecialDefense), 55); + QCOMPARE(m_species1->growth(), Species::Fast); QCOMPARE(m_species1->experienceValue(), 0); QCOMPARE(m_species1->catchValue(), 0); QCOMPARE(m_species1->maxHoldWeight(), 0); - QCOMPARE(m_species1->runChance(), Sigcore::Fraction(1, 1)); - QCOMPARE(m_species1->fleeChance(), Sigcore::Fraction(1, 1)); - QCOMPARE(m_species1->itemChance(), Sigcore::Fraction(1, 1)); + QCOMPARE(m_species1->runChance(), Fraction(1, 1)); + QCOMPARE(m_species1->fleeChance(), Fraction(1, 1)); + QCOMPARE(m_species1->itemChance(), Fraction(1, 1)); QCOMPARE(m_species1->encyclopediaNumber(), 0); QCOMPARE(m_species1->weight(), 0); QCOMPARE(m_species1->height(), 0); @@ -413,14 +416,14 @@ void TestSpecies::loading() QCOMPARE(m_species1->frontFemaleSprite(), 2); QCOMPARE(m_species1->backFemaleSprite(), 3); QCOMPARE(m_species1->skin(), 0); - QCOMPARE(m_species1->genderFactor(), Sigcore::Fraction(1, 2)); + QCOMPARE(m_species1->genderFactor(), Fraction(1, 2)); QCOMPARE(m_species1->eggSpecies(), 1); QCOMPARE(m_species1->eggSteps(), 10); QCOMPARE(m_species1->type(0), true); QCOMPARE(m_species1->type(1), false); QCOMPARE(m_species1->eggGroup(0), true); QCOMPARE(m_species1->eggGroup(1), false); - QCOMPARE(m_species1->evolution(), Sigcore::Script()); + QCOMPARE(m_species1->evolution(), Script()); QCOMPARE(m_species1->ability(0), 1); QCOMPARE(m_species1->item(0), 1); } @@ -440,101 +443,101 @@ void TestSpecies::setName() void TestSpecies::setBaseStat() { - m_species2->setBaseStat(Sigmod::ST_HP, 0); + m_species2->setBaseStat(ST_HP, 0); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setBaseStat(Sigmod::ST_HP, 10); - m_species2->setBaseStat(Sigmod::ST_HP, 10); + m_species2->setBaseStat(ST_HP, 10); + m_species2->setBaseStat(ST_HP, 10); - QCOMPARE(m_species2->baseStat(Sigmod::ST_HP), 10); + QCOMPARE(m_species2->baseStat(ST_HP), 10); QCOMPARE(m_changedCount, 1); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setBaseStat(Sigmod::ST_Attack, 0); + m_species2->setBaseStat(ST_Attack, 0); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setBaseStat(Sigmod::ST_Attack, 10); - m_species2->setBaseStat(Sigmod::ST_Attack, 10); + m_species2->setBaseStat(ST_Attack, 10); + m_species2->setBaseStat(ST_Attack, 10); - QCOMPARE(m_species2->baseStat(Sigmod::ST_Attack), 10); + QCOMPARE(m_species2->baseStat(ST_Attack), 10); QCOMPARE(m_changedCount, 2); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setBaseStat(Sigmod::ST_Defense, 0); + m_species2->setBaseStat(ST_Defense, 0); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_species2->setBaseStat(Sigmod::ST_Defense, 10); - m_species2->setBaseStat(Sigmod::ST_Defense, 10); + m_species2->setBaseStat(ST_Defense, 10); + m_species2->setBaseStat(ST_Defense, 10); - QCOMPARE(m_species2->baseStat(Sigmod::ST_Defense), 10); + QCOMPARE(m_species2->baseStat(ST_Defense), 10); QCOMPARE(m_changedCount, 3); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_species2->setBaseStat(Sigmod::ST_Speed, 0); + m_species2->setBaseStat(ST_Speed, 0); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 4); - m_species2->setBaseStat(Sigmod::ST_Speed, 10); - m_species2->setBaseStat(Sigmod::ST_Speed, 10); + m_species2->setBaseStat(ST_Speed, 10); + m_species2->setBaseStat(ST_Speed, 10); - QCOMPARE(m_species2->baseStat(Sigmod::ST_Speed), 10); + QCOMPARE(m_species2->baseStat(ST_Speed), 10); QCOMPARE(m_changedCount, 4); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 4); - m_species2->setBaseStat(Sigmod::ST_SpecialAttack, 0); + m_species2->setBaseStat(ST_SpecialAttack, 0); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 5); - m_species2->setBaseStat(Sigmod::ST_SpecialAttack, 10); - m_species2->setBaseStat(Sigmod::ST_SpecialAttack, 10); + m_species2->setBaseStat(ST_SpecialAttack, 10); + m_species2->setBaseStat(ST_SpecialAttack, 10); - QCOMPARE(m_species2->baseStat(Sigmod::ST_SpecialAttack), 10); + QCOMPARE(m_species2->baseStat(ST_SpecialAttack), 10); QCOMPARE(m_changedCount, 5); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 5); - m_sigmod->rules()->setSpecialSplit(true); + m_game->rules()->setSpecialSplit(true); - m_species2->setBaseStat(Sigmod::ST_SpecialDefense, 0); + m_species2->setBaseStat(ST_SpecialDefense, 0); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 6); - m_species2->setBaseStat(Sigmod::ST_SpecialDefense, 10); - m_species2->setBaseStat(Sigmod::ST_SpecialDefense, 10); + m_species2->setBaseStat(ST_SpecialDefense, 10); + m_species2->setBaseStat(ST_SpecialDefense, 10); - QCOMPARE(m_species2->baseStat(Sigmod::ST_SpecialDefense), 10); + QCOMPARE(m_species2->baseStat(ST_SpecialDefense), 10); QCOMPARE(m_changedCount, 6); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 6); - m_sigmod->rules()->setSpecialSplit(false); + m_game->rules()->setSpecialSplit(false); - m_species2->setBaseStat(Sigmod::ST_SpecialDefense, 10); + m_species2->setBaseStat(ST_SpecialDefense, 10); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); @@ -542,108 +545,108 @@ void TestSpecies::setBaseStat() void TestSpecies::setEffortValue() { - m_species2->setEffortValue(Sigmod::ST_HP, -1); + m_species2->setEffortValue(ST_HP, -1); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setEffortValue(Sigmod::ST_HP, 18); - m_species2->setEffortValue(Sigmod::ST_HP, 18); + m_species2->setEffortValue(ST_HP, 18); + m_species2->setEffortValue(ST_HP, 18); - QCOMPARE(m_species2->effortValue(Sigmod::ST_HP), 18); + QCOMPARE(m_species2->effortValue(ST_HP), 18); QCOMPARE(m_changedCount, 1); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setEffortValue(Sigmod::ST_Attack, -1); + m_species2->setEffortValue(ST_Attack, -1); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setEffortValue(Sigmod::ST_Attack, 18); - m_species2->setEffortValue(Sigmod::ST_Attack, 18); + m_species2->setEffortValue(ST_Attack, 18); + m_species2->setEffortValue(ST_Attack, 18); - QCOMPARE(m_species2->effortValue(Sigmod::ST_Attack), 18); + QCOMPARE(m_species2->effortValue(ST_Attack), 18); QCOMPARE(m_changedCount, 2); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setEffortValue(Sigmod::ST_Defense, -1); + m_species2->setEffortValue(ST_Defense, -1); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_species2->setEffortValue(Sigmod::ST_Defense, 18); - m_species2->setEffortValue(Sigmod::ST_Defense, 18); + m_species2->setEffortValue(ST_Defense, 18); + m_species2->setEffortValue(ST_Defense, 18); - QCOMPARE(m_species2->effortValue(Sigmod::ST_Defense), 18); + QCOMPARE(m_species2->effortValue(ST_Defense), 18); QCOMPARE(m_changedCount, 3); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_species2->setEffortValue(Sigmod::ST_Speed, -1); + m_species2->setEffortValue(ST_Speed, -1); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 4); - m_species2->setEffortValue(Sigmod::ST_Speed, 18); - m_species2->setEffortValue(Sigmod::ST_Speed, 18); + m_species2->setEffortValue(ST_Speed, 18); + m_species2->setEffortValue(ST_Speed, 18); - QCOMPARE(m_species2->effortValue(Sigmod::ST_Speed), 18); + QCOMPARE(m_species2->effortValue(ST_Speed), 18); QCOMPARE(m_changedCount, 4); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 4); - m_species2->setEffortValue(Sigmod::ST_SpecialAttack, -1); + m_species2->setEffortValue(ST_SpecialAttack, -1); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 5); - m_species2->setEffortValue(Sigmod::ST_SpecialAttack, 18); - m_species2->setEffortValue(Sigmod::ST_SpecialAttack, 18); + m_species2->setEffortValue(ST_SpecialAttack, 18); + m_species2->setEffortValue(ST_SpecialAttack, 18); - QCOMPARE(m_species2->effortValue(Sigmod::ST_SpecialAttack), 18); + QCOMPARE(m_species2->effortValue(ST_SpecialAttack), 18); QCOMPARE(m_changedCount, 5); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 5); - m_sigmod->rules()->setSpecialSplit(true); + m_game->rules()->setSpecialSplit(true); - m_species2->setEffortValue(Sigmod::ST_SpecialDefense, -1); + m_species2->setEffortValue(ST_SpecialDefense, -1); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 6); - m_sigmod->rules()->setMaxEVPerStat(20); + m_game->rules()->setMaxEVPerStat(20); - m_species2->setEffortValue(Sigmod::ST_SpecialDefense, 25); + m_species2->setEffortValue(ST_SpecialDefense, 25); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); - m_species2->setEffortValue(Sigmod::ST_SpecialDefense, 18); - m_species2->setEffortValue(Sigmod::ST_SpecialDefense, 18); + m_species2->setEffortValue(ST_SpecialDefense, 18); + m_species2->setEffortValue(ST_SpecialDefense, 18); - QCOMPARE(m_species2->effortValue(Sigmod::ST_SpecialDefense), 18); + QCOMPARE(m_species2->effortValue(ST_SpecialDefense), 18); QCOMPARE(m_changedCount, 6); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 7); - m_sigmod->rules()->setSpecialSplit(false); + m_game->rules()->setSpecialSplit(false); - m_species2->setEffortValue(Sigmod::ST_SpecialDefense, 18); + m_species2->setEffortValue(ST_SpecialDefense, 18); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 8); @@ -651,10 +654,10 @@ void TestSpecies::setEffortValue() void TestSpecies::setGrowth() { - m_species2->setGrowth(Sigmod::Species::Erratic); - m_species2->setGrowth(Sigmod::Species::Erratic); + m_species2->setGrowth(Species::Erratic); + m_species2->setGrowth(Species::Erratic); - QCOMPARE(m_species2->growth(), Sigmod::Species::Erratic); + QCOMPARE(m_species2->growth(), Species::Erratic); QCOMPARE(m_changedCount, 1); @@ -723,20 +726,20 @@ void TestSpecies::setMaxHoldWeight() void TestSpecies::setRunChance() { - m_species2->setRunChance(Sigcore::Fraction(-1, 1)); + m_species2->setRunChance(Fraction(-1, 1)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setRunChance(Sigcore::Fraction(2, 1)); + m_species2->setRunChance(Fraction(2, 1)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setRunChance(Sigcore::Fraction(3, 4)); - m_species2->setRunChance(Sigcore::Fraction(3, 4)); + m_species2->setRunChance(Fraction(3, 4)); + m_species2->setRunChance(Fraction(3, 4)); - QCOMPARE(m_species2->runChance(), Sigcore::Fraction(3, 4)); + QCOMPARE(m_species2->runChance(), Fraction(3, 4)); QCOMPARE(m_changedCount, 1); @@ -746,20 +749,20 @@ void TestSpecies::setRunChance() void TestSpecies::setFleeChance() { - m_species2->setFleeChance(Sigcore::Fraction(-1, 1)); + m_species2->setFleeChance(Fraction(-1, 1)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setFleeChance(Sigcore::Fraction(2, 1)); + m_species2->setFleeChance(Fraction(2, 1)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setFleeChance(Sigcore::Fraction(3, 4)); - m_species2->setFleeChance(Sigcore::Fraction(3, 4)); + m_species2->setFleeChance(Fraction(3, 4)); + m_species2->setFleeChance(Fraction(3, 4)); - QCOMPARE(m_species2->fleeChance(), Sigcore::Fraction(3, 4)); + QCOMPARE(m_species2->fleeChance(), Fraction(3, 4)); QCOMPARE(m_changedCount, 1); @@ -769,20 +772,20 @@ void TestSpecies::setFleeChance() void TestSpecies::setItemChance() { - m_species2->setItemChance(Sigcore::Fraction(-1, 1)); + m_species2->setItemChance(Fraction(-1, 1)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setItemChance(Sigcore::Fraction(2, 1)); + m_species2->setItemChance(Fraction(2, 1)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setItemChance(Sigcore::Fraction(3, 4)); - m_species2->setItemChance(Sigcore::Fraction(3, 4)); + m_species2->setItemChance(Fraction(3, 4)); + m_species2->setItemChance(Fraction(3, 4)); - QCOMPARE(m_species2->itemChance(), Sigcore::Fraction(3, 4)); + QCOMPARE(m_species2->itemChance(), Fraction(3, 4)); QCOMPARE(m_changedCount, 1); @@ -851,15 +854,15 @@ void TestSpecies::setFrontMaleSprite() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setGenderFactor(Sigcore::Fraction(1, 1)); - m_sigmod->newSprite(); + m_species2->setGenderFactor(Fraction(1, 1)); + m_game->newSprite(); m_species2->setFrontMaleSprite(4); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setGenderFactor(Sigcore::Fraction(1, 2)); + m_species2->setGenderFactor(Fraction(1, 2)); m_species2->setFrontMaleSprite(4); m_species2->setFrontMaleSprite(4); @@ -879,15 +882,15 @@ void TestSpecies::setBackMaleSprite() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setGenderFactor(Sigcore::Fraction(1, 1)); - m_sigmod->newSprite(); + m_species2->setGenderFactor(Fraction(1, 1)); + m_game->newSprite(); m_species2->setBackMaleSprite(5); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setGenderFactor(Sigcore::Fraction(1, 2)); + m_species2->setGenderFactor(Fraction(1, 2)); m_species2->setBackMaleSprite(5); m_species2->setBackMaleSprite(5); @@ -902,22 +905,22 @@ void TestSpecies::setBackMaleSprite() void TestSpecies::setFrontFemaleSprite() { - m_sigmod->rules()->setGenderAllowed(true); + m_game->rules()->setGenderAllowed(true); m_species2->setFrontFemaleSprite(6); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setGenderFactor(Sigcore::Fraction(0, 1)); - m_sigmod->newSprite(); + m_species2->setGenderFactor(Fraction(0, 1)); + m_game->newSprite(); m_species2->setFrontFemaleSprite(6); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setGenderFactor(Sigcore::Fraction(1, 2)); + m_species2->setGenderFactor(Fraction(1, 2)); m_species2->setFrontFemaleSprite(6); m_species2->setFrontFemaleSprite(6); @@ -929,7 +932,7 @@ void TestSpecies::setFrontFemaleSprite() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_sigmod->rules()->setGenderAllowed(false); + m_game->rules()->setGenderAllowed(false); m_species2->setFrontFemaleSprite(6); @@ -939,22 +942,22 @@ void TestSpecies::setFrontFemaleSprite() void TestSpecies::setBackFemaleSprite() { - m_sigmod->rules()->setGenderAllowed(true); + m_game->rules()->setGenderAllowed(true); m_species2->setBackFemaleSprite(7); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setGenderFactor(Sigcore::Fraction(0, 1)); - m_sigmod->newSprite(); + m_species2->setGenderFactor(Fraction(0, 1)); + m_game->newSprite(); m_species2->setBackFemaleSprite(7); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setGenderFactor(Sigcore::Fraction(1, 2)); + m_species2->setGenderFactor(Fraction(1, 2)); m_species2->setBackFemaleSprite(7); m_species2->setBackFemaleSprite(7); @@ -966,7 +969,7 @@ void TestSpecies::setBackFemaleSprite() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_sigmod->rules()->setGenderAllowed(false); + m_game->rules()->setGenderAllowed(false); m_species2->setBackFemaleSprite(7); @@ -981,7 +984,7 @@ void TestSpecies::setSkin() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newSkin(); + m_game->newSkin(); m_species2->setSkin(2); m_species2->setSkin(2); @@ -1009,20 +1012,20 @@ void TestSpecies::setEncyclopediaEntry() void TestSpecies::setGenderFactor() { - m_species2->setGenderFactor(Sigcore::Fraction(-2, 1)); + m_species2->setGenderFactor(Fraction(-2, 1)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_species2->setGenderFactor(Sigcore::Fraction(2, 1)); + m_species2->setGenderFactor(Fraction(2, 1)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_species2->setGenderFactor(Sigcore::Fraction(1, 4)); - m_species2->setGenderFactor(Sigcore::Fraction(1, 4)); + m_species2->setGenderFactor(Fraction(1, 4)); + m_species2->setGenderFactor(Fraction(1, 4)); - QCOMPARE(m_species2->genderFactor(), Sigcore::Fraction(1, 4)); + QCOMPARE(m_species2->genderFactor(), Fraction(1, 4)); QCOMPARE(m_changedCount, 1); @@ -1037,7 +1040,7 @@ void TestSpecies::setEggSpecies() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 0); - m_sigmod->newSpecies(); + m_game->newSpecies(); m_species2->setEggSpecies(2); m_species2->setEggSpecies(2); @@ -1070,7 +1073,7 @@ void TestSpecies::setEggSteps() void TestSpecies::setType() { - m_sigmod->newType(); + m_game->newType(); m_species2->setType(0, true); m_species2->setType(0, true); @@ -1112,7 +1115,7 @@ void TestSpecies::setType() void TestSpecies::setEggGroup() { - m_sigmod->newEggGroup(); + m_game->newEggGroup(); m_species2->setEggGroup(0, true); m_species2->setEggGroup(0, true); @@ -1154,7 +1157,7 @@ void TestSpecies::setEggGroup() void TestSpecies::setAbility() { - m_sigmod->newAbility(); + m_game->newAbility(); m_species2->setAbility(0, 1); m_species2->setAbility(0, 1); @@ -1214,7 +1217,7 @@ void TestSpecies::setAbility() void TestSpecies::setItem() { - m_sigmod->newItem(); + m_game->newItem(); m_species2->setItem(0, 1); m_species2->setItem(0, 1); @@ -1298,10 +1301,10 @@ void TestSpecies::moves() void TestSpecies::setEvolution() { - m_species2->setEvolution(Sigcore::Script("python", "import os")); - m_species2->setEvolution(Sigcore::Script("python", "import os")); + m_species2->setEvolution(Script("python", "import os")); + m_species2->setEvolution(Script("python", "import os")); - QCOMPARE(m_species2->evolution(), Sigcore::Script("python", "import os")); + QCOMPARE(m_species2->evolution(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -1313,28 +1316,28 @@ void TestSpecies::assignment() { *m_species3 = *m_species2; - m_sigmod->rules()->setSpecialSplit(true); + m_game->rules()->setSpecialSplit(true); QCOMPARE(m_species3->name(), QString("Foo")); - QCOMPARE(m_species3->baseStat(Sigmod::ST_HP), 10); - QCOMPARE(m_species3->baseStat(Sigmod::ST_Attack), 10); - QCOMPARE(m_species3->baseStat(Sigmod::ST_Defense), 10); - QCOMPARE(m_species3->baseStat(Sigmod::ST_Speed), 10); - QCOMPARE(m_species3->baseStat(Sigmod::ST_SpecialAttack), 10); - QCOMPARE(m_species3->baseStat(Sigmod::ST_SpecialDefense), 10); - QCOMPARE(m_species3->effortValue(Sigmod::ST_HP), 18); - QCOMPARE(m_species3->effortValue(Sigmod::ST_Attack), 18); - QCOMPARE(m_species3->effortValue(Sigmod::ST_Defense), 18); - QCOMPARE(m_species3->effortValue(Sigmod::ST_Speed), 18); - QCOMPARE(m_species3->effortValue(Sigmod::ST_SpecialAttack), 18); - QCOMPARE(m_species3->effortValue(Sigmod::ST_SpecialDefense), 18); - QCOMPARE(m_species3->growth(), Sigmod::Species::Erratic); + QCOMPARE(m_species3->baseStat(ST_HP), 10); + QCOMPARE(m_species3->baseStat(ST_Attack), 10); + QCOMPARE(m_species3->baseStat(ST_Defense), 10); + QCOMPARE(m_species3->baseStat(ST_Speed), 10); + QCOMPARE(m_species3->baseStat(ST_SpecialAttack), 10); + QCOMPARE(m_species3->baseStat(ST_SpecialDefense), 10); + QCOMPARE(m_species3->effortValue(ST_HP), 18); + QCOMPARE(m_species3->effortValue(ST_Attack), 18); + QCOMPARE(m_species3->effortValue(ST_Defense), 18); + QCOMPARE(m_species3->effortValue(ST_Speed), 18); + QCOMPARE(m_species3->effortValue(ST_SpecialAttack), 18); + QCOMPARE(m_species3->effortValue(ST_SpecialDefense), 18); + QCOMPARE(m_species3->growth(), Species::Erratic); QCOMPARE(m_species3->experienceValue(), 10); QCOMPARE(m_species3->catchValue(), 10); QCOMPARE(m_species3->maxHoldWeight(), 10); - QCOMPARE(m_species3->runChance(), Sigcore::Fraction(3, 4)); - QCOMPARE(m_species3->fleeChance(), Sigcore::Fraction(3, 4)); - QCOMPARE(m_species3->itemChance(), Sigcore::Fraction(3, 4)); + QCOMPARE(m_species3->runChance(), Fraction(3, 4)); + QCOMPARE(m_species3->fleeChance(), Fraction(3, 4)); + QCOMPARE(m_species3->itemChance(), Fraction(3, 4)); QCOMPARE(m_species3->encyclopediaNumber(), 5); QCOMPARE(m_species3->weight(), 10); QCOMPARE(m_species3->height(), 10); @@ -1344,7 +1347,7 @@ void TestSpecies::assignment() QCOMPARE(m_species3->frontFemaleSprite(), 6); QCOMPARE(m_species3->backFemaleSprite(), 7); QCOMPARE(m_species3->skin(), 2); - QCOMPARE(m_species3->genderFactor(), Sigcore::Fraction(1, 4)); + QCOMPARE(m_species3->genderFactor(), Fraction(1, 4)); QCOMPARE(m_species3->eggSpecies(), 2); QCOMPARE(m_species3->eggSteps(), 1000); QCOMPARE(m_species3->type(0), true); @@ -1353,7 +1356,7 @@ void TestSpecies::assignment() QCOMPARE(m_species3->eggGroup(0), true); QCOMPARE(m_species3->eggGroup(1), false); QCOMPARE(m_species3->eggGroup(2), false); - QCOMPARE(m_species3->evolution(), Sigcore::Script("python", "import os")); + QCOMPARE(m_species3->evolution(), Script("python", "import os")); QCOMPARE(m_species3->ability(0), 1); QCOMPARE(m_species3->ability(1), 2); QCOMPARE(m_species3->item(0), 1); diff --git a/sigmod/test/TestSpeciesMove.cpp b/sigmod/test/TestSpeciesMove.cpp index ec8b5454..979af8c3 100644 --- a/sigmod/test/TestSpeciesMove.cpp +++ b/sigmod/test/TestSpeciesMove.cpp @@ -19,8 +19,8 @@ #include "TestSpeciesMove.h" // Sigmod includes +#include "../Game.h" #include "../Rules.h" -#include "../Sigmod.h" #include "../Species.h" #include "../SpeciesMove.h" @@ -28,11 +28,13 @@ #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestSpeciesMove::initTestCase() { TestSigmodObject::initTestCase(); - Sigmod::Species* species = m_sigmod->newSpecies(); + Species* species = m_game->newSpecies(); m_speciesMove1 = species->newMove(); m_speciesMove2 = species->newMove(); @@ -69,7 +71,7 @@ void TestSpeciesMove::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newMove(); + m_game->newMove(); m_speciesMove1->setMove(0); m_speciesMove1->validate(); @@ -77,7 +79,7 @@ void TestSpeciesMove::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->rules()->setMaxLevel(25); + m_game->rules()->setMaxLevel(25); m_speciesMove1->setLevel(15); m_speciesMove1->validate(); @@ -85,14 +87,14 @@ void TestSpeciesMove::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->rules()->setMaxLevel(10); + m_game->rules()->setMaxLevel(10); m_speciesMove1->validate(); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_sigmod->rules()->setMaxLevel(50); + m_game->rules()->setMaxLevel(50); m_speciesMove1->setWild(40); m_speciesMove1->validate(); @@ -100,7 +102,7 @@ void TestSpeciesMove::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_sigmod->rules()->setMaxLevel(30); + m_game->rules()->setMaxLevel(30); m_speciesMove1->validate(); @@ -110,7 +112,7 @@ void TestSpeciesMove::validation() void TestSpeciesMove::saving() { - QDomDocument xml = Sigmod::Object::xml(m_speciesMove1); + QDomDocument xml = Object::xml(m_speciesMove1); QFile file("speciesMove.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -123,7 +125,7 @@ void TestSpeciesMove::loading() QDomDocument xml; QFile file("speciesMove.xml"); - m_sigmod->newMove(); + m_game->newMove(); m_speciesMove1->setMove(1); m_speciesMove1->setLevel(5); @@ -145,7 +147,7 @@ void TestSpeciesMove::setMove() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newMove(); + m_game->newMove(); m_speciesMove2->setMove(2); m_speciesMove2->setMove(2); diff --git a/sigmod/test/TestSprite.cpp b/sigmod/test/TestSprite.cpp index 188f224b..d0bab0f9 100644 --- a/sigmod/test/TestSprite.cpp +++ b/sigmod/test/TestSprite.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,20 +19,22 @@ #include "TestSprite.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" #include "../Sprite.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestSprite::initTestCase() { TestSigmodObject::initTestCase(); - m_sprite1 = m_sigmod->newSprite(); - m_sprite2 = m_sigmod->newSprite(); - m_sprite3 = m_sigmod->newSprite(); + m_sprite1 = m_game->newSprite(); + m_sprite2 = m_game->newSprite(); + m_sprite3 = m_game->newSprite(); } void TestSprite::cleanupTestCase() @@ -80,7 +82,7 @@ void TestSprite::validation() void TestSprite::saving() { - QDomDocument xml = Sigmod::Object::xml(m_sprite1); + QDomDocument xml = Object::xml(m_sprite1); QFile file("sprite.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); diff --git a/sigmod/test/TestStatus.cpp b/sigmod/test/TestStatus.cpp index 8ad3cb64..2eefd5da 100644 --- a/sigmod/test/TestStatus.cpp +++ b/sigmod/test/TestStatus.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,22 +19,23 @@ #include "TestStatus.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" #include "../Status.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> -#include <QtCore/QtDebug> +using namespace Sigcore; +using namespace Sigmod; void TestStatus::initTestCase() { TestSigmodObject::initTestCase(); - m_status1 = m_sigmod->newStatus(); - m_status2 = m_sigmod->newStatus(); - m_status3 = m_sigmod->newStatus(); + m_status1 = m_game->newStatus(); + m_status2 = m_game->newStatus(); + m_status3 = m_game->newStatus(); } void TestStatus::cleanupTestCase() @@ -76,7 +77,7 @@ void TestStatus::validation() void TestStatus::saving() { - QDomDocument xml = Sigmod::Object::xml(m_status1); + QDomDocument xml = Object::xml(m_status1); QFile file("status.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -90,16 +91,16 @@ void TestStatus::loading() QFile file("status.xml"); m_status1->setName("Bar"); - m_status1->setBattleScript(Sigcore::Script("python", "import os")); - m_status1->setWorldScript(Sigcore::Script("python", "import os")); + m_status1->setBattleScript(Script("python", "import os")); + m_status1->setWorldScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); m_status1->load(xml.firstChildElement("Status")); QCOMPARE(m_status1->name(), QString("Foo")); - QCOMPARE(m_status1->battleScript(), Sigcore::Script()); - QCOMPARE(m_status1->worldScript(), Sigcore::Script()); + QCOMPARE(m_status1->battleScript(), Script()); + QCOMPARE(m_status1->worldScript(), Script()); } void TestStatus::setName() @@ -117,10 +118,10 @@ void TestStatus::setName() void TestStatus::setBattleScript() { - m_status2->setBattleScript(Sigcore::Script("python", "import os")); - m_status2->setBattleScript(Sigcore::Script("python", "import os")); + m_status2->setBattleScript(Script("python", "import os")); + m_status2->setBattleScript(Script("python", "import os")); - QCOMPARE(m_status2->battleScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_status2->battleScript(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -130,10 +131,10 @@ void TestStatus::setBattleScript() void TestStatus::setWorldScript() { - m_status2->setWorldScript(Sigcore::Script("python", "import os")); - m_status2->setWorldScript(Sigcore::Script("python", "import os")); + m_status2->setWorldScript(Script("python", "import os")); + m_status2->setWorldScript(Script("python", "import os")); - QCOMPARE(m_status2->worldScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_status2->worldScript(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -146,8 +147,8 @@ void TestStatus::assignment() *m_status3 = *m_status2; QCOMPARE(m_status3->name(), QString("Foo")); - QCOMPARE(m_status3->battleScript(), Sigcore::Script("python", "import os")); - QCOMPARE(m_status3->worldScript(), Sigcore::Script("python", "import os")); + QCOMPARE(m_status3->battleScript(), Script("python", "import os")); + QCOMPARE(m_status3->worldScript(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestStatus) diff --git a/sigmod/test/TestStore.cpp b/sigmod/test/TestStore.cpp index 8dd568e8..4957e940 100644 --- a/sigmod/test/TestStore.cpp +++ b/sigmod/test/TestStore.cpp @@ -19,20 +19,22 @@ #include "TestStore.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" #include "../Store.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestStore::initTestCase() { TestSigmodObject::initTestCase(); - m_store1 = m_sigmod->newStore(); - m_store2 = m_sigmod->newStore(); - m_store3 = m_sigmod->newStore(); + m_store1 = m_game->newStore(); + m_store2 = m_game->newStore(); + m_store3 = m_game->newStore(); } void TestStore::cleanupTestCase() @@ -71,7 +73,7 @@ void TestStore::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_sigmod->newItem(); + m_game->newItem(); m_store1->setItem(0, true); m_store1->validate(); @@ -82,7 +84,7 @@ void TestStore::validation() void TestStore::saving() { - QDomDocument xml = Sigmod::Object::xml(m_store1); + QDomDocument xml = Object::xml(m_store1); QFile file("store.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -95,7 +97,7 @@ void TestStore::loading() QDomDocument xml; QFile file("store.xml"); - m_sigmod->newItem(); + m_game->newItem(); m_store1->setName("Bar"); m_store1->setItem(0, false); @@ -125,7 +127,7 @@ void TestStore::setName() void TestStore::items() { - m_sigmod->newItem(); + m_game->newItem(); m_store2->setItem(0, true); m_store2->setItem(0, true); diff --git a/sigmod/test/TestTile.cpp b/sigmod/test/TestTile.cpp index 3a90e014..bf5f57c6 100644 --- a/sigmod/test/TestTile.cpp +++ b/sigmod/test/TestTile.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,20 +19,23 @@ #include "TestTile.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" #include "../Tile.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestTile::initTestCase() { TestSigmodObject::initTestCase(); - m_tile1 = m_sigmod->newTile(); - m_tile2 = m_sigmod->newTile(); - m_tile3 = m_sigmod->newTile(); + m_tile1 = m_game->newTile(); + m_tile2 = m_game->newTile(); + m_tile3 = m_game->newTile(); } void TestTile::cleanupTestCase() @@ -74,7 +77,7 @@ void TestTile::validation() void TestTile::saving() { - QDomDocument xml = Sigmod::Object::xml(m_tile1); + QDomDocument xml = Object::xml(m_tile1); QFile file("tile.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -89,7 +92,7 @@ void TestTile::loading() m_tile1->setName("Bar"); m_tile1->setWalkable(false); - m_tile1->setScript(Sigcore::Script("python", "import os")); + m_tile1->setScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); @@ -97,7 +100,7 @@ void TestTile::loading() QCOMPARE(m_tile1->name(), QString("Foo")); QCOMPARE(m_tile1->walkable(), true); - QCOMPARE(m_tile1->script(), Sigcore::Script()); + QCOMPARE(m_tile1->script(), Script()); } void TestTile::setName() @@ -128,10 +131,10 @@ void TestTile::setWalkable() void TestTile::setScript() { - m_tile2->setScript(Sigcore::Script("python", "import os")); - m_tile2->setScript(Sigcore::Script("python", "import os")); + m_tile2->setScript(Script("python", "import os")); + m_tile2->setScript(Script("python", "import os")); - QCOMPARE(m_tile2->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_tile2->script(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -145,7 +148,7 @@ void TestTile::assignment() QCOMPARE(m_tile3->name(), QString("Foo")); QCOMPARE(m_tile3->walkable(), false); - QCOMPARE(m_tile3->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_tile3->script(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestTile) diff --git a/sigmod/test/TestTime.cpp b/sigmod/test/TestTime.cpp index 452f10f9..13b6518e 100644 --- a/sigmod/test/TestTime.cpp +++ b/sigmod/test/TestTime.cpp @@ -19,20 +19,23 @@ #include "TestTime.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" #include "../Time.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestTime::initTestCase() { TestSigmodObject::initTestCase(); - m_time1 = m_sigmod->newTime(); - m_time2 = m_sigmod->newTime(); - m_time3 = m_sigmod->newTime(); + m_time1 = m_game->newTime(); + m_time2 = m_game->newTime(); + m_time3 = m_game->newTime(); } void TestTime::cleanupTestCase() @@ -74,7 +77,7 @@ void TestTime::validation() void TestTime::saving() { - QDomDocument xml = Sigmod::Object::xml(m_time1); + QDomDocument xml = Object::xml(m_time1); QFile file("time.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -90,7 +93,7 @@ void TestTime::loading() m_time1->setName("Bar"); m_time1->setHour(12); m_time1->setMinute(30); - m_time1->setScript(Sigcore::Script("python", "import os")); + m_time1->setScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); @@ -99,7 +102,7 @@ void TestTime::loading() QCOMPARE(m_time1->name(), QString("Foo")); QCOMPARE(m_time1->hour(), 0); QCOMPARE(m_time1->minute(), 0); - QCOMPARE(m_time1->script(), Sigcore::Script()); + QCOMPARE(m_time1->script(), Script()); } void TestTime::setName() @@ -163,10 +166,10 @@ void TestTime::setMinute() void TestTime::setScript() { - m_time2->setScript(Sigcore::Script("python", "import os")); - m_time2->setScript(Sigcore::Script("python", "import os")); + m_time2->setScript(Script("python", "import os")); + m_time2->setScript(Script("python", "import os")); - QCOMPARE(m_time2->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_time2->script(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -181,7 +184,7 @@ void TestTime::assignment() QCOMPARE(m_time3->name(), QString("Foo")); QCOMPARE(m_time3->hour(), 12); QCOMPARE(m_time3->minute(), 30); - QCOMPARE(m_time3->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_time3->script(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestTime) diff --git a/sigmod/test/TestTrainer.cpp b/sigmod/test/TestTrainer.cpp index 36775116..092e3490 100644 --- a/sigmod/test/TestTrainer.cpp +++ b/sigmod/test/TestTrainer.cpp @@ -19,20 +19,22 @@ #include "TestTrainer.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" #include "../Trainer.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigmod; + void TestTrainer::initTestCase() { TestSigmodObject::initTestCase(); - m_trainer1 = m_sigmod->newTrainer(); - m_trainer2 = m_sigmod->newTrainer(); - m_trainer3 = m_sigmod->newTrainer(); + m_trainer1 = m_game->newTrainer(); + m_trainer2 = m_game->newTrainer(); + m_trainer3 = m_game->newTrainer(); } void TestTrainer::cleanupTestCase() @@ -71,7 +73,7 @@ void TestTrainer::validation() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 3); - m_sigmod->newSkin(); + m_game->newSkin(); m_trainer1->setSkin(0); m_trainer1->validate(); @@ -83,7 +85,7 @@ void TestTrainer::validation() void TestTrainer::saving() { - QDomDocument xml = Sigmod::Object::xml(m_trainer1); + QDomDocument xml = Object::xml(m_trainer1); QFile file("trainer.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -96,17 +98,17 @@ void TestTrainer::loading() QDomDocument xml; QFile file("trainer.xml"); - m_sigmod->newSkin(); + m_game->newSkin(); m_trainer1->setName("Bar"); m_trainer1->setMoneyFactor(1); m_trainer1->setSkin(1); m_trainer1->setDepth(5); - m_trainer1->setTeamIntel(Sigmod::Trainer::Cheating); - m_trainer1->setMoveIntel(Sigmod::Trainer::Cheating); - m_trainer1->setItemIntel(Sigmod::Trainer::Cheating); - m_trainer1->setAbilityIntel(Sigmod::Trainer::Cheating); - m_trainer1->setStatIntel(Sigmod::Trainer::Cheating); + m_trainer1->setTeamIntel(Trainer::Cheating); + m_trainer1->setMoveIntel(Trainer::Cheating); + m_trainer1->setItemIntel(Trainer::Cheating); + m_trainer1->setAbilityIntel(Trainer::Cheating); + m_trainer1->setStatIntel(Trainer::Cheating); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); @@ -116,11 +118,11 @@ void TestTrainer::loading() QCOMPARE(m_trainer1->moneyFactor(), 0); QCOMPARE(m_trainer1->skin(), 0); QCOMPARE(m_trainer1->depth(), 0); - QCOMPARE(m_trainer1->teamIntel(), Sigmod::Trainer::Remember); - QCOMPARE(m_trainer1->moveIntel(), Sigmod::Trainer::Remember); - QCOMPARE(m_trainer1->itemIntel(), Sigmod::Trainer::Remember); - QCOMPARE(m_trainer1->abilityIntel(), Sigmod::Trainer::Remember); - QCOMPARE(m_trainer1->statIntel(), Sigmod::Trainer::Remember); + QCOMPARE(m_trainer1->teamIntel(), Trainer::Remember); + QCOMPARE(m_trainer1->moveIntel(), Trainer::Remember); + QCOMPARE(m_trainer1->itemIntel(), Trainer::Remember); + QCOMPARE(m_trainer1->abilityIntel(), Trainer::Remember); + QCOMPARE(m_trainer1->statIntel(), Trainer::Remember); } void TestTrainer::setName() @@ -161,7 +163,7 @@ void TestTrainer::setSkin() QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_sigmod->newSkin(); + m_game->newSkin(); m_trainer2->setSkin(2); m_trainer2->setSkin(2); @@ -194,10 +196,10 @@ void TestTrainer::setDepth() void TestTrainer::setTeamIntel() { - m_trainer2->setTeamIntel(Sigmod::Trainer::Cheating); - m_trainer2->setTeamIntel(Sigmod::Trainer::Cheating); + m_trainer2->setTeamIntel(Trainer::Cheating); + m_trainer2->setTeamIntel(Trainer::Cheating); - QCOMPARE(m_trainer2->teamIntel(), Sigmod::Trainer::Cheating); + QCOMPARE(m_trainer2->teamIntel(), Trainer::Cheating); QCOMPARE(m_changedCount, 1); @@ -207,10 +209,10 @@ void TestTrainer::setTeamIntel() void TestTrainer::setMoveIntel() { - m_trainer2->setMoveIntel(Sigmod::Trainer::Cheating); - m_trainer2->setMoveIntel(Sigmod::Trainer::Cheating); + m_trainer2->setMoveIntel(Trainer::Cheating); + m_trainer2->setMoveIntel(Trainer::Cheating); - QCOMPARE(m_trainer2->moveIntel(), Sigmod::Trainer::Cheating); + QCOMPARE(m_trainer2->moveIntel(), Trainer::Cheating); QCOMPARE(m_changedCount, 1); @@ -220,10 +222,10 @@ void TestTrainer::setMoveIntel() void TestTrainer::setItemIntel() { - m_trainer2->setItemIntel(Sigmod::Trainer::Cheating); - m_trainer2->setItemIntel(Sigmod::Trainer::Cheating); + m_trainer2->setItemIntel(Trainer::Cheating); + m_trainer2->setItemIntel(Trainer::Cheating); - QCOMPARE(m_trainer2->itemIntel(), Sigmod::Trainer::Cheating); + QCOMPARE(m_trainer2->itemIntel(), Trainer::Cheating); QCOMPARE(m_changedCount, 1); @@ -233,10 +235,10 @@ void TestTrainer::setItemIntel() void TestTrainer::setAbilityIntel() { - m_trainer2->setAbilityIntel(Sigmod::Trainer::Cheating); - m_trainer2->setAbilityIntel(Sigmod::Trainer::Cheating); + m_trainer2->setAbilityIntel(Trainer::Cheating); + m_trainer2->setAbilityIntel(Trainer::Cheating); - QCOMPARE(m_trainer2->abilityIntel(), Sigmod::Trainer::Cheating); + QCOMPARE(m_trainer2->abilityIntel(), Trainer::Cheating); QCOMPARE(m_changedCount, 1); @@ -246,10 +248,10 @@ void TestTrainer::setAbilityIntel() void TestTrainer::setStatIntel() { - m_trainer2->setStatIntel(Sigmod::Trainer::Cheating); - m_trainer2->setStatIntel(Sigmod::Trainer::Cheating); + m_trainer2->setStatIntel(Trainer::Cheating); + m_trainer2->setStatIntel(Trainer::Cheating); - QCOMPARE(m_trainer2->statIntel(), Sigmod::Trainer::Cheating); + QCOMPARE(m_trainer2->statIntel(), Trainer::Cheating); QCOMPARE(m_changedCount, 1); @@ -265,11 +267,11 @@ void TestTrainer::assignment() QCOMPARE(m_trainer3->moneyFactor(), 5); QCOMPARE(m_trainer3->skin(), 2); QCOMPARE(m_trainer3->depth(), 5); - QCOMPARE(m_trainer3->teamIntel(), Sigmod::Trainer::Cheating); - QCOMPARE(m_trainer3->moveIntel(), Sigmod::Trainer::Cheating); - QCOMPARE(m_trainer3->itemIntel(), Sigmod::Trainer::Cheating); - QCOMPARE(m_trainer3->abilityIntel(), Sigmod::Trainer::Cheating); - QCOMPARE(m_trainer3->statIntel(), Sigmod::Trainer::Cheating); + QCOMPARE(m_trainer3->teamIntel(), Trainer::Cheating); + QCOMPARE(m_trainer3->moveIntel(), Trainer::Cheating); + QCOMPARE(m_trainer3->itemIntel(), Trainer::Cheating); + QCOMPARE(m_trainer3->abilityIntel(), Trainer::Cheating); + QCOMPARE(m_trainer3->statIntel(), Trainer::Cheating); } QTEST_APPLESS_MAIN(TestTrainer) diff --git a/sigmod/test/TestType.cpp b/sigmod/test/TestType.cpp index 7e62b3b7..8124f7d4 100644 --- a/sigmod/test/TestType.cpp +++ b/sigmod/test/TestType.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,20 +19,23 @@ #include "TestType.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" #include "../Type.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> +using namespace Sigcore; +using namespace Sigmod; + void TestType::initTestCase() { TestSigmodObject::initTestCase(); - m_type1 = m_sigmod->newType(); - m_type2 = m_sigmod->newType(); - m_type3 = m_sigmod->newType(); + m_type1 = m_game->newType(); + m_type2 = m_game->newType(); + m_type3 = m_game->newType(); } void TestType::cleanupTestCase() @@ -74,7 +77,7 @@ void TestType::validation() void TestType::saving() { - QDomDocument xml = Sigmod::Object::xml(m_type1); + QDomDocument xml = Object::xml(m_type1); QFile file("type.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -88,14 +91,14 @@ void TestType::loading() QFile file("type.xml"); m_type1->setName("Bar"); - m_type1->setStab(Sigcore::Fraction(2, 1)); + m_type1->setStab(Fraction(2, 1)); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); m_type1->load(xml.firstChildElement("Type")); QCOMPARE(m_type1->name(), QString("Foo")); - QCOMPARE(m_type1->stab(), Sigcore::Fraction(1, 1)); + QCOMPARE(m_type1->stab(), Fraction(1, 1)); } void TestType::setName() @@ -113,15 +116,15 @@ void TestType::setName() void TestType::setStab() { - m_type2->setStab(Sigcore::Fraction(0, 1)); + m_type2->setStab(Fraction(0, 1)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_type2->setStab(Sigcore::Fraction(2, 1)); - m_type2->setStab(Sigcore::Fraction(2, 1)); + m_type2->setStab(Fraction(2, 1)); + m_type2->setStab(Fraction(2, 1)); - QCOMPARE(m_type2->stab(), Sigcore::Fraction(2, 1)); + QCOMPARE(m_type2->stab(), Fraction(2, 1)); QCOMPARE(m_changedCount, 1); @@ -134,7 +137,7 @@ void TestType::assignment() *m_type3 = *m_type2; QCOMPARE(m_type3->name(), QString("Foo")); - QCOMPARE(m_type3->stab(), Sigcore::Fraction(2, 1)); + QCOMPARE(m_type3->stab(), Fraction(2, 1)); } QTEST_APPLESS_MAIN(TestType) diff --git a/sigmod/test/TestWeather.cpp b/sigmod/test/TestWeather.cpp index 915c65ec..40680b5e 100644 --- a/sigmod/test/TestWeather.cpp +++ b/sigmod/test/TestWeather.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,22 +19,23 @@ #include "TestWeather.h" // Sigmod includes -#include "../Sigmod.h" +#include "../Game.h" #include "../Weather.h" // Qt includes #include <QtCore/QFile> #include <QtTest/QTest> -#include <QtCore/QtDebug> +using namespace Sigcore; +using namespace Sigmod; void TestWeather::initTestCase() { TestSigmodObject::initTestCase(); - m_weather1 = m_sigmod->newWeather(); - m_weather2 = m_sigmod->newWeather(); - m_weather3 = m_sigmod->newWeather(); + m_weather1 = m_game->newWeather(); + m_weather2 = m_game->newWeather(); + m_weather3 = m_game->newWeather(); } void TestWeather::cleanupTestCase() @@ -76,7 +77,7 @@ void TestWeather::validation() void TestWeather::saving() { - QDomDocument xml = Sigmod::Object::xml(m_weather1); + QDomDocument xml = Object::xml(m_weather1); QFile file("weather.xml"); QVERIFY(file.open(QIODevice::WriteOnly)); @@ -90,14 +91,14 @@ void TestWeather::loading() QFile file("weather.xml"); m_weather1->setName("Bar"); - m_weather1->setScript(Sigcore::Script("python", "import os")); + m_weather1->setScript(Script("python", "import os")); QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(xml.setContent(&file)); m_weather1->load(xml.firstChildElement("Weather")); QCOMPARE(m_weather1->name(), QString("Foo")); - QCOMPARE(m_weather1->script(), Sigcore::Script()); + QCOMPARE(m_weather1->script(), Script()); } void TestWeather::setName() @@ -115,10 +116,10 @@ void TestWeather::setName() void TestWeather::setScript() { - m_weather2->setScript(Sigcore::Script("python", "import os")); - m_weather2->setScript(Sigcore::Script("python", "import os")); + m_weather2->setScript(Script("python", "import os")); + m_weather2->setScript(Script("python", "import os")); - QCOMPARE(m_weather2->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_weather2->script(), Script("python", "import os")); QCOMPARE(m_changedCount, 1); @@ -131,7 +132,7 @@ void TestWeather::assignment() *m_weather3 = *m_weather2; QCOMPARE(m_weather3->name(), QString("Foo")); - QCOMPARE(m_weather3->script(), Sigcore::Script("python", "import os")); + QCOMPARE(m_weather3->script(), Script("python", "import os")); } QTEST_APPLESS_MAIN(TestWeather) |