diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index e07e6c482..6028e23ed 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -66,6 +66,7 @@ hannas_custody.txt hymn_of_rebirth.txt icatian_priest.txt keldon_warlord.txt +keldon_warlord_2.txt kird_ape.txt kudzu.txt kudzu2.txt diff --git a/projects/mtg/bin/Res/test/keldon_warlord2.txt b/projects/mtg/bin/Res/test/keldon_warlord2.txt new file mode 100644 index 000000000..2a999d7c2 --- /dev/null +++ b/projects/mtg/bin/Res/test/keldon_warlord2.txt @@ -0,0 +1,17 @@ +#Bug: Keldon warlord dies when coming into play +[INIT] +FIRSTMAIN +[PLAYER1] +hand:keldon warlord +inplay:grizzly bears +manapool:{2}{R}{R} +[PLAYER2] +[DO] +keldon warlord +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:grizzly bears,keldon warlord +manapool:{0} +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/include/TestSuiteAI.h b/projects/mtg/include/TestSuiteAI.h index e72dbe9b7..ebc2bf9b6 100644 --- a/projects/mtg/include/TestSuiteAI.h +++ b/projects/mtg/include/TestSuiteAI.h @@ -59,7 +59,7 @@ class TestSuite{ string files[1024]; int nbfiles; int currentfile; - void load(const char * filename); + int load(const char * filename); TestSuite(const char * filename,MTGAllCards* _collection); void initGame(); int assertGame(); diff --git a/projects/mtg/src/TestSuiteAI.cpp b/projects/mtg/src/TestSuiteAI.cpp index b1c3cbc00..b8f7bdb01 100644 --- a/projects/mtg/src/TestSuiteAI.cpp +++ b/projects/mtg/src/TestSuiteAI.cpp @@ -371,8 +371,11 @@ int TestSuite::loadNext(){ summoningSickness = 0; if (!nbfiles) return 0; if (currentfile >= nbfiles) return 0; - load(files[currentfile].c_str()); currentfile++; + if (!load(files[currentfile-1].c_str())) return loadNext(); + + //load(files[currentfile].c_str()); + //currentfile++; return currentfile; } @@ -424,10 +427,9 @@ void TestSuite::cleanup(){ actions.cleanup(); } -void TestSuite::load(const char * _filename){ +int TestSuite::load(const char * _filename){ char filename[4096]; sprintf(filename, RESPATH"/test/%s", _filename); - printf(filename); std::ifstream file(filename); std::string s; @@ -502,7 +504,8 @@ void TestSuite::load(const char * _filename){ } file.close(); }else{ - //TODO Error management + return 0; } + return 1; }