Commit 52229ebf authored by Kenton Varda's avatar Kenton Varda

Add test for setting 1-bit struct.

parent 90c108ea
......@@ -1425,6 +1425,28 @@ TEST(Encoding, StructSetters) {
}
}
TEST(Encoding, OneBitStructSetters) {
// Test case of setting a 1-bit struct.
MallocMessageBuilder builder;
auto root = builder.getRoot<test::TestLists>();
auto list = root.initList1(8);
list[0].setF(true);
list[1].setF(true);
list[2].setF(false);
list[3].setF(true);
list[4].setF(true);
list[5].setF(false);
list[6].setF(true);
list[7].setF(false);
MallocMessageBuilder builder2;
builder2.setRoot(list.asReader()[2]);
EXPECT_FALSE(builder2.getRoot<test::TestLists::Struct1>().getF());
builder2.setRoot(list.asReader()[6]);
EXPECT_TRUE(builder2.getRoot<test::TestLists::Struct1>().getF());
}
TEST(Encoding, ListSetters) {
MallocMessageBuilder builder;
auto root = builder.getRoot<TestListDefaults>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment