Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
precomputed.test.cpp
Go to the documentation of this file.
1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
3
10
11namespace bb::avm2::constraining {
12namespace {
13
14using tracegen::TestTraceContainer;
16using C = Column;
17using precomputed = bb::avm2::precomputed<FF>;
18
19TEST(PrecomputedConstrainingTest, EmptyRow)
20{
21 check_relation<precomputed>(testing::empty_trace());
22}
23
24TEST(PrecomputedConstrainingTest, GranularSelectorsOnRange16)
25{
26 // All granular selectors high on a row where sel_range_16 is also high: subset holds.
27 TestTraceContainer trace({ {
28 { C::precomputed_sel_range_16, 1 },
29 { C::precomputed_sel_range_16_active, 1 },
30 { C::precomputed_sel_bitwise, 1 },
31 { C::precomputed_sel_addressing_gas, 1 },
32 } });
33
34 check_relation<precomputed>(trace, precomputed::SR_GRANULAR_SELECTORS_ON_RANGE_16);
35}
36
37TEST(PrecomputedConstrainingTest, NegativeRange16ActiveOnRange16)
38{
39 // sel_range_16_active high while sel_range_16 is low: subset violated.
40 TestTraceContainer trace({ {
41 { C::precomputed_sel_range_16, 0 },
42 { C::precomputed_sel_range_16_active, 1 },
43 } });
44
47}
48
49TEST(PrecomputedConstrainingTest, NegativeBitwiseOnRange16)
50{
51 // sel_bitwise high while sel_range_16 is low: subset violated.
52 TestTraceContainer trace({ {
53 { C::precomputed_sel_range_16, 0 },
54 { C::precomputed_sel_bitwise, 1 },
55 } });
56
59}
60
61TEST(PrecomputedConstrainingTest, NegativeAddressingGasOnRange16)
62{
63 // sel_addressing_gas high while sel_range_16 is low: subset violated.
64 TestTraceContainer trace({ {
65 { C::precomputed_sel_range_16, 0 },
66 { C::precomputed_sel_addressing_gas, 1 },
67 } });
68
71}
72
73} // namespace
74} // namespace bb::avm2::constraining
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessageRegex)
Definition assert.hpp:224
static constexpr size_t SR_GRANULAR_SELECTORS_ON_RANGE_16
static std::string get_subrelation_label(size_t index)
TestTraceContainer trace
TEST(AvmFixedVKTests, FixedVKCommitments)
Test that the fixed VK commitments agree with the ones computed from precomputed columns.
TestTraceContainer empty_trace()
Definition fixtures.cpp:156