Commit 83a7c542 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

test: replace ut fatal error syntax

parent f6fdc827
Pipeline #21968 passed with stage
in 2 minutes and 31 seconds
...@@ -242,37 +242,37 @@ izhikevich_benchmark(double simulation_duration, ...@@ -242,37 +242,37 @@ izhikevich_benchmark(double simulation_duration,
sum_d.default_input_coeffs[1] = d; sum_d.default_input_coeffs[1] = d;
expect(sim.models.can_alloc(14)); expect(sim.models.can_alloc(14));
!expect(irt::is_success( expect((irt::is_success(
sim.alloc(constant3, sim.constant_models.get_id(constant3)))); sim.alloc(constant3, sim.constant_models.get_id(constant3)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim.alloc(constant, sim.constant_models.get_id(constant)))); sim.alloc(constant, sim.constant_models.get_id(constant)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim.alloc(constant2, sim.constant_models.get_id(constant2)))); sim.alloc(constant2, sim.constant_models.get_id(constant2)))) >> fatal);
!expect( expect((
irt::is_success(sim.alloc(sum_a, sim.adder_2_models.get_id(sum_a)))); irt::is_success(sim.alloc(sum_a, sim.adder_2_models.get_id(sum_a)))) >> fatal);
!expect( expect((
irt::is_success(sim.alloc(sum_b, sim.adder_2_models.get_id(sum_b)))); irt::is_success(sim.alloc(sum_b, sim.adder_2_models.get_id(sum_b)))) >> fatal);
!expect( expect((
irt::is_success(sim.alloc(sum_c, sim.adder_4_models.get_id(sum_c)))); irt::is_success(sim.alloc(sum_c, sim.adder_4_models.get_id(sum_c)))) >> fatal);
!expect( expect((
irt::is_success(sim.alloc(sum_d, sim.adder_2_models.get_id(sum_d)))); irt::is_success(sim.alloc(sum_d, sim.adder_2_models.get_id(sum_d)))) >> fatal);
!expect( expect((
irt::is_success(sim.alloc(product, sim.mult_2_models.get_id(product)))); irt::is_success(sim.alloc(product, sim.mult_2_models.get_id(product)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim.alloc(integrator_a, sim.integrator_models.get_id(integrator_a)))); sim.alloc(integrator_a, sim.integrator_models.get_id(integrator_a)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim.alloc(integrator_b, sim.integrator_models.get_id(integrator_b)))); sim.alloc(integrator_b, sim.integrator_models.get_id(integrator_b)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim.alloc(quantifier_a, sim.quantifier_models.get_id(quantifier_a)))); sim.alloc(quantifier_a, sim.quantifier_models.get_id(quantifier_a)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim.alloc(quantifier_b, sim.quantifier_models.get_id(quantifier_b)))); sim.alloc(quantifier_b, sim.quantifier_models.get_id(quantifier_b)))) >> fatal);
!expect(irt::is_success(sim.alloc(cross, sim.cross_models.get_id(cross)))); expect((irt::is_success(sim.alloc(cross, sim.cross_models.get_id(cross)))) >> fatal);
!expect( expect((
irt::is_success(sim.alloc(cross2, sim.cross_models.get_id(cross2)))); irt::is_success(sim.alloc(cross2, sim.cross_models.get_id(cross2)))) >> fatal);
!expect(sim.models.size() == 14_ul); expect((sim.models.size() == 14_ul) >> fatal);
expect(sim.connect(integrator_a.y[0], cross.x[0]) == irt::status::success); expect(sim.connect(integrator_a.y[0], cross.x[0]) == irt::status::success);
expect(sim.connect(constant2.y[0], cross.x[1]) == irt::status::success); expect(sim.connect(constant2.y[0], cross.x[1]) == irt::status::success);
...@@ -343,7 +343,7 @@ izhikevich_benchmark(double simulation_duration, ...@@ -343,7 +343,7 @@ izhikevich_benchmark(double simulation_duration,
irt::time t = 0.0; irt::time t = 0.0;
expect(irt::status::success == sim.initialize(t)); expect(irt::status::success == sim.initialize(t));
!expect(sim.sched.size() == 14_ul); expect(sim.sched.size() == 14_ul);
do { do {
irt::status st = sim.run(t); irt::status st = sim.run(t);
......
...@@ -287,11 +287,11 @@ izhikevich_benchmark(double simulation_duration, ...@@ -287,11 +287,11 @@ izhikevich_benchmark(double simulation_duration,
irt::time t = 0.0; irt::time t = 0.0;
expect(irt::status::success == sim.initialize(t)); expect(irt::status::success == sim.initialize(t));
!expect(sim.sched.size() == 12_ul); expect((sim.sched.size() == 12_ul) >> fatal);
do { do {
irt::status st = sim.run(t); irt::status st = sim.run(t);
expect(st == irt::status::success); expect((st == irt::status::success) >> fatal);
} while (t < simulation_duration); } while (t < simulation_duration);
}; };
......
...@@ -286,7 +286,7 @@ izhikevich_benchmark(double simulation_duration, ...@@ -286,7 +286,7 @@ izhikevich_benchmark(double simulation_duration,
irt::time t = 0.0; irt::time t = 0.0;
expect(irt::status::success == sim.initialize(t)); expect(irt::status::success == sim.initialize(t));
!expect(sim.sched.size() == 12_ul); expect(sim.sched.size() == 12_ul);
do { do {
irt::status st = sim.run(t); irt::status st = sim.run(t);
......
...@@ -423,32 +423,32 @@ make_synapse(irt::simulation* sim, ...@@ -423,32 +423,32 @@ make_synapse(irt::simulation* sim,
const_syn.default_value = 1.0; const_syn.default_value = 1.0;
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(int_pre, sim->integrator_models.get_id(int_pre)))); sim->alloc(int_pre, sim->integrator_models.get_id(int_pre)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(quant_pre, sim->quantifier_models.get_id(quant_pre)))); sim->alloc(quant_pre, sim->quantifier_models.get_id(quant_pre)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(sum_pre, sim->adder_2_models.get_id(sum_pre)))); sim->alloc(sum_pre, sim->adder_2_models.get_id(sum_pre)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(mult_pre, sim->adder_2_models.get_id(mult_pre)))); sim->alloc(mult_pre, sim->adder_2_models.get_id(mult_pre)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(cross_pre, sim->cross_models.get_id(cross_pre)))); sim->alloc(cross_pre, sim->cross_models.get_id(cross_pre)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(int_post, sim->integrator_models.get_id(int_post)))); sim->alloc(int_post, sim->integrator_models.get_id(int_post)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(quant_post, sim->quantifier_models.get_id(quant_post)))); sim->alloc(quant_post, sim->quantifier_models.get_id(quant_post)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(sum_post, sim->adder_2_models.get_id(sum_post)))); sim->alloc(sum_post, sim->adder_2_models.get_id(sum_post)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(mult_post, sim->adder_2_models.get_id(mult_post)))); sim->alloc(mult_post, sim->adder_2_models.get_id(mult_post)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(cross_post, sim->cross_models.get_id(cross_post)))); sim->alloc(cross_post, sim->cross_models.get_id(cross_post)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(const_syn, sim->constant_models.get_id(const_syn)))); sim->alloc(const_syn, sim->constant_models.get_id(const_syn)))) >> fatal);
!expect(irt::is_success(sim->alloc( expect((irt::is_success(sim->alloc(
accumulator_syn, sim->accumulator_2_models.get_id(accumulator_syn)))); accumulator_syn, sim->accumulator_2_models.get_id(accumulator_syn)))) >> fatal);
struct synapse synapse_model = { struct synapse synapse_model = {
sim->adder_2_models.get_id(sum_pre), sim->adder_2_models.get_id(sum_pre),
......
...@@ -381,28 +381,39 @@ make_synapse(irt::simulation* sim, ...@@ -381,28 +381,39 @@ make_synapse(irt::simulation* sim,
const_syn.default_value = 1.0; const_syn.default_value = 1.0;
!expect(irt::is_success( expect((irt::is_success(sim->alloc(
sim->alloc(int_pre, sim->qss1_integrator_models.get_id(int_pre)))); int_pre, sim->qss1_integrator_models.get_id(int_pre)))) >>
!expect(irt::is_success( fatal);
sim->alloc(sum_pre, sim->qss1_wsum_2_models.get_id(sum_pre)))); expect((irt::is_success(
!expect(irt::is_success( sim->alloc(sum_pre, sim->qss1_wsum_2_models.get_id(sum_pre)))) >>
sim->alloc(mult_pre, sim->qss1_wsum_2_models.get_id(mult_pre)))); fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(cross_pre, sim->qss1_cross_models.get_id(cross_pre)))); sim->alloc(mult_pre, sim->qss1_wsum_2_models.get_id(mult_pre)))) >>
fatal);
!expect(irt::is_success( expect((irt::is_success(sim->alloc(
sim->alloc(int_post, sim->qss1_integrator_models.get_id(int_post)))); cross_pre, sim->qss1_cross_models.get_id(cross_pre)))) >>
!expect(irt::is_success( fatal);
sim->alloc(sum_post, sim->qss1_wsum_2_models.get_id(sum_post))));
!expect(irt::is_success( expect((irt::is_success(sim->alloc(
sim->alloc(mult_post, sim->qss1_wsum_2_models.get_id(mult_post)))); int_post, sim->qss1_integrator_models.get_id(int_post)))) >>
!expect(irt::is_success( fatal);
sim->alloc(cross_post, sim->qss1_cross_models.get_id(cross_post)))); expect((irt::is_success(
sim->alloc(sum_post, sim->qss1_wsum_2_models.get_id(sum_post)))) >>
!expect(irt::is_success( fatal);
sim->alloc(const_syn, sim->constant_models.get_id(const_syn)))); expect((irt::is_success(sim->alloc(
!expect(irt::is_success(sim->alloc( mult_post, sim->qss1_wsum_2_models.get_id(mult_post)))) >>
accumulator_syn, sim->accumulator_2_models.get_id(accumulator_syn)))); fatal);
expect((irt::is_success(sim->alloc(
cross_post, sim->qss1_cross_models.get_id(cross_post)))) >>
fatal);
expect((irt::is_success(
sim->alloc(const_syn, sim->constant_models.get_id(const_syn)))) >>
fatal);
expect(
(irt::is_success(sim->alloc(
accumulator_syn, sim->accumulator_2_models.get_id(accumulator_syn)))) >>
fatal);
struct synapse synapse_model = { struct synapse synapse_model = {
sim->qss1_wsum_2_models.get_id(sum_pre), sim->qss1_wsum_2_models.get_id(sum_pre),
......
...@@ -381,28 +381,28 @@ make_synapse(irt::simulation* sim, ...@@ -381,28 +381,28 @@ make_synapse(irt::simulation* sim,
const_syn.default_value = 1.0; const_syn.default_value = 1.0;
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(int_pre, sim->qss2_integrator_models.get_id(int_pre)))); sim->alloc(int_pre, sim->qss2_integrator_models.get_id(int_pre)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(sum_pre, sim->qss2_wsum_2_models.get_id(sum_pre)))); sim->alloc(sum_pre, sim->qss2_wsum_2_models.get_id(sum_pre)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(mult_pre, sim->qss2_wsum_2_models.get_id(mult_pre)))); sim->alloc(mult_pre, sim->qss2_wsum_2_models.get_id(mult_pre)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(cross_pre, sim->qss2_cross_models.get_id(cross_pre)))); sim->alloc(cross_pre, sim->qss2_cross_models.get_id(cross_pre)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(int_post, sim->qss2_integrator_models.get_id(int_post)))); sim->alloc(int_post, sim->qss2_integrator_models.get_id(int_post)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(sum_post, sim->qss2_wsum_2_models.get_id(sum_post)))); sim->alloc(sum_post, sim->qss2_wsum_2_models.get_id(sum_post)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(mult_post, sim->qss2_wsum_2_models.get_id(mult_post)))); sim->alloc(mult_post, sim->qss2_wsum_2_models.get_id(mult_post)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(cross_post, sim->qss2_cross_models.get_id(cross_post)))); sim->alloc(cross_post, sim->qss2_cross_models.get_id(cross_post)))) >> fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(const_syn, sim->constant_models.get_id(const_syn)))); sim->alloc(const_syn, sim->constant_models.get_id(const_syn)))) >> fatal);
!expect(irt::is_success(sim->alloc( expect((irt::is_success(sim->alloc(
accumulator_syn, sim->accumulator_2_models.get_id(accumulator_syn)))); accumulator_syn, sim->accumulator_2_models.get_id(accumulator_syn)))) >> fatal);
struct synapse synapse_model = { struct synapse synapse_model = {
sim->qss2_wsum_2_models.get_id(sum_pre), sim->qss2_wsum_2_models.get_id(sum_pre),
......
...@@ -421,13 +421,15 @@ make_synapse(irt::simulation* sim, ...@@ -421,13 +421,15 @@ make_synapse(irt::simulation* sim,
const_syn.default_value = 1.0; const_syn.default_value = 1.0;
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(sum_pre, sim->adder_2_models.get_id(sum_pre)))); sim->alloc(sum_pre, sim->adder_2_models.get_id(sum_pre)))) >>
!expect(irt::is_success( fatal);
sim->alloc(cross_pre, sim->cross_models.get_id(cross_pre)))); expect((irt::is_success(
sim->alloc(cross_pre, sim->cross_models.get_id(cross_pre)))) >>
!expect(irt::is_success( fatal);
sim->alloc(const_syn, sim->constant_models.get_id(const_syn)))); expect((irt::is_success(
sim->alloc(const_syn, sim->constant_models.get_id(const_syn)))) >>
fatal);
struct synapse synapse_model = { struct synapse synapse_model = {
sim->adder_2_models.get_id(sum_pre), sim->adder_2_models.get_id(sum_pre),
...@@ -436,7 +438,6 @@ make_synapse(irt::simulation* sim, ...@@ -436,7 +438,6 @@ make_synapse(irt::simulation* sim,
sim->constant_models.get_id(const_syn), sim->constant_models.get_id(const_syn),
}; };
// Connections
expect(sim->connect(other, sum_pre.x[0]) == irt::status::success); expect(sim->connect(other, sum_pre.x[0]) == irt::status::success);
expect(sim->connect(other, cross_pre.x[2]) == irt::status::success); expect(sim->connect(other, cross_pre.x[2]) == irt::status::success);
expect(sim->connect(const_syn.y[0], sum_pre.x[1]) == irt::status::success); expect(sim->connect(const_syn.y[0], sum_pre.x[1]) == irt::status::success);
......
This diff is collapsed.
...@@ -257,32 +257,45 @@ make_synapse(irt::simulation* sim, ...@@ -257,32 +257,45 @@ make_synapse(irt::simulation* sim,
snprintf(ctesyn, 7, "cte%ld%ld", source, target); snprintf(ctesyn, 7, "cte%ld%ld", source, target);
snprintf(accumsyn, 7, "acc%ld%ld", source, target); snprintf(accumsyn, 7, "acc%ld%ld", source, target);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(int_pre, sim->integrator_models.get_id(int_pre)))); sim->alloc(int_pre, sim->integrator_models.get_id(int_pre)))) >>
!expect(irt::is_success( fatal);
sim->alloc(quant_pre, sim->quantifier_models.get_id(quant_pre)))); expect((irt::is_success(sim->alloc(
!expect(irt::is_success( quant_pre, sim->quantifier_models.get_id(quant_pre)))) >>
sim->alloc(sum_pre, sim->adder_2_models.get_id(sum_pre)))); fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(mult_pre, sim->adder_2_models.get_id(mult_pre)))); sim->alloc(sum_pre, sim->adder_2_models.get_id(sum_pre)))) >>
!expect(irt::is_success( fatal);
sim->alloc(cross_pre, sim->cross_models.get_id(cross_pre)))); expect((irt::is_success(
sim->alloc(mult_pre, sim->adder_2_models.get_id(mult_pre)))) >>
!expect(irt::is_success( fatal);
sim->alloc(int_post, sim->integrator_models.get_id(int_post)))); expect((irt::is_success(
!expect(irt::is_success( sim->alloc(cross_pre, sim->cross_models.get_id(cross_pre)))) >>
sim->alloc(quant_post, sim->quantifier_models.get_id(quant_post)))); fatal);
!expect(irt::is_success(
sim->alloc(sum_post, sim->adder_2_models.get_id(sum_post)))); expect((irt::is_success(
!expect(irt::is_success( sim->alloc(int_post, sim->integrator_models.get_id(int_post)))) >>
sim->alloc(mult_post, sim->adder_2_models.get_id(mult_post)))); fatal);
!expect(irt::is_success( expect((irt::is_success(sim->alloc(
sim->alloc(cross_post, sim->cross_models.get_id(cross_post)))); quant_post, sim->quantifier_models.get_id(quant_post)))) >>
fatal);
!expect(irt::is_success( expect((irt::is_success(
sim->alloc(const_syn, sim->constant_models.get_id(const_syn)))); sim->alloc(sum_post, sim->adder_2_models.get_id(sum_post)))) >>
!expect(irt::is_success(sim->alloc( fatal);
accumulator_syn, sim->accumulator_2_models.get_id(accumulator_syn)))); expect((irt::is_success(
sim->alloc(mult_post, sim->adder_2_models.get_id(mult_post)))) >>
fatal);
expect((irt::is_success(
sim->alloc(cross_post, sim->cross_models.get_id(cross_post)))) >>
fatal);
expect((irt::is_success(
sim->alloc(const_syn, sim->constant_models.get_id(const_syn)))) >>
fatal);
expect(
(irt::is_success(sim->alloc(
accumulator_syn, sim->accumulator_2_models.get_id(accumulator_syn)))) >>
fatal);
struct synapse synapse_model = { struct synapse synapse_model = {
sim->adder_2_models.get_id(sum_pre), sim->adder_2_models.get_id(sum_pre),
...@@ -415,7 +428,7 @@ main() ...@@ -415,7 +428,7 @@ main()
irt::time t = 0.0; irt::time t = 0.0;
std::FILE* os = std::fopen("output_song.csv", "w"); std::FILE* os = std::fopen("output_song.csv", "w");
!expect(os != nullptr); expect((os != nullptr) >> fatal);
std::string s = "t,"; std::string s = "t,";
for (long unsigned int i = 0; i < N * N; i++) { for (long unsigned int i = 0; i < N * N; i++) {
......
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