Maintenance - Mise à jour mensuelle Lundi 7 Décembre 2021 entre 7h00 et 9h00

Commit 945b7d47 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

io: fix several logic errors

parent 83a7c542
......@@ -470,17 +470,16 @@ private:
{ "constant", dynamics_type::constant },
{ "counter", dynamics_type::counter },
{ "cross", dynamics_type::cross },
{ "generator", dynamics_type::generator },
{ "flow", dynamics_type::flow },
{ "generator", dynamics_type::generator },
{ "integrator", dynamics_type::integrator },
{ "mult_2", dynamics_type::mult_2 },
{ "mult_3", dynamics_type::mult_3 },
{ "mult_4", dynamics_type::mult_4 },
{ "none", dynamics_type::none },
{ "quantifier", dynamics_type::quantifier },
{ "qss1_cross", dynamics_type::qss1_cross },
{ "qss1_integrator", dynamics_type::qss1_integrator },
{ "qss1_multiplier", dynamics_type::qss1_multiplier },
{ "qss1_cross", dynamics_type::qss1_cross },
{ "qss1_power", dynamics_type::qss1_power },
{ "qss1_square", dynamics_type::qss1_square },
{ "qss1_sum_2", dynamics_type::qss1_sum_2 },
......@@ -489,9 +488,9 @@ private:
{ "qss1_wsum_2", dynamics_type::qss1_wsum_2 },
{ "qss1_wsum_3", dynamics_type::qss1_wsum_3 },
{ "qss1_wsum_4", dynamics_type::qss1_wsum_4 },
{ "qss2_cross", dynamics_type::qss2_cross },
{ "qss2_integrator", dynamics_type::qss2_integrator },
{ "qss2_multiplier", dynamics_type::qss2_multiplier },
{ "qss2_cross", dynamics_type::qss2_cross },
{ "qss2_power", dynamics_type::qss2_power },
{ "qss2_square", dynamics_type::qss2_square },
{ "qss2_sum_2", dynamics_type::qss2_sum_2 },
......@@ -500,9 +499,9 @@ private:
{ "qss2_wsum_2", dynamics_type::qss2_wsum_2 },
{ "qss2_wsum_3", dynamics_type::qss2_wsum_3 },
{ "qss2_wsum_4", dynamics_type::qss2_wsum_4 },
{ "qss3_cross", dynamics_type::qss3_cross },
{ "qss3_integrator", dynamics_type::qss3_integrator },
{ "qss3_multiplier", dynamics_type::qss3_multiplier },
{ "qss3_cross", dynamics_type::qss3_cross },
{ "qss3_power", dynamics_type::qss3_power },
{ "qss3_square", dynamics_type::qss3_square },
{ "qss3_sum_2", dynamics_type::qss3_sum_2 },
......@@ -511,6 +510,7 @@ private:
{ "qss3_wsum_2", dynamics_type::qss3_wsum_2 },
{ "qss3_wsum_3", dynamics_type::qss3_wsum_3 },
{ "qss3_wsum_4", dynamics_type::qss3_wsum_4 },
{ "quantifier", dynamics_type::quantifier },
{ "time_func", dynamics_type::time_func }
};
......@@ -529,11 +529,6 @@ private:
return true;
}
if (dynamics_name == "flow") {
*type = dynamics_type::flow;
return true;
}
return false;
}
......@@ -869,9 +864,9 @@ private:
return true;
}
bool read(cross& /*dyn*/) noexcept
bool read(cross& dyn) noexcept
{
return true;
return !!(is >> dyn.default_threshold);
}
bool read(accumulator_2& /*dyn*/) noexcept
......
......@@ -585,6 +585,87 @@ main()
}
};
"input_output"_test = [] {
std::string str;
str.reserve(4096u);
{
irt::simulation sim;
expect(irt::is_success(sim.init(64lu, 4096lu)));
sim.alloc<irt::none>();
sim.alloc<irt::qss1_integrator>();
sim.alloc<irt::qss1_multiplier>();
sim.alloc<irt::qss1_cross>();
sim.alloc<irt::qss1_power>();
sim.alloc<irt::qss1_square>();
sim.alloc<irt::qss1_sum_2>();
sim.alloc<irt::qss1_sum_3>();
sim.alloc<irt::qss1_sum_4>();
sim.alloc<irt::qss1_wsum_2>();
sim.alloc<irt::qss1_wsum_3>();
sim.alloc<irt::qss1_wsum_4>();
sim.alloc<irt::qss2_integrator>();
sim.alloc<irt::qss2_multiplier>();
sim.alloc<irt::qss2_cross>();
sim.alloc<irt::qss2_power>();
sim.alloc<irt::qss2_square>();
sim.alloc<irt::qss2_sum_2>();
sim.alloc<irt::qss2_sum_3>();
sim.alloc<irt::qss2_sum_4>();
sim.alloc<irt::qss2_wsum_2>();
sim.alloc<irt::qss2_wsum_3>();
sim.alloc<irt::qss2_wsum_4>();
sim.alloc<irt::qss3_integrator>();
sim.alloc<irt::qss3_multiplier>();
sim.alloc<irt::qss3_power>();
sim.alloc<irt::qss3_square>();
sim.alloc<irt::qss3_cross>();
sim.alloc<irt::qss3_sum_2>();
sim.alloc<irt::qss3_sum_3>();
sim.alloc<irt::qss3_sum_4>();
sim.alloc<irt::qss3_wsum_2>();
sim.alloc<irt::qss3_wsum_3>();
sim.alloc<irt::qss3_wsum_4>();
// sim.alloc<irt::integrator>(); // TODO alloc need static_dispatch to return
// sim.alloc<irt::quantifier>(); // a data_array. Need to remove data_array_archive.
sim.alloc<irt::adder_2>();
sim.alloc<irt::adder_3>();
sim.alloc<irt::adder_4>();
sim.alloc<irt::mult_2>();
sim.alloc<irt::mult_3>();
sim.alloc<irt::mult_4>();
sim.alloc<irt::counter>();
sim.alloc<irt::generator>();
sim.alloc<irt::constant>();
sim.alloc<irt::cross>();
sim.alloc<irt::time_func>();
sim.alloc<irt::accumulator_2>();
sim.alloc<irt::flow>();
std::ostringstream os;
irt::writer w(os);
expect(irt::is_success(w(sim)));
str = os.str();
}
expect(!str.empty());
fmt::print(str);
{
std::istringstream is(str);
irt::simulation sim;
expect(irt::is_success(sim.init(64lu, 32lu)));
irt::reader r(is);
expect(irt::is_success(r(sim)));
expect(sim.models.size() == 47);
}
};
"constant_simulation"_test = [] {
irt::simulation sim;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment