27 #include <boost/test/unit_test.hpp>
32 template<
typename A,
typename B,
typename C>
34 expect_test_vector<B, C>(b, c);
37 template<
typename Tree,
typename Witness>
46 size_t witness_ser_i = 0;
64 std::vector<Witness> witnesses;
66 for (
size_t i = 0; i < 16; i++) {
70 witnesses.push_back(tree.witness());
73 tree.append(test_commitment);
88 for (Witness& wit : witnesses) {
90 wit.append(test_commitment);
96 auto path = wit.path();
113 for (Witness& wit : witnesses) {
119 #define MAKE_STRING(x) std::string((x), (x)+sizeof(x))
128 test_tree<SaplingTestingMerkleTree, SaplingTestingWitness>(
139 std::array<libzcash::SHA256Compress, 65> computed;
143 for (
size_t d = 1; d <= 64; d++) {
154 std::array<libzcash::PedersenHash, 63> computed;
158 for (
size_t d = 1; d <= 62; d++) {
171 uint256 expected =
uint256S(
"3e49b5f954aa9d3545bc6c37744661eea48d7c34e3000d82b7f0010c30f4c2fb");
Hash empty_root(size_t depth) const
static libzcash::PedersenHash empty_root()
static PedersenHash combine(const PedersenHash &a, const PedersenHash &b, size_t depth)
static PedersenHash uncommitted()
static SHA256Compress uncommitted()
static SHA256Compress combine(const SHA256Compress &a, const SHA256Compress &b, size_t depth)
BOOST_AUTO_TEST_SUITE_END()
void expect_test_vector(T &v, const U &expected)
void expect_ser_test_vector(B &b, const C &c, const A &tree)
BOOST_AUTO_TEST_CASE(SaplingVectors)
void test_tree(UniValue commitment_tests, UniValue root_tests, UniValue ser_tests, UniValue witness_ser_tests, UniValue path_tests)
UniValue read_json(const std::string &jsondata)
#define BOOST_CHECK_THROW(stmt, excMatch)
#define BOOST_FIXTURE_TEST_SUITE(a, b)
#define BOOST_CHECK(expr)
#define INCREMENTAL_MERKLE_TREE_DEPTH
uint256 uint256S(const char *str)