summaryrefslogtreecommitdiffstats
path: root/pokemod/CoinList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemod/CoinList.cpp')
-rw-r--r--pokemod/CoinList.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp
index 336b2126..04ae14b9 100644
--- a/pokemod/CoinList.cpp
+++ b/pokemod/CoinList.cpp
@@ -20,6 +20,7 @@
// Pokemod includes
#include "CoinListObject.h"
+#include "Macros.h"
#include "Pokemod.h"
// Qt includes
@@ -57,6 +58,7 @@ Pokemod::CoinList::~CoinList()
void Pokemod::CoinList::validate()
{
+ TEST_BEGIN();
if (m_name.isEmpty())
emit(error("Name is empty"));
if (!objectCount())
@@ -64,25 +66,37 @@ void Pokemod::CoinList::validate()
QSet<int> idChecker;
QSet<int> itemChecker;
QSet<int> speciesChecker;
- foreach (CoinListObject* object, m_objects)
- {
- object->validate();
- if (idChecker.contains(object->id()))
- emit(error(subclass("object", object->id())));
- idChecker.insert(object->id());
+ TEST_SUB_BEGIN(CoinListObject, objects);
+ TEST_SUB("object", id);
if (object->type() == CoinListObject::Item)
{
- if (itemChecker.contains(object->object()))
- emit(error(subclass("object item", object->id())));
- itemChecker.insert(object->object());
+ TEST_SUB_RAW(item, "object item", object);
}
else if (object->type() == CoinListObject::Species)
{
- if (speciesChecker.contains(object->object()))
- emit(error(subclass("object species", object->id())));
- speciesChecker.insert(object->object());
+ TEST_SUB_RAW(species, "object species", object);
}
- }
+ TEST_SUB_END();
+// foreach (CoinListObject* object, m_objects)
+// {
+// object->validate();
+// if (idChecker.contains(object->id()))
+// emit(error(subclass("object", object->id())));
+// idChecker.insert(object->id());
+// if (object->type() == CoinListObject::Item)
+// {
+// if (itemChecker.contains(object->object()))
+// emit(error(subclass("object item", object->id())));
+// itemChecker.insert(object->object());
+// }
+// else if (object->type() == CoinListObject::Species)
+// {
+// if (speciesChecker.contains(object->object()))
+// emit(error(subclass("object species", object->id())));
+// speciesChecker.insert(object->object());
+// }
+// }
+ TEST_END();
}
void Pokemod::CoinList::load(const QDomElement& xml, int id)