/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Make sure that Read() inside a Read() succeeds.
cow.Read(
[&](const Value* aValue) {
EXPECT_EQ(0, stats.mCopies);
EXPECT_EQ(0, stats.mFrees);
EXPECT_EQ(0, aValue->Serial());
EXPECT_TRUE(cow.CanRead());
EXPECT_TRUE(cow.CanWrite());
aValue->Go();
EXPECT_EQ(0, stats.mCalls);
EXPECT_EQ(1, stats.mConstCalls);
},
[]() { // This gets called if we can't read. We shouldn't get here.
EXPECT_TRUE(false);
});
});
// Make sure Read() inside a Write() fails.
cow.Read(
[](const Value* aValue) { // This gets called if we can read. We shouldn't get here.
EXPECT_TRUE(false);
},
[]() { // This gets called if we can't read. We *should* get here.
EXPECT_TRUE(true);
});
// Make sure Write() inside a Write() fails.
cow.Write(
[](Value* aValue) { // This gets called if we can write. We shouldn't get here.
EXPECT_TRUE(false);
},
[]() { // This gets called if we can't write. We *should* get here.
EXPECT_TRUE(true);
});
},
[]() { // This gets called if we can't write. We shouldn't get here.
EXPECT_TRUE(false);
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.