[zcash/zcash] Add tests for sapling anchors (#3258)

str4d requested changes on this pull request.

> @@ -142,6 +142,20 @@ class CCoinsViewTest : public CCoinsView
mapNullifiers.clear();
}

+ template
+ void BatchWriteAnchors(Cache& mapAnchors, std::map& cacheAnchors)

Why is `mapAnchors` a `Cache`, and `cacheAnchors` a `std::map`?

> BOOST_CHECK(checktree.root() == tree.root()); // Oh, shucks.
}
}
}

-BOOST_AUTO_TEST_CASE(anchor_regression_test)
+BOOST_AUTO_TEST_CASE(anchor_pop_regression_test)
+{
+ anchorPopRegressionTestImpl(SPROUT);
+ anchorPopRegressionTestImpl(SAPLING);

Use `SCOPED_TRACE` to make it clear in error messages which of these two is failing.

> }
}

+BOOST_AUTO_TEST_CASE(anchor_regression_test)
+{
+ anchorRegressionTestImpl(SPROUT);
+ anchorRegressionTestImpl(SAPLING);

Ditto.

>
uint256 check_rt = tree.root();

BOOST_CHECK(check_rt == newrt);
}
}

+BOOST_AUTO_TEST_CASE(anchors_flush_test)
+{
+ anchorsFlushImpl(SPROUT);
+ anchorsFlushImpl(SAPLING);

Ditto.

>
assert(obtain_tree.root() == newrt);
}
}
}

+BOOST_AUTO_TEST_CASE(anchors_test)
+{
+ anchorsTestImpl(SPROUT);
+ anchorsTestImpl(SAPLING);

Ditto.

Запись редактировалась последний раз: May 31, 2018, 4:47 am