10#include <gtest/gtest.h>
13template <
typename Builder>
class RomTableTests :
public ::testing::Test {
19using BuilderTypes = testing::Types<UltraCircuitBuilder, MegaCircuitBuilder>;
29TEST(RomTable, TagCorrectness)
48 table_values.emplace_back(entry_1);
49 table_values.emplace_back(entry_2);
50 table_values.emplace_back(entry_3);
61 EXPECT_THROW(table[0] + table[2], std::runtime_error);
71 using field_ct =
typename TestFixture::field_ct;
72 using witness_ct =
typename TestFixture::witness_ct;
77 const size_t table_size = 10;
79 for (
size_t i = 0; i < table_size; ++i) {
88 for (
size_t i = 0; i < table_size; ++i) {
93 const auto before_n =
builder.num_gates();
94 const auto to_add = table[
index];
95 const auto after_n =
builder.num_gates();
100 EXPECT_EQ(after_n - before_n, 1ULL);
104 const auto before_n =
builder.num_gates();
105 const auto to_add = table[i];
106 const auto after_n =
builder.num_gates();
108 EXPECT_EQ(after_n - before_n, 0ULL);
111 expected += table_values[i].get_value();
114 EXPECT_EQ(
result.get_value(), expected);
121 using field_ct =
typename TestFixture::field_ct;
122 using witness_ct =
typename TestFixture::witness_ct;
123 using rom_table_ct =
typename TestFixture::rom_table_ct;
128 const size_t table_size = 5;
129 for (
size_t i = 0; i < table_size; ++i) {
134 const auto copied_rom_table = table;
138 for (
size_t i = 0; i < table_size; ++i) {
141 const auto to_add = (i % 2 == 0) ? copied_rom_table[
index] : table[
index];
143 expected += table_values[i].get_value();
145 EXPECT_EQ(
result.get_value(), expected);
148 EXPECT_EQ(verified,
true);
156 using field_ct =
typename TestFixture::field_ct;
157 using witness_ct =
typename TestFixture::witness_ct;
158 using rom_table_ct =
typename TestFixture::rom_table_ct;
160 constexpr size_t table_size = 16;
163 const size_t memory_block_size_before =
builder.blocks.memory.size();
166 for (
size_t i = 0; i < table_size; ++i) {
170 for (
size_t i = 0; i < table_size; ++i) {
178 const size_t memory_block_rows =
builder.blocks.memory.
size() - memory_block_size_before;
181 EXPECT_EQ(memory_block_rows, 2 * table_size) <<
"LogUp ROM expected exactly 2N rows; got " << memory_block_rows;
static bool check(const Builder &circuit)
Check the witness satisifies the circuit.
void set_origin_tag(const OriginTag &new_tag) const
stdlib::witness_t< Builder > witness_ct
stdlib::field_t< Builder > field_ct
RNG & get_debug_randomness(bool reset, std::uint_fast64_t seed)
Entry point for Barretenberg command-line interface.
TYPED_TEST_SUITE(CommitmentKeyTest, Curves)
TYPED_TEST(CommitmentKeyTest, CommitToZeroPoly)
UltraCircuitBuilder_< UltraExecutionTraceBlocks > UltraCircuitBuilder
TEST(BoomerangMegaCircuitBuilder, BasicCircuit)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
This file contains part of the logic for the Origin Tag mechanism that tracks the use of in-circuit p...
#define STANDARD_TESTING_TAGS
::testing::Types< UltraCircuitBuilder, MegaCircuitBuilder > BuilderTypes
static field random_element(numeric::RNG *engine=nullptr) noexcept