[Avida-SVN] r1271 - in extras: . source/testsuites
kaben at myxo.css.msu.edu
kaben at myxo.css.msu.edu
Tue Feb 13 06:03:02 PST 2007
Author: kaben
Date: 2007-02-13 09:03:01 -0500 (Tue, 13 Feb 2007)
New Revision: 1271
Modified:
extras/
extras/source/testsuites/nAnalyze.cpp
Log:
r1317 at stochastic: kaben | 2007-02-07 17:15:25 -0500
Added per-organism IDs, and update-born, to offspring in COMPETE analyze
command.
Property changes on: extras
___________________________________________________________________
Name: svk:merge
- 079b078a-dbed-46b9-b3da-37668d4295ca:/avida/local/extras:1316
+ 079b078a-dbed-46b9-b3da-37668d4295ca:/avida/local/extras:1317
Modified: extras/source/testsuites/nAnalyze.cpp
===================================================================
--- extras/source/testsuites/nAnalyze.cpp 2007-02-13 14:02:59 UTC (rev 1270)
+++ extras/source/testsuites/nAnalyze.cpp 2007-02-13 14:03:01 UTC (rev 1271)
@@ -898,12 +898,8 @@
namespace Brainstorm_SynchronousVsContinuous {
void test(cTestSettings &settings){
/* Check settings. {{{3 */
- if(
- (!settings.HasSetting("DevelBase"))
- ||
- (settings.Setting("DevelBase") == "")
- ){
- cout << "XXX Skipping : DevelBase not set." << endl;
+ if(!settings.HasSetting("SlowTests")){
+ cout << "XXX Skipping : SlowTests not enabled." << endl;
return;
}
if(
@@ -939,7 +935,7 @@
args.PushRear(config_dir + "/avida.cfg");
args.PushRear("-s");
- args.PushRear("101");
+ args.PushRear("100");
args.PushRear("-set");
args.PushRear("WORLD_X");
@@ -1043,7 +1039,7 @@
a.Send("SET_BATCH $f");
a.Send("RECALCULATE");
- a.Send("DETAIL archive_$f/detail.dat id parent_id num_cpus fitness viable length sequence");
+ a.Send("DETAIL detail.dat id parent_id update_born viable fitness length sequence");
a.Send("SET_BATCH $t");
a.Send("PURGE_BATCH");
@@ -1056,7 +1052,7 @@
a.Send("SET_BATCH $t");
a.Send("RECALCULATE");
- a.Send("DETAIL archive_$t/detail.dat id parent_id num_cpus fitness viable length sequence");
+ a.Send("DETAIL detail.dat id parent_id update_born viable fitness length sequence");
delete driver; driver=0;
@@ -1256,6 +1252,41 @@
/* cAnalyze_UnitTest_SynchronousVsContinuous_temporary_next_id {{{2 */
namespace UnitTest_SynchronousVsContinuous_temporary_next_id {
+ void set_batch(
+ cAnalyze& a,
+ int batch
+ ){
+ cString command = cStringUtil::Stringf(
+ "SET_BATCH %d",
+ batch
+ );
+ a.Send(command);
+ }
+ void load_organism(
+ cAnalyze& a,
+ cString s
+ ){
+ cString command("LOAD_ORGANISM ");
+ a.Send(command + s);
+ }
+ void compete(
+ cAnalyze& a,
+ int batch_size,
+ int batch_from,
+ int batch_to,
+ int initial_next_id,
+ int initial_next_update
+ ){
+ cString command = cStringUtil::Stringf(
+ "COMPETE %d %d %d %d %d",
+ batch_size,
+ batch_from,
+ batch_to,
+ initial_next_id,
+ initial_next_update
+ );
+ a.Send(command);
+ }
void test(cTestSettings &settings){
/* Check settings. {{{3 */
if(
@@ -1274,7 +1305,6 @@
cout << "XXX Skipping : ExtrasBase not set." << endl;
return;
}
- ERROR("kgn at FIXME: Test is still under construction -");
{
cDriverManager::Initialize();
@@ -1298,41 +1328,16 @@
args.PushRear(config_dir + "/avida.cfg");
args.PushRear("-s");
- args.PushRear("101");
+ args.PushRear("100");
args.PushRear("-set");
- args.PushRear("WORLD_X");
- args.PushRear("20");
-
- args.PushRear("-set");
- args.PushRear("WORLD_Y");
- args.PushRear("20");
-
- args.PushRear("-set");
args.PushRear("EVENT_FILE");
args.PushRear(local_config_dir + "/events.cfg");
args.PushRear("-set");
- args.PushRear("START_CREATURE");
- args.PushRear(local_config_dir + "/default-classic.org");
-
- args.PushRear("-set");
args.PushRear("DATA_DIR");
args.PushRear(data_dir);
- /* Verify temporary_next_id is initially zero. */
- /* Verify initial_next_id == -1 leaves temporary_next_id unchanged. */
- ERROR("kgn at To-Do: Verify initial_next_id == -1 leaves temporary_next_id unchanged -");
- /* Verify temporary_next_id is incremented "batch_size" times. */
- ERROR("kgn at To-Do: Verify temporary_next_id is incremented batch_size times -");
- /* Verify initial_next_id == -1 leaves temporary_next_id unchanged. */
- ERROR("kgn at To-Do: Verify initial_next_id == -1 again leaves temporary_next_id unchanged -");
- /* Verify temporary_next_id is incremented "batch_size" more times. */
- ERROR("kgn at To-Do: Verify temporary_next_id is again incremented batch_size times -");
- /* Verify initial_next_id == 3 resets temporary_next_id. */
- ERROR("kgn at To-Do: Verify initial_next_id == 3 resets temporary_next_id to 3 -");
- /* Verify temporary_next_id is incremented "batch_size" more times. */
- ERROR("kgn at To-Do: Verify temporary_next_id is again incremented batch_size times -");
if(true){
cout << "------ Starting Avida analysis." << endl;
/* Setup of Analyze mode. {{{4 */
@@ -1347,52 +1352,91 @@
return;
}
+ int batch_size;
+ int batch_from;
+ int batch_to;
+ int initial_next_id;
+ int initial_next_update;
+
cAnalyze& a = world->GetAnalyze();
- TEST(0 == a.temporary_next_id);
- cString s;
- int batch_size = 20;
- int batch_from = 0;
- int batch_to = 1;
- int initial_next_id = -1;
+ a.Send("VERBOSE");
- s = "SET s ";
- s += cStringUtil::Convert(batch_size);
- a.Send(s);
+ /* Verify temporary_next_id is initially zero. */
+ TEST(0 == a.GetTempNextID());
+ TEST(0 == a.GetTempNextUpdate());
- s = "SET f ";
- s += cStringUtil::Convert(batch_from);
- a.Send(s);
+ /* Verify initial_next_id == -1 leaves temporary_next_id unchanged. */
+ /* Verify temporary_next_id is incremented "batch_size" times. */
+ {
+ batch_size = 20;
+ batch_from = 0;
+ batch_to = 1;
+ initial_next_id = -1;
+ initial_next_update = -1;
- s = "SET t ";
- s += cStringUtil::Convert(batch_to);
- a.Send(s);
+ set_batch(a, batch_from);
+ a.Send("PURGE_BATCH");
+ load_organism(a, local_config_dir + "/default-classic.org");
+ a.Send("RECALCULATE");
+ set_batch(a, batch_to);
+ a.Send("PURGE_BATCH");
+ compete(a, batch_size, batch_from, batch_to, initial_next_id, initial_next_update);
- s = "SET x ";
- s += cStringUtil::Convert(initial_next_id);
- a.Send(s);
+ TEST(20 == a.GetTempNextID());
+ TEST(1 == a.GetTempNextUpdate());
+ }
- /* Begin Analyze script. {{{4 */
- a.Send("VERBOSE");
- a.Send("SET_BATCH $f");
- a.Send("PURGE_BATCH");
+ /* Verify temporary_next_id is now 20. */
+ /* Verify initial_next_id == -1 leaves temporary_next_id unchanged. */
+ /* Verify temporary_next_id is incremented "batch_size" times. */
{
- s = "LOAD_ORGANISM ";
- s += local_config_dir;
- s += "/default-classic.org";
+ batch_size = 20;
+ batch_from = 0;
+ batch_to = 1;
+ initial_next_id = -1;
+ initial_next_update = -1;
+
+ TEST(20 == a.GetTempNextID());
+ TEST(1 == a.GetTempNextUpdate());
+
+ set_batch(a, batch_from);
+ a.Send("PURGE_BATCH");
+ load_organism(a, local_config_dir + "/default-classic.org");
+ a.Send("RECALCULATE");
+ set_batch(a, batch_to);
+ a.Send("PURGE_BATCH");
+ compete(a, batch_size, batch_from, batch_to, initial_next_id, initial_next_update);
+
+ TEST(40 == a.GetTempNextID());
+ TEST(2 == a.GetTempNextUpdate());
}
- a.Send(s);
- a.Send("RECALCULATE");
- a.Send("SET_BATCH $t");
- a.Send("PURGE_BATCH");
+ /* Verify temporary_next_id is now 40. */
+ /* Verify initial_next_id == 43 alters temporary_next_id. */
+ /* Verify temporary_next_id is incremented "batch_size" times. */
+ {
+ batch_size = 20;
+ batch_from = 0;
+ batch_to = 1;
+ initial_next_id = 43;
+ initial_next_update = 3;
- a.Send("COMPETE $s $f $t $x");
+ TEST(40 == a.GetTempNextID());
+ TEST(2 == a.GetTempNextUpdate());
- TEST(20 == a.temporary_next_id);
- TEST(0 == a.temporary_next_id);
- TEST(-1 == a.temporary_next_id);
+ set_batch(a, batch_from);
+ a.Send("PURGE_BATCH");
+ load_organism(a, local_config_dir + "/default-classic.org");
+ a.Send("RECALCULATE");
+ set_batch(a, batch_to);
+ a.Send("PURGE_BATCH");
+ compete(a, batch_size, batch_from, batch_to, initial_next_id, initial_next_update);
+ TEST(63 == a.GetTempNextID());
+ TEST(4 == a.GetTempNextUpdate());
+ }
+
delete driver; driver=0;
// note: driver deletes world deletes config.
More information about the Avida-cvs
mailing list