Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
282 changes: 141 additions & 141 deletions crypto3/libs/algebra/test/type_traits.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ void test_linear_inter_coefs(const std::vector<typename BlueprintFieldType::valu
auto result_check = [&expected_res](AssignmentType &assignment,
typename component_type::result_type &real_res) {

BOOST_ASSERT(var_value(assignment, real_res.output[0]) == expected_res[0]);
BOOST_ASSERT(var_value(assignment, real_res.output[1]) == expected_res[1]);
BOOST_CHECK(var_value(assignment, real_res.output[0]) == expected_res[0]);
BOOST_CHECK(var_value(assignment, real_res.output[1]) == expected_res[1]);
};

component_type component_instance({0, 1, 2, 3, 4, 5, 6}, {}, {});
Expand Down Expand Up @@ -156,9 +156,9 @@ void test_quadratic_inter_coefs(const std::vector<typename BlueprintFieldType::v
auto result_check = [&expected_res](AssignmentType &assignment,
typename component_type::result_type &real_res) {

BOOST_ASSERT(var_value(assignment, real_res.output[0]) == expected_res[0]);
BOOST_ASSERT(var_value(assignment, real_res.output[1]) == expected_res[1]);
BOOST_ASSERT(var_value(assignment, real_res.output[2]) == expected_res[2]);
BOOST_CHECK(var_value(assignment, real_res.output[0]) == expected_res[0]);
BOOST_CHECK(var_value(assignment, real_res.output[1]) == expected_res[1]);
BOOST_CHECK(var_value(assignment, real_res.output[2]) == expected_res[2]);
};

component_type component_instance({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {}, {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ auto test_comparison_unchecked(typename BlueprintFieldType::value_type x,
expected_to_pass &= x >= y;
break;
case comparison_mode::FLAG:
BOOST_ASSERT_MSG(false, "FLAG mode is not supported, use comparison_flag component instead.");
BOOST_CHECK_MESSAGE(false, "FLAG mode is not supported, use comparison_flag component instead.");
}

std::array<std::uint32_t, WitnessesAmount> witnesses;
Expand Down
38 changes: 19 additions & 19 deletions crypto3/libs/blueprint/test/component_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE(component_batch_basic_test) {
{var(0, 2, false, var::column_type::public_input), var(3, 0, false, var::column_type::witness)},
{var(4, 0, false, var::column_type::witness), var(0, 3, false, var::column_type::public_input)}
};
BOOST_ASSERT(compare_copy_constraint_vectors<field_type>(circuit.copy_constraints(), expected_copy_constraints));
BOOST_CHECK(compare_copy_constraint_vectors<field_type>(circuit.copy_constraints(), expected_copy_constraints));

// assignment_table.export_table(std::cout);
// circuit.export_circuit(std::cout);
Expand Down Expand Up @@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(component_batch_continuation_test) {
{var(1, 3, false, var::column_type::witness), var(5, 2, false, var::column_type::witness)}
};

BOOST_ASSERT(compare_copy_constraint_vectors<field_type>(circuit.copy_constraints(), expected_copy_constraints));
BOOST_CHECK(compare_copy_constraint_vectors<field_type>(circuit.copy_constraints(), expected_copy_constraints));

// assignment_table.export_table(std::cout);
// circuit.export_circuit(std::cout);
Expand Down Expand Up @@ -304,7 +304,7 @@ BOOST_AUTO_TEST_CASE(component_batch_multibatch_test) {
BOOST_CHECK_EQUAL(gate_2.constraints[i], expected_constraints_add[i]);
}
}
BOOST_ASSERT((gate_1.constraints[0] == expected_constraints_mul[0] &&
BOOST_CHECK((gate_1.constraints[0] == expected_constraints_mul[0] &&
gate_2.constraints[0] == expected_constraints_add[0]) ||
(gate_1.constraints[0] == expected_constraints_add[0] &&
gate_2.constraints[0] == expected_constraints_mul[0]));
Expand Down Expand Up @@ -338,7 +338,7 @@ BOOST_AUTO_TEST_CASE(component_batch_multibatch_test) {
{var(4, 3, false, var::column_type::witness), var(2, 1, false, var::column_type::witness)}
};

BOOST_ASSERT(compare_copy_constraint_vectors<field_type>(circuit.copy_constraints(), expected_copy_constraints));
BOOST_CHECK(compare_copy_constraint_vectors<field_type>(circuit.copy_constraints(), expected_copy_constraints));

// assignment_table.export_table(std::cout);
// circuit.export_circuit(std::cout);
Expand Down Expand Up @@ -392,12 +392,12 @@ BOOST_AUTO_TEST_CASE(component_batch_const_batch_test) {
assignment_table.add_batch_constant_variable(2);
}

BOOST_ASSERT(assignment_table.constant(0, 0) == 1444);
BOOST_ASSERT(assignment_table.constant(0, 1) == 1);
BOOST_ASSERT(assignment_table.constant(0, 2) == 1445);
BOOST_ASSERT(assignment_table.constant(0, 3) == 1446);
BOOST_ASSERT(assignment_table.constant(0, 4) == 2);
BOOST_ASSERT(assignment_table.rows_amount() == 5);
BOOST_CHECK(assignment_table.constant(0, 0) == 1444);
BOOST_CHECK(assignment_table.constant(0, 1) == 1);
BOOST_CHECK(assignment_table.constant(0, 2) == 1445);
BOOST_CHECK(assignment_table.constant(0, 3) == 1446);
BOOST_CHECK(assignment_table.constant(0, 4) == 2);
BOOST_CHECK(assignment_table.rows_amount() == 5);

const std::vector<copy_constraint_type> expected_copy_constraints = {
{var(0, 0, false, var::column_type::public_input), var(0, 0, false, var::column_type::witness)},
Expand All @@ -409,7 +409,7 @@ BOOST_AUTO_TEST_CASE(component_batch_const_batch_test) {
{var(7, 3, false, var::column_type::witness), var(0, 4, false, var::column_type::constant)}
};

BOOST_ASSERT(compare_copy_constraint_vectors<field_type>(circuit.copy_constraints(), expected_copy_constraints));
BOOST_CHECK(compare_copy_constraint_vectors<field_type>(circuit.copy_constraints(), expected_copy_constraints));

// assignment_table.export_table(std::cout);
// circuit.export_circuit(std::cout);
Expand Down Expand Up @@ -479,7 +479,7 @@ BOOST_AUTO_TEST_CASE(component_batch_params_test) {
{var(9, 0, false, var::column_type::witness), var(12, 0, false, var::column_type::witness)}
};

BOOST_ASSERT(compare_copy_constraint_vectors<field_type>(circuit.copy_constraints(), expected_copy_constraints));
BOOST_CHECK(compare_copy_constraint_vectors<field_type>(circuit.copy_constraints(), expected_copy_constraints));

// assignment_table.export_table(std::cout);
// circuit.export_circuit(std::cout);
Expand All @@ -504,15 +504,15 @@ BOOST_AUTO_TEST_CASE(component_batch_generate_circuit_variant_basic_test) {
typename multiplication_type::input_type input_2 = {public_input_var_maker(), public_input_var_maker()};
auto res_1 = assignment_table.add_input_to_batch_circuit<multiplication_type>(input_1);
auto res_2 = assignment_table.add_input_to_batch_circuit<multiplication_type>(input_2);
BOOST_ASSERT(var_value(assignment_table, res_1.output) == 0);
BOOST_ASSERT(var_value(assignment_table, res_2.output) == 0);
BOOST_CHECK(var_value(assignment_table, res_1.output) == 0);
BOOST_CHECK(var_value(assignment_table, res_2.output) == 0);
res_1 = assignment_table.add_input_to_batch_assignment<multiplication_type>(input_1);
BOOST_ASSERT(var_value(assignment_table, res_1.output) == var_value(assignment_table, input_1.x) * var_value(assignment_table, input_1.y));
BOOST_ASSERT(var_value(assignment_table, res_1.output) != 0);
BOOST_ASSERT(var_value(assignment_table, res_2.output) == 0);
BOOST_CHECK(var_value(assignment_table, res_1.output) == var_value(assignment_table, input_1.x) * var_value(assignment_table, input_1.y));
BOOST_CHECK(var_value(assignment_table, res_1.output) != 0);
BOOST_CHECK(var_value(assignment_table, res_2.output) == 0);
res_2 = assignment_table.add_input_to_batch_assignment<multiplication_type>(input_2);
BOOST_ASSERT(var_value(assignment_table, res_2.output) == var_value(assignment_table, input_2.x) * var_value(assignment_table, input_2.y));
BOOST_ASSERT(var_value(assignment_table, res_2.output) != 0);
BOOST_CHECK(var_value(assignment_table, res_2.output) == var_value(assignment_table, input_2.x) * var_value(assignment_table, input_2.y));
BOOST_CHECK(var_value(assignment_table, res_2.output) != 0);
}

BOOST_AUTO_TEST_SUITE_END()
6 changes: 3 additions & 3 deletions crypto3/libs/blueprint/test/detail/huang_lu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void test_against_exhaustive_search(std::list<std::pair<std::size_t, std::size_t
std::unordered_map<std::size_t, std::size_t> assignment = huang_lu(sizes, agent_amount);
// Sanity check: all tasks are assigned
for (std::size_t i = 0; i < sizes.size(); i++) {
BOOST_ASSERT(assignment.find(i) != assignment.end());
BOOST_CHECK(assignment.find(i) != assignment.end());
}
std::vector<std::size_t> tasks(sizes.size(), 0);
for (auto [key, size] : sizes) {
Expand All @@ -123,8 +123,8 @@ void test_against_exhaustive_search(std::list<std::pair<std::size_t, std::size_t
tasks,
0,
value);
BOOST_ASSERT(result_found);
BOOST_ASSERT(9 * value <= true_value * 11);
BOOST_CHECK(result_found);
BOOST_CHECK(9 * value <= true_value * 11);
}

// Reduce this if you want to make the instances bigger
Expand Down
24 changes: 12 additions & 12 deletions crypto3/libs/blueprint/test/gate_id.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ BOOST_AUTO_TEST_CASE(gate_id_sanity_tests) {
gate_type gate(0, constraints);

gate_id_type id(gate);
BOOST_ASSERT(id == id);
BOOST_ASSERT(!(id < id));
BOOST_CHECK(id == id);
BOOST_CHECK(!(id < id));
std::vector<constraint_type> constraints_2;
constraints_2.emplace_back(
var(0, -1, true, var::column_type::witness) * var(1, 3, true, var::column_type::witness) -
var(2, 0, true, var::column_type::witness));
gate_id_type id_2(gate_type(0, constraints_2));
BOOST_ASSERT(id != id_2);
BOOST_ASSERT(id < id_2 || id_2 < id);
BOOST_CHECK(id != id_2);
BOOST_CHECK(id < id_2 || id_2 < id);

std::vector<constraint_type> constraints_3;
std::vector<constraint_type> constraints_4;
Expand All @@ -94,11 +94,11 @@ BOOST_AUTO_TEST_CASE(gate_id_sanity_tests) {
var(0, 1, true, var::column_type::witness));
gate_id_type id_3(constraints_3);
gate_id_type id_4(constraints_4);
BOOST_ASSERT(id_3 != id_4);
BOOST_CHECK(id_3 != id_4);

value_type power_100 = values.get_power(100);
value_type power_101 = values.get_power(101);
BOOST_ASSERT(power_100 != power_101);
BOOST_CHECK(power_100 != power_101);

// gate_id should be unordered -- order of constraints inside the gate should not matter
std::vector<constraint_type> constraints_5;
Expand All @@ -116,15 +116,15 @@ BOOST_AUTO_TEST_CASE(gate_id_sanity_tests) {

gate_id_type id_5(constraints_5),
id_6(constraints_6);
BOOST_ASSERT(id_5 == id_6);
BOOST_CHECK(id_5 == id_6);

std::vector<constraint_type> constraints_7;
constraints_7.emplace_back(var(0, 0, true, var::column_type::witness));
std::vector<constraint_type> constraints_8;
constraints_8.emplace_back(var(0, 0, true, var::column_type::constant));
gate_id_type id_7(constraints_7),
id_8(constraints_8);
BOOST_ASSERT(id_7 != id_8);
BOOST_CHECK(id_7 != id_8);
}

BOOST_AUTO_TEST_CASE(lookup_gate_id_sanity_tests) {
Expand Down Expand Up @@ -158,22 +158,22 @@ BOOST_AUTO_TEST_CASE(lookup_gate_id_sanity_tests) {
gate_2(1, constraints_2);
lookup_gate_id_type id_1 = lookup_gate_id_type(gate_1),
id_2 = lookup_gate_id_type(gate_2);
BOOST_ASSERT(id_1 == id_2);
BOOST_ASSERT(!(id_1 < id_2) && !(id_2 < id_1));
BOOST_CHECK(id_1 == id_2);
BOOST_CHECK(!(id_1 < id_2) && !(id_2 < id_1));
// Order of variables inside constraints should matter
auto var_1 = var(0, -1, true, var::column_type::witness),
var_2 = var(1, 3, true, var::column_type::witness);
lookup_constraint_type constraint_3({0, {var_1, var_2}}),
constraint_4({0, {var_2, var_1}});
lookup_gate_id_type id_3(constraint_3),
id_4(constraint_4);
BOOST_ASSERT(id_3 != id_4);
BOOST_CHECK(id_3 != id_4);
// Table ids should matter
lookup_constraint_type constraint_5({0, {var_1, var_2}}),
constraint_6({1, {var_1, var_2}});
lookup_gate_id_type id_5(constraint_5),
id_6(constraint_6);
BOOST_ASSERT(id_5 != id_6);
BOOST_CHECK(id_5 != id_6);
}

BOOST_AUTO_TEST_SUITE_END()
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void test_keccaks(
auto result_check = [](AssignmentType &assignment, typename component_type::result_type &real_res) {};

if (!(WitnessesAmount == 15)) {
BOOST_ASSERT_MSG(false, "Please add support for WitnessesAmount that you passed here!");
BOOST_CHECK_MESSAGE(false, "Please add support for WitnessesAmount that you passed here!");
}
std::array<std::uint32_t, WitnessesAmount> witnesses;
for (std::uint32_t i = 0; i < WitnessesAmount; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void test_keccaks(
auto result_check = [](AssignmentType &assignment, typename component_type::result_type &real_res) {};

if (!(WitnessesAmount == 15)) {
BOOST_ASSERT_MSG(false, "Please add support for WitnessesAmount that you passed here!");
BOOST_CHECK_MESSAGE(false, "Please add support for WitnessesAmount that you passed here!");
}
std::array<std::uint32_t, WitnessesAmount> witnesses;
for (std::uint32_t i = 0; i < WitnessesAmount; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ auto test_keccak_padding_inner(std::vector<typename BlueprintFieldType::value_ty
};

if (!(WitnessesAmount == 15 || WitnessesAmount == 9)) {
BOOST_ASSERT_MSG(false, "Please add support for WitnessesAmount that you passed here!");
BOOST_CHECK_MESSAGE(false, "Please add support for WitnessesAmount that you passed here!");
}
std::array<std::uint32_t, WitnessesAmount> witnesses;
for (std::uint32_t i = 0; i < WitnessesAmount; i++) {
Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/blueprint/test/hashes/plonk/keccak_round.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ auto test_keccak_round_inner(std::array<typename BlueprintFieldType::value_type,
};

if (!(WitnessesAmount == 15 || WitnessesAmount == 9)) {
BOOST_ASSERT_MSG(false, "Please add support for WitnessesAmount that you passed here!") ;
BOOST_CHECK_MESSAGE(false, "Please add support for WitnessesAmount that you passed here!") ;
}
std::array<std::uint32_t, WitnessesAmount> witnesses;
for (std::uint32_t i = 0; i < WitnessesAmount; i++) {
Expand Down
2 changes: 1 addition & 1 deletion crypto3/libs/blueprint/test/hashes/plonk/keccak_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ auto test_keccak_inner(std::vector<typename BlueprintFieldType::value_type> mess
};

if (!(WitnessesAmount == 15 || WitnessesAmount == 9)) {
BOOST_ASSERT_MSG(false, "Please add support for WitnessesAmount that you passed here!");
BOOST_CHECK_MESSAGE(false, "Please add support for WitnessesAmount that you passed here!");
}
std::array<std::uint32_t, WitnessesAmount> witnesses;
for (std::uint32_t i = 0; i < WitnessesAmount; i++) {
Expand Down
Loading
Loading