Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
success_copy.test.cpp
Go to the documentation of this file.
1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
3
4#include <cstdint>
5
12
13namespace bb::avm2::constraining {
14namespace {
15
16using tracegen::TestTraceContainer;
18using C = Column;
20
21TEST(SuccessCopyConstrainingTest, SuccessCopyTrue)
22{
23 TestTraceContainer trace({
24 { { C::execution_sel, 1 },
25 { C::execution_sel_execute_success_copy, 1 },
26 { C::execution_register_0_, /*true=*/1 },
27 { C::execution_mem_tag_reg_0_, static_cast<uint8_t>(MemoryTag::U1) },
28 { C::execution_last_child_success, /*true=*/1 } },
29 });
31}
32
33TEST(SuccessCopyConstrainingTest, SuccessCopyFalse)
34{
35 TestTraceContainer trace({
36 { { C::execution_sel, 1 },
37 { C::execution_sel_execute_success_copy, 1 },
38 { C::execution_register_0_, /*false=*/0 },
39 { C::execution_mem_tag_reg_0_, static_cast<uint8_t>(MemoryTag::U1) },
40 { C::execution_last_child_success, /*false=*/0 } },
41 });
43}
44
45TEST(SuccessCopyConstrainingTest, NegativeInvalidMemTag)
46{
47 TestTraceContainer trace({
48 { { C::execution_sel, 1 },
49 { C::execution_sel_execute_success_copy, 1 },
50 { C::execution_register_0_, /*true=*/1 },
51 { C::execution_mem_tag_reg_0_, static_cast<uint8_t>(MemoryTag::U16) },
52 { C::execution_last_child_success, 1 } },
53 });
55 "SUCCESS_COPY_U1_TAG");
56}
57
58TEST(SuccessCopyConstrainingTest, NegativeInvalidLastChildSuccess)
59{
60 TestTraceContainer trace({
61 { { C::execution_sel, 1 },
62 { C::execution_sel_execute_success_copy, 1 },
63 { C::execution_register_0_, /*false=*/0 },
64 { C::execution_mem_tag_reg_0_, static_cast<uint8_t>(MemoryTag::U1) },
65 { C::execution_last_child_success, /*true=*/1 } },
66 });
68 "SUCCESS_COPY_WRITE_REG");
69}
70
71} // namespace
72} // namespace bb::avm2::constraining
static constexpr size_t SR_SUCCESS_COPY_U1_TAG
static constexpr size_t SR_SUCCESS_COPY_WRITE_REG
TestTraceContainer trace
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessage)
Definition macros.hpp:7
TEST(TxExecutionConstrainingTest, WriteTreeValue)
Definition tx.test.cpp:508
NiceMock< MockExecution > execution