Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
file_io.test.cpp
Go to the documentation of this file.
5#include <gtest/gtest.h>
6
7using namespace bb;
8
9TEST(APIFileIO, ManyFromBufferExactRejectsTrailingBytes)
10{
11 std::vector<uint8_t> bytes(sizeof(uint256_t) + 1, 0);
12
13 EXPECT_THROW_WITH_MESSAGE((many_from_buffer_exact<uint256_t>(bytes, "UltraHonk proof file")),
14 "UltraHonk proof file size must be a multiple of 32 bytes, got 33");
15}
16
17TEST(APIFileIO, ManyFromBufferExactAcceptsAlignedBuffers)
18{
20 auto bytes = to_buffer(expected);
21
22 auto parsed = many_from_buffer_exact<uint256_t>(bytes, "UltraHonk proof file");
23
24 EXPECT_EQ(parsed, expected);
25}
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessageRegex)
Definition assert.hpp:193
TEST(APIFileIO, ManyFromBufferExactRejectsTrailingBytes)
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::vector< uint8_t > to_buffer(T const &value)