Exemple #1
0
        ptree c;

	// Verify basic get woks
        a.set("Hello", "World");
        a.set("foo", "bar");
        a.set("baz", "quxx");
	REQUIRE(a.get("foo") == "bar");
	// Verify copies are distinct
        b = a;
        a.set("foo", "");
        REQUIRE(b.get("foo") == "bar");
        REQUIRE(a.get("foo") == "");
	// Verify merkle hashes are canonical and unique
        c.set("Hello", "World");
        c.set("baz", "quxx");
        REQUIRE(a.merkle() == c.merkle());
        REQUIRE(a.merkle() != b.merkle());
	// Verify size works
	REQUIRE(a.size() == 2);
	REQUIRE(b.size() == 3);
	REQUIRE(c.size() == 2);
}

TEST_CASE("Simple ptree serialization", "[ptree]") {
        ptree a;
        ptree b;

	// Set some values
        a.set("Hello", "World");
        a.set("foo", "bar");
        a.set("baz", "quxx");
Exemple #2
0
void ptree_root::set(const ptree& pt)
{
	merkle = pt.merkle();
	size = pt.size();
}