#include #include #include #include #include "context.hpp" #include "continuous_property.hpp" #include "pla_evolve.hpp" #include "pla_get.hpp" #include "pla_init_default.hpp" #include "property_composition.hpp" #include "mempool.hpp" // create some extra properties #include "property_abbrevations_begin.hpp" GEN_CP(Neuron, ConstProp, "const_prop", int, 42); GEN_CP_EVOLVE(ConstProp, _CP(ConstProp)); GEN_CP(Neuron, ArithProp, "arith_prop", int, 0); GEN_CP_EVOLVE(ArithProp, (_CP(ArithProp) + 1)); GEN_CP(Neuron, GeomProp, "geom_prop", int, 1); GEN_CP_EVOLVE(GeomProp, (2*_CP(GeomProp))); GEN_CP(Neuron, TimeProp, "time_prop", Time, 0.0); GEN_CP_EVOLVE(TimeProp, _CP(TimeProp) + td); GEN_CP(Neuron, Alter1, "alter1", bool, true); GEN_CP(Neuron, Alter2, "alter2", bool, false); GEN_CP_EVOLVE(Alter1, _CP(Alter2)); GEN_CP_EVOLVE(Alter2, _CP(Alter1)); #include "property_abbrevations_end.hpp" using namespace std; int main() { using boost::mpl::pair; using boost::mpl::list; using boost::mpl::bool_; // below is bullshit PropertyComposition>, pair>, pair>, pair>, pair>, pair> >> pc; // init with default values //PLA_Init_Default action_init; // pc.call(action_init); // create an instance ptr (we only consider a single instance) Ptr inst{0}; ContinuousContext context{inst}; // evolve and check result using specific gets for (int i=1; i<20; i++) { Time t{double{i}}; PLA_Evolve evolve(context, t); // evolve pc.call(evolve); // check #define CHECK(PN, COND) { \ PLA_Get action{t,inst}; \ PN::type res(pc.call(action)); \ assert(res == (COND)); \ } CHECK(ConstProp, 42); CHECK(ArithProp, i); CHECK(GeomProp, (1 << i)); CHECK(TimeProp, t); PLA_Get ag_a1 (t, inst); PLA_Get ag_a2 (t, inst); assert(pc.call(ag_a1) ^ pc.call(ag_a2)); } }