Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
engine.test.cpp
Go to the documentation of this file.
1#include "engine.hpp"
4#include <gtest/gtest.h>
5
6using namespace bb;
7
8TEST(engine, GetRandomUint64)
9{
11 auto a = engine.get_random_uint64();
12 auto b = engine.get_random_uint64();
13 EXPECT_NE(a, 0U);
14 EXPECT_NE(b, 0U);
15 EXPECT_NE(a, b);
16}
17
18TEST(engine, ResetDebugEngine)
19{
20 auto& debug_engine = numeric::get_debug_randomness();
21
22 auto a = debug_engine.get_random_uint64();
23 auto b = debug_engine.get_random_uint64();
24 EXPECT_NE(a, b);
25
26 debug_engine = numeric::get_debug_randomness(true);
27 auto c = debug_engine.get_random_uint64();
28 auto d = debug_engine.get_random_uint64();
29 EXPECT_EQ(a, c);
30 EXPECT_EQ(b, d);
31
33 EXPECT_NE(a, e);
34}
35
36TEST(engine, GetExpectedDebugValue)
37{
38 auto& debug_engine = numeric::get_debug_randomness(true);
39 auto a = debug_engine.get_random_uint1024();
40 auto expected = from_buffer<uint1024_t>(std::vector<uint8_t>{
41 0x69, 0x1f, 0x71, 0xcb, 0xcd, 0xdb, 0x45, 0x74, 0xe5, 0x17, 0x17, 0xa7, 0x29, 0x02, 0x21, 0x4a,
42 0x9d, 0xbe, 0xb9, 0x0e, 0x4f, 0x22, 0x5f, 0x0c, 0x6b, 0xa0, 0xcd, 0xcf, 0x77, 0xcf, 0xf1, 0xc1,
43 0x03, 0x55, 0xea, 0x48, 0xd3, 0x87, 0x40, 0x68, 0x01, 0x01, 0xb4, 0x3f, 0x6d, 0x17, 0xde, 0x8e,
44 0x35, 0x07, 0xf3, 0xd8, 0x20, 0x83, 0x37, 0x19, 0x78, 0x26, 0xe2, 0xe9, 0xea, 0x00, 0x0e, 0xd5,
45 0xb0, 0x5d, 0x5a, 0xc5, 0xe7, 0xf7, 0x2b, 0x2c, 0x07, 0x56, 0x70, 0x4b, 0xea, 0x85, 0xbe, 0x38,
46 0x35, 0x2b, 0x34, 0xd4, 0x8f, 0x6c, 0x43, 0xc5, 0x93, 0x0f, 0x3d, 0x70, 0xd6, 0xdb, 0x09, 0xa4,
47 0x8f, 0x4a, 0xd4, 0x92, 0x4f, 0xbd, 0xc5, 0x22, 0xb0, 0x7b, 0x6c, 0xd0, 0xef, 0x55, 0x08, 0xfd,
48 0x66, 0x83, 0x68, 0x48, 0x20, 0xff, 0x40, 0x79, 0x5b, 0x8d, 0x9f, 0x1b, 0xe2, 0x22, 0x0c, 0xba,
49 });
50 EXPECT_EQ(a, expected);
51}
virtual uint64_t get_random_uint64()=0
FF a
FF b
numeric::RNG & engine
RNG & get_debug_randomness(bool reset, std::uint_fast64_t seed)
Definition engine.cpp:190
RNG & get_randomness()
Definition engine.cpp:203
Entry point for Barretenberg command-line interface.
TEST(MegaCircuitBuilder, CopyConstructor)