summaryrefslogtreecommitdiffstats
path: root/sigmod
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-01-18 13:02:13 -0500
committerBen Boeckel <MathStuf@gmail.com>2009-01-18 13:03:47 -0500
commitd9f2bdc04d87aecf9504c6d13cc6ae1607e17c07 (patch)
treea1af2f14c42e03ba564867b97b4fdc47ab61d712 /sigmod
parentd617e34915d3c7d3b436d39bfc6ebcc32f363360 (diff)
downloadsigen-d9f2bdc04d87aecf9504c6d13cc6ae1607e17c07.tar.gz
sigen-d9f2bdc04d87aecf9504c6d13cc6ae1607e17c07.tar.xz
sigen-d9f2bdc04d87aecf9504c6d13cc6ae1607e17c07.zip
Changed minimum level to -1 for "unlearnable" in SpeciesMove
Diffstat (limited to 'sigmod')
-rw-r--r--sigmod/SpeciesMove.cpp6
-rw-r--r--sigmod/test/TestSpeciesMove.cpp28
2 files changed, 22 insertions, 12 deletions
diff --git a/sigmod/SpeciesMove.cpp b/sigmod/SpeciesMove.cpp
index 76438ef4..c198a0b7 100644
--- a/sigmod/SpeciesMove.cpp
+++ b/sigmod/SpeciesMove.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2008 Ben Boeckel <MathStuf@gmail.com>
+ * Copyright 2007-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
@@ -86,8 +86,8 @@ GETTER(SpeciesMove, int, level)
GETTER(SpeciesMove, int, wild)
CHECK_INDEX(SpeciesMove, int, move, sigmod(), move)
-CHECK_BOUNDS(SpeciesMove, int, level, 1, sigmod()->rules()->maxLevel())
-CHECK_BOUNDS(SpeciesMove, int, wild, 1, sigmod()->rules()->maxLevel())
+CHECK_BOUNDS(SpeciesMove, int, level, -1, sigmod()->rules()->maxLevel())
+CHECK_BOUNDS(SpeciesMove, int, wild, -1, sigmod()->rules()->maxLevel())
Sigmod::SpeciesMove& Sigmod::SpeciesMove::operator=(const SpeciesMove& rhs)
{
diff --git a/sigmod/test/TestSpeciesMove.cpp b/sigmod/test/TestSpeciesMove.cpp
index 660896c4..ec8b5454 100644
--- a/sigmod/test/TestSpeciesMove.cpp
+++ b/sigmod/test/TestSpeciesMove.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
@@ -67,7 +67,7 @@ void TestSpeciesMove::validation()
m_speciesMove1->validate();
QCOMPARE(m_warnings.size(), 0);
- QCOMPARE(m_errors.size(), 3);
+ QCOMPARE(m_errors.size(), 1);
m_sigmod->newMove();
@@ -75,7 +75,7 @@ void TestSpeciesMove::validation()
m_speciesMove1->validate();
QCOMPARE(m_warnings.size(), 0);
- QCOMPARE(m_errors.size(), 5);
+ QCOMPARE(m_errors.size(), 1);
m_sigmod->rules()->setMaxLevel(25);
@@ -83,14 +83,14 @@ void TestSpeciesMove::validation()
m_speciesMove1->validate();
QCOMPARE(m_warnings.size(), 0);
- QCOMPARE(m_errors.size(), 6);
+ QCOMPARE(m_errors.size(), 1);
m_sigmod->rules()->setMaxLevel(10);
m_speciesMove1->validate();
QCOMPARE(m_warnings.size(), 0);
- QCOMPARE(m_errors.size(), 8);
+ QCOMPARE(m_errors.size(), 2);
m_sigmod->rules()->setMaxLevel(50);
@@ -98,14 +98,14 @@ void TestSpeciesMove::validation()
m_speciesMove1->validate();
QCOMPARE(m_warnings.size(), 0);
- QCOMPARE(m_errors.size(), 8);
+ QCOMPARE(m_errors.size(), 2);
m_sigmod->rules()->setMaxLevel(30);
m_speciesMove1->validate();
QCOMPARE(m_warnings.size(), 0);
- QCOMPARE(m_errors.size(), 9);
+ QCOMPARE(m_errors.size(), 3);
}
void TestSpeciesMove::saving()
@@ -165,6 +165,11 @@ void TestSpeciesMove::setLevel()
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 1);
+ m_speciesMove2->setLevel(-2);
+
+ QCOMPARE(m_warnings.size(), 0);
+ QCOMPARE(m_errors.size(), 2);
+
m_speciesMove2->setLevel(15);
m_speciesMove2->setLevel(15);
@@ -173,7 +178,7 @@ void TestSpeciesMove::setLevel()
QCOMPARE(m_changedCount, 1);
QCOMPARE(m_warnings.size(), 0);
- QCOMPARE(m_errors.size(), 1);
+ QCOMPARE(m_errors.size(), 2);
}
void TestSpeciesMove::setWild()
@@ -183,6 +188,11 @@ void TestSpeciesMove::setWild()
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 1);
+ m_speciesMove2->setWild(-2);
+
+ QCOMPARE(m_warnings.size(), 0);
+ QCOMPARE(m_errors.size(), 2);
+
m_speciesMove2->setWild(15);
m_speciesMove2->setWild(15);
@@ -191,7 +201,7 @@ void TestSpeciesMove::setWild()
QCOMPARE(m_changedCount, 1);
QCOMPARE(m_warnings.size(), 0);
- QCOMPARE(m_errors.size(), 1);
+ QCOMPARE(m_errors.size(), 2);
}
void TestSpeciesMove::assignment()