#include #include #include #include #include "index.hpp" #include "index_spike.hpp" #include "pla_apply.hpp" #include "property_composition.hpp" #include "property_access.hpp" #include "context.hpp" #include "model.hpp" // for Voltage, Weight int main() { using boost::mpl::pair; using boost::mpl::list; using boost::mpl::bool_; using boost::make_tuple; // define a fake sim env typedef PropertyComposition pc_t; pc_t pc; // set weight to 3.0 pc.cast(PLA_Set{0.0, Ptr{0}, 3.0}); // create and call an apply PLA DelieverContext ctx(make_tuple(Ptr{0}, Ptr{0}), Ptr(0)); PLA_Apply apply(Time(0), ctx); assert(Property_Get::eval(pc, ctx, Time(0)) == 0.0); pc.call(apply); assert(Property_Get::eval(pc, ctx, Time(0)) == 0.0); // check for desired event generation pattern assert(!apply.generate()); assert(!apply.generate()); assert(apply.generate()); assert(apply.generateAny()); // commit and test for proper change assert(Property_Get::eval(pc, ctx, Time(0)) == 0.0); apply.commit(pc); assert(Property_Get::eval(pc, ctx, Time(0)) == 3.0); // additional compile time checks of helper classes BOOST_MPL_ASSERT((ContinuousProperty_ApplyChangesProp)); BOOST_MPL_ASSERT_NOT((ContinuousProperty_ApplyChangesProp)); return 0; }