Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
memory_trace.test.cpp
Go to the documentation of this file.
1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
3
8
9namespace bb::avm2::tracegen {
10namespace {
11
13using C = Column;
14using simulation::MemoryEvent;
15
16TEST(MemoryTraceGenTest, Sorting)
17{
18 TestTraceContainer trace;
19
20 // We use .value field to check that the events are sorted correctly. The values
21 // are set to be in increasing order once the events are sorted.
23 {
24 .execution_clk = UINT32_MAX,
26 .addr = 20,
28 .space_id = 1001,
29 },
30 {
31 .execution_clk = 20,
33 .addr = 5,
35 .space_id = 1000,
36 },
37 {
38 .execution_clk = UINT32_MAX,
40 .addr = 20,
42 .space_id = 1001,
43 },
44 {
45 .execution_clk = 10,
47 .addr = 6,
49 .space_id = 1000,
50 },
51 {
52 .execution_clk = 20,
54 .addr = 5,
56 .space_id = 1000,
57 },
58 {
59 .execution_clk = 15,
61 .addr = 5,
63 .space_id = 1000,
64 },
65 };
66
67 MemoryTraceBuilder memory_trace_builder;
68 memory_trace_builder.process(events, trace);
69
70 const auto& rows = trace.as_rows();
71
72 ASSERT_EQ(rows.size(), 6);
73
74 for (uint32_t i = 0; i < trace.as_rows().size(); i++) {
75 EXPECT_THAT(rows.at(i), ROW_FIELD_EQ(memory_value, i));
76 }
77}
78
79} // namespace
80} // namespace bb::avm2::tracegen
static TaggedValue from_tag(ValueTag tag, FF value)
std::vector< AvmFullRowConstRef > as_rows() const
TestTraceContainer trace
#define ROW_FIELD_EQ(field_name, expression)
Definition macros.hpp:15
TEST(EmitUnencryptedLogTest, Basic)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13