@@ -1252,6 +1252,33 @@ TEST_F(TestBuilder, TestResizeDownsize) {
12521252 ASSERT_GE (500 , builder.capacity ());
12531253 ASSERT_EQ (500 , builder.length ());
12541254}
1255+ namespace {
1256+
1257+ void AssertBuilderValidityAtIndices (const ArrayBuilder& builder,
1258+ const std::vector<int64_t >& indices,
1259+ const std::vector<bool >& expected_validity) {
1260+ for (size_t i = 0 ; i < indices.size (); ++i) {
1261+ ASSERT_EQ (expected_validity[i], builder.IsValid (indices[i]));
1262+ }
1263+ }
1264+
1265+ } // namespace
1266+
1267+ TEST_F (TestBuilder, TestIsNull) {
1268+ NullBuilder null_builder (pool_);
1269+ ASSERT_OK (null_builder.AppendNull ());
1270+ ASSERT_OK (null_builder.Append (nullptr ));
1271+ AssertBuilderValidityAtIndices (null_builder, {0 , 1 }, {false , false });
1272+
1273+ Int32Builder int32_builder (pool_);
1274+ ASSERT_OK (int32_builder.Append (0 ));
1275+ ASSERT_OK (int32_builder.AppendNull ());
1276+ ASSERT_OK (int32_builder.Append (2 ));
1277+ ASSERT_OK (int32_builder.AppendNulls (3 ));
1278+ ASSERT_OK (int32_builder.Append (6 ));
1279+ ASSERT_OK (int32_builder.AppendEmptyValues (3 ));
1280+ AssertBuilderValidityAtIndices (int32_builder, {0 , 1 , 4 , 7 }, {true , false , false , true });
1281+ }
12551282
12561283template <typename Attrs>
12571284class TestPrimitiveBuilder : public TestBuilder {
0 commit comments