|
47 | 47 | #include "koladata/testing/matchers.h" |
48 | 48 | #include "arolla/dense_array/dense_array.h" |
49 | 49 | #include "arolla/dense_array/qtype/types.h" |
| 50 | +#include "arolla/jagged_shape/testing/matchers.h" |
50 | 51 | #include "arolla/qtype/qtype_traits.h" |
51 | 52 | #include "arolla/qtype/typed_value.h" |
52 | 53 | #include "arolla/util/bytes.h" |
@@ -336,6 +337,25 @@ TEST(DataSliceUtils, CreateWithSchemaFromDataError) { |
336 | 337 | HasSubstr("for primitive types"))); |
337 | 338 | } |
338 | 339 |
|
| 340 | +TEST(DataSliceTest, CreateWithFlatShape) { |
| 341 | + { |
| 342 | + auto slice = *DataSlice::CreateWithFlatShape( |
| 343 | + internal::DataSliceImpl::Create(std::vector<internal::DataItem>{}), |
| 344 | + internal::DataItem(schema::kNone)); |
| 345 | + EXPECT_THAT(slice.GetShape(), |
| 346 | + IsEquivalentTo(DataSlice::JaggedShape::FlatFromSize(0))); |
| 347 | + } |
| 348 | + { |
| 349 | + auto slice = *DataSlice::CreateWithFlatShape( |
| 350 | + internal::DataSliceImpl::Create(std::vector<internal::DataItem>{ |
| 351 | + internal::DataItem(1), internal::DataItem(2), |
| 352 | + internal::DataItem(3)}), |
| 353 | + internal::DataItem(schema::kInt32)); |
| 354 | + EXPECT_THAT(slice.GetShape(), |
| 355 | + IsEquivalentTo(DataSlice::JaggedShape::FlatFromSize(3))); |
| 356 | + } |
| 357 | +} |
| 358 | + |
339 | 359 | TEST(DataSliceTest, IsWhole) { |
340 | 360 | { |
341 | 361 | // No DataBag, trivially whole. |
|
0 commit comments