@@ -144,14 +144,48 @@ TEST(ColumnsCase, NumericSlice) {
144144
145145
146146TEST (ColumnsCase, FixedStringInit) {
147- auto col = std::make_shared<ColumnFixedString>(3 );
148- for (const auto & s : MakeFixedStrings ()) {
147+ const auto column_data = MakeFixedStrings ();
148+ auto col = std::make_shared<ColumnFixedString>(3 , column_data);
149+
150+ ASSERT_EQ (col->Size (), column_data.size ());
151+
152+ size_t i = 0 ;
153+ for (const auto & s : column_data) {
154+ EXPECT_EQ (s, col->At (i));
155+ ++i;
156+ }
157+ }
158+
159+ TEST (ColumnsCase, FixedString_Append_SmallStrings) {
160+ // Ensure that strings smaller than FixedString's size
161+ // are padded with zeroes on insertion.
162+
163+ const size_t string_size = 7 ;
164+ const auto column_data = MakeFixedStrings ();
165+
166+ auto col = std::make_shared<ColumnFixedString>(string_size);
167+ size_t i = 0 ;
168+ for (const auto & s : column_data) {
149169 col->Append (s);
170+
171+ EXPECT_EQ (string_size, col->At (i).size ());
172+
173+ std::string expected = column_data[i];
174+ expected.resize (string_size, char (0 ));
175+ EXPECT_EQ (expected, col->At (i));
176+
177+ ++i;
150178 }
151179
152- ASSERT_EQ (col->Size (), 4u );
153- ASSERT_EQ (col->At (1 ), " bbb" );
154- ASSERT_EQ (col->At (3 ), " ddd" );
180+ ASSERT_EQ (col->Size (), i);
181+ }
182+
183+ TEST (ColumnsCase, FixedString_Append_LargeString) {
184+ // Ensure that inserting strings larger than FixedString size thorws exception.
185+
186+ const auto col = std::make_shared<ColumnFixedString>(1 );
187+ EXPECT_ANY_THROW (col->Append (" 2c" ));
188+ EXPECT_ANY_THROW (col->Append (" this is a long string" ));
155189}
156190
157191TEST (ColumnsCase, StringInit) {
0 commit comments