Skip to content

Commit

Permalink
chore: Rename constraining unit tests in vm2 (#11581)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmon authored Jan 29, 2025
1 parent c4892c6 commit 570cdba
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using FF = AvmFlavorSettings::FF;
using C = Column;
using alu = bb::avm2::alu<FF>;

TEST(AvmConstrainingTest, AluPositive)
TEST(AluConstrainingTest, BasicAdd)
{
TestTraceContainer::RowTraceContainer trace = {
{ .alu_ia = 1, .alu_ib = 2, .alu_ic = 3, .alu_sel_op_add = 1 },
Expand All @@ -26,7 +26,7 @@ TEST(AvmConstrainingTest, AluPositive)
check_relation<alu>(trace);
}

TEST(AvmConstrainingTest, AluNegativeBoolean)
TEST(AluConstrainingTest, NegativeSelNonBoolean)
{
TestTraceContainer::RowTraceContainer trace = {
// Negative test, this should be a boolean only!
Expand All @@ -36,7 +36,7 @@ TEST(AvmConstrainingTest, AluNegativeBoolean)
EXPECT_THROW_WITH_MESSAGE(check_relation<alu>(trace, alu::SR_SEL_ADD_BINARY), "SEL_ADD_BINARY");
}

TEST(AvmConstrainingTest, AluNegativeAdd)
TEST(AluConstrainingTest, NegativeAdd)
{
TestTraceContainer::RowTraceContainer trace = {
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using FF = AvmFlavorSettings::FF;
using C = Column;
using execution = bb::avm2::execution<FF>;

TEST(ExecutionConstrainingTest, AllPositive)
TEST(ExecutionConstrainingTest, Basic)
{
// clang-format off
TestTraceContainer trace({
Expand All @@ -29,7 +29,7 @@ TEST(ExecutionConstrainingTest, AllPositive)
check_relation<execution>(trace.as_rows());
}

TEST(ExecutionConstrainingTest, ContinuityPositive)
TEST(ExecutionConstrainingTest, Continuity)
{
// clang-format off
TestTraceContainer trace({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using FF = AvmFlavorSettings::FF;
using C = Column;
using range_check = bb::avm2::range_check<FF>;

TEST(AvmConstrainingTest, RangeCheckPositiveEmptyRow)
TEST(RangeCheckConstrainingTest, EmptyRow)
{
TestTraceContainer trace({
{ { C::precomputed_clk, 1 } },
Expand All @@ -29,7 +29,7 @@ TEST(AvmConstrainingTest, RangeCheckPositiveEmptyRow)
check_relation<range_check>(trace.as_rows());
}

TEST(AvmConstrainingTest, RangeCheckPositiveIsLteMutuallyExclusive)
TEST(RangeCheckConstrainingTest, IsLteMutuallyExclusive)
{
TestTraceContainer trace({
{ { C::range_check_sel, 1 }, { C::range_check_is_lte_u32, 1 } },
Expand All @@ -38,7 +38,7 @@ TEST(AvmConstrainingTest, RangeCheckPositiveIsLteMutuallyExclusive)
check_relation<range_check>(trace.as_rows(), range_check::SR_IS_LTE_MUTUALLY_EXCLUSIVE);
}

TEST(AvmConstrainingTest, RangeCheckNegativeIsLteMutuallyExclusive)
TEST(RangeCheckConstrainingTest, NegativeIsLteMutuallyExclusive)
{
TestTraceContainer trace({
// Negative test, only one is_lte flag should be high
Expand All @@ -49,7 +49,7 @@ TEST(AvmConstrainingTest, RangeCheckNegativeIsLteMutuallyExclusive)
"IS_LTE_MUTUALLY_EXCLUSIVE");
}

TEST(AvmConstrainingTest, RangeCheckPositiveCheckRecomposition)
TEST(RangeCheckConstrainingTest, CheckRecomposition)
{
uint128_t value = 0x3FFFFFFFD;
uint256_t value_u256 = uint256_t::from_uint128(value);
Expand All @@ -70,7 +70,7 @@ TEST(AvmConstrainingTest, RangeCheckPositiveCheckRecomposition)
check_relation<range_check>(trace.as_rows(), range_check::SR_CHECK_RECOMPOSITION);
}

TEST(AvmConstrainingTest, RangeCheckNegativeCheckRecomposition)
TEST(RangeCheckConstrainingTest, NegativeCheckRecomposition)
{
uint128_t value = 0x3FFFFFFFD;
// Add 1 to the value to create a "bad" value that doesn't match recomposition
Expand All @@ -93,7 +93,7 @@ TEST(AvmConstrainingTest, RangeCheckNegativeCheckRecomposition)
"CHECK_RECOMPOSITION");
}

TEST(AvmConstrainingTest, RangeCheckPositiveFull)
TEST(RangeCheckConstrainingTest, Full)
{
uint8_t num_bits = 34;
uint8_t non_dynamic_bits = 32;
Expand Down Expand Up @@ -129,7 +129,7 @@ TEST(AvmConstrainingTest, RangeCheckPositiveFull)
check_relation<range_check>(trace.as_rows());
}

TEST(AvmConstrainingTest, RangeCheckNegativeMissingLookup)
TEST(RangeCheckConstrainingTest, NegativeMissingLookup)
{
uint8_t num_bits = 34;
uint8_t non_dynamic_bits = 32;
Expand Down Expand Up @@ -165,7 +165,7 @@ TEST(AvmConstrainingTest, RangeCheckNegativeMissingLookup)
EXPECT_THROW_WITH_MESSAGE(check_relation<range_check>(trace.as_rows()), "Relation range_check");
}

TEST(AvmConstrainingTest, RangeCheckPositiveWithTracegen)
TEST(RangeCheckConstrainingTest, WithTracegen)
{
TestTraceContainer trace;
RangeCheckTraceBuilder builder;
Expand All @@ -190,7 +190,7 @@ TEST(AvmConstrainingTest, RangeCheckPositiveWithTracegen)
check_relation<range_check>(trace.as_rows());
}

TEST(AvmConstrainingTest, RangeCheckNegativeWithTracegen)
TEST(RangeCheckConstrainingTest, NegativeWithTracegen)
{
TestTraceContainer trace;
RangeCheckTraceBuilder builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using FF = AvmFlavorSettings::FF;
using C = Column;
using sha256 = bb::avm2::sha256<FF>;

TEST(AvmConstrainingTest, Sha256PositiveEmptyRow)
TEST(Sha256ConstrainingTest, EmptyRow)
{
TestTraceContainer trace({
{ { C::precomputed_clk, 1 } },
Expand All @@ -39,7 +39,7 @@ TEST(AvmConstrainingTest, Sha256PositiveEmptyRow)
// This test imports a bunch of external code since hand-generating the sha256 trace is a bit laborious atm.
// The test is a bit of a placeholder for now.
// TOOD: Replace this with a hardcoded test vector and write a negative test
TEST(AvmConstrainingTest, Sha256Positive)
TEST(Sha256ConstrainingTest, Basic)
{
simulation::NoopEventEmitter<simulation::MemoryEvent> emitter;
simulation::Memory mem(/*space_id=*/0, emitter);
Expand Down

0 comments on commit 570cdba

Please sign in to comment.