3#include <gtest/gtest.h>
20using BuilderTypes = testing::Types<UltraCircuitBuilder, MegaCircuitBuilder>;
30TEST(TwinRomTable, TagCorrectness)
54 table_values.emplace_back(field_pair_ct{ entry_1, entry_2 });
55 table_values.emplace_back(field_pair_ct{ entry_3, entry_4 });
58 twin_rom_table_ct table(table_values);
63 EXPECT_EQ(table[
field_ct(1)][0].get_origin_tag(), next_challenge_tag);
67 EXPECT_THROW(table[1][1] + 1, std::runtime_error);
78 using field_ct =
typename TestFixture::field_ct;
79 using witness_ct =
typename TestFixture::witness_ct;
80 using twin_rom_table_ct =
typename TestFixture::twin_rom_table_ct;
81 using field_pair_ct =
typename TestFixture::field_pair_ct;
86 const size_t table_size = 10;
88 for (
size_t i = 0; i < table_size; ++i) {
94 twin_rom_table_ct table(table_values);
100 for (
size_t i = 0; i < table_size; ++i) {
104 const auto before_n =
builder.num_gates();
106 const auto to_add = table[
index];
107 const auto after_n =
builder.num_gates();
111 EXPECT_EQ(after_n - before_n, 1ULL);
114 result[0] += to_add[0];
115 result[1] += to_add[1];
117 const auto before_n =
builder.num_gates();
118 const auto to_add = table[i];
119 const auto after_n =
builder.num_gates();
121 EXPECT_EQ(after_n - before_n, 0ULL);
122 result[0] += to_add[0];
123 result[1] += to_add[1];
126 auto expected_values = table_values[i];
127 expected[0] += expected_values[0].get_value();
128 expected[1] += expected_values[1].get_value();
133 EXPECT_EQ(result[0].get_value(), expected[0]);
134 EXPECT_EQ(result[1].get_value(), expected[1]);
137 EXPECT_EQ(verified,
true);
std::array< field_ct, 2 > field_pair_ct
static bool check(const Builder &circuit)
Check the witness satisifies the circuit.
void set_origin_tag(const OriginTag &new_tag) const
bn254::witness_ct 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(ShpleminiTest, TestSettings)
UltraCircuitBuilder_< UltraExecutionTraceBlocks > UltraCircuitBuilder
TYPED_TEST(ShpleminiTest, CorrectnessOfMultivariateClaimBatching)
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