@@ -112,14 +112,18 @@ TEST_P(TestRunEndEncodedArray, FromRunEndsAndValues) {
112112 ASSERT_EQ (ree_array->data ()->null_count , 0 );
113113 ASSERT_EQ (ree_array->offset (), 1 );
114114
115- ASSERT_RAISES_WITH_MESSAGE (Invalid,
116- " Invalid: Run end type must be int16, int32 or int64" ,
117- RunEndEncodedArray::Make (30 , string_values, int32_values));
118- ASSERT_RAISES_WITH_MESSAGE (
119- Invalid, " Invalid: Run ends array cannot contain null values" ,
115+ EXPECT_RAISES_WITH_MESSAGE_THAT (
116+ Invalid,
117+ ::testing::HasSubstr (" Invalid: Run end type must be int16, int32 or int64" ),
118+ RunEndEncodedArray::Make(30 , string_values, int32_values));
119+ EXPECT_RAISES_WITH_MESSAGE_THAT (
120+ Invalid,
121+ ::testing::HasSubstr (" Invalid: Null count must be 0 for run ends array, but is 3" ),
120122 RunEndEncodedArray::Make(30 , run_end_only_null, int32_values));
121- ASSERT_RAISES_WITH_MESSAGE (
122- Invalid, " Invalid: Values array has to be at least as long as run ends array" ,
123+ EXPECT_RAISES_WITH_MESSAGE_THAT (
124+ Invalid,
125+ ::testing::HasSubstr (
126+ " Invalid: Length of run_ends is greater than the length of values: 3 > 2" ),
123127 RunEndEncodedArray::Make(30 , run_end_values, ArrayFromJSON(int32(), "[2, 0]")));
124128}
125129
@@ -387,10 +391,11 @@ TEST_P(TestRunEndEncodedArray, Validate) {
387391
388392 auto empty_run_ends = MakeArray (empty_array->data ()->Copy ());
389393 empty_run_ends->data ()->length = 1 ;
390- ASSERT_RAISES_WITH_MESSAGE (Invalid,
391- " Invalid: Run-end encoded array has non-zero length 1, "
392- " but run ends array has zero length" ,
393- empty_run_ends->Validate ());
394+ EXPECT_RAISES_WITH_MESSAGE_THAT (
395+ Invalid,
396+ ::testing::HasSubstr (" Invalid: Run-end encoded array has non-zero length 1, "
397+ " but run ends array has zero length" ),
398+ empty_run_ends->Validate());
394399
395400 auto offset_length_overflow = MakeArray (good_array->data ()->Copy ());
396401 offset_length_overflow->data ()->offset = std::numeric_limits<int64_t >::max ();
@@ -408,11 +413,12 @@ TEST_P(TestRunEndEncodedArray, Validate) {
408413 too_large_for_ree16->data ()->offset = std::numeric_limits<int16_t>::max();
409414 too_large_for_ree16->data ()->length = 1;
410415 if (run_end_type->id () == Type::INT16) {
411- ASSERT_RAISES_WITH_MESSAGE (
416+ EXPECT_RAISES_WITH_MESSAGE_THAT (
412417 Invalid,
413- " Invalid: Offset + length of a run-end encoded array must fit in a value"
414- " of the run end type int16, but offset + length is 32768 while"
415- " the allowed maximum is 32767" ,
418+ ::testing::HasSubstr (
419+ " Invalid: Offset + length of a run-end encoded array must fit in a value"
420+ " of the run end type int16, but offset + length is 32768 while"
421+ " the allowed maximum is 32767" ),
416422 too_large_for_ree16->Validate());
417423 } else {
418424 ASSERT_OK (too_large_for_ree16->ValidateFull ());
@@ -423,57 +429,64 @@ TEST_P(TestRunEndEncodedArray, Validate) {
423429 too_large_for_ree32->data ()->offset = std::numeric_limits<int32_t>::max();
424430 too_large_for_ree32->data ()->length = 1;
425431 if (run_end_type->id () == Type::INT16) {
426- ASSERT_RAISES_WITH_MESSAGE (
432+ EXPECT_RAISES_WITH_MESSAGE_THAT (
427433 Invalid,
428- " Invalid: Offset + length of a run-end encoded array must fit in a "
429- " value of the run end type int16, but offset + length "
430- " is 2147483648 while the allowed maximum is 32767" ,
434+ ::testing::HasSubstr (
435+ " Invalid: Offset + length of a run-end encoded array must fit in a "
436+ " value of the run end type int16, but offset + length "
437+ " is 2147483648 while the allowed maximum is 32767" ),
431438 too_large_for_ree32->Validate());
432439 } else if (run_end_type->id () == Type::INT32) {
433- ASSERT_RAISES_WITH_MESSAGE (
440+ EXPECT_RAISES_WITH_MESSAGE_THAT (
434441 Invalid,
435- " Invalid: Offset + length of a run-end encoded array must fit in a "
436- " value of the run end type int32, but offset + length "
437- " is 2147483648 while the allowed maximum is 2147483647" ,
442+ ::testing::HasSubstr (
443+ " Invalid: Offset + length of a run-end encoded array must fit in a "
444+ " value of the run end type int32, but offset + length "
445+ " is 2147483648 while the allowed maximum is 2147483647" ),
438446 too_large_for_ree32->Validate());
439447 } else {
440448 ASSERT_OK (too_large_for_ree32->ValidateFull ());
441449 }
442450
443451 auto too_many_children = MakeArray(good_array->data ()->Copy());
444452 too_many_children->data ()->child_data.push_back(NULLPTR);
445- ASSERT_RAISES_WITH_MESSAGE (
453+ EXPECT_RAISES_WITH_MESSAGE_THAT (
446454 Invalid,
447- std::string (" Invalid: Expected 2 child arrays in array of type "
448- " run_end_encoded<run_ends: " ) +
449- run_end_type->ToString() + ", values: string>, got 3",
455+ ::testing::HasSubstr (
456+ std::string (" Invalid: Expected 2 child arrays in array of type "
457+ " run_end_encoded<run_ends: " ) +
458+ run_end_type->ToString() + ", values: string>, got 3"),
450459 too_many_children->Validate());
451460
452461 auto run_ends_nullptr = MakeArray(good_array->data ()->Copy());
453462 run_ends_nullptr->data ()->child_data[0] = NULLPTR;
454- ASSERT_RAISES_WITH_MESSAGE (Invalid, " Invalid: Run ends array is null pointer" ,
455- run_ends_nullptr->Validate ());
463+ EXPECT_RAISES_WITH_MESSAGE_THAT (
464+ Invalid, ::testing::HasSubstr(" Invalid: Run ends array is null pointer" ),
465+ run_ends_nullptr->Validate());
456466
457467 auto values_nullptr = MakeArray(good_array->data ()->Copy());
458468 values_nullptr->data ()->child_data[1] = NULLPTR;
459- ASSERT_RAISES_WITH_MESSAGE (Invalid, " Invalid: Values array is null pointer" ,
460- values_nullptr->Validate ());
469+ EXPECT_RAISES_WITH_MESSAGE_THAT (
470+ Invalid, ::testing::HasSubstr(" Invalid: Values array is null pointer" ),
471+ values_nullptr->Validate());
461472
462473 auto run_ends_string = MakeArray(good_array->data ()->Copy());
463474 run_ends_string->data ()->child_data[0] = values->data();
464- ASSERT_RAISES_WITH_MESSAGE (
475+ EXPECT_RAISES_WITH_MESSAGE_THAT (
465476 Invalid,
466- std::string (" Invalid: Run ends array of run_end_encoded<run_ends: " ) +
477+ ::testing::HasSubstr (
478+ std::string (" Invalid: Run ends array of run_end_encoded<run_ends: " ) +
467479 run_end_type->ToString() + ", values: string> must be " +
468- run_end_type->ToString() + ", but run end type is string",
480+ run_end_type->ToString() + ", but run end type is string") ,
469481 run_ends_string->Validate());
470482
471483 auto wrong_type = MakeArray(good_array->data ()->Copy());
472484 wrong_type->data ()->type = run_end_encoded(run_end_type, uint16());
473- ASSERT_RAISES_WITH_MESSAGE (Invalid,
474- " Invalid: Parent type says this array encodes uint16 "
475- " values, but value type is string" ,
476- wrong_type->Validate ());
485+ EXPECT_RAISES_WITH_MESSAGE_THAT (
486+ Invalid,
487+ ::testing::HasSubstr (" Invalid: Parent type says this array encodes uint16 "
488+ " values, but value type is string" ),
489+ wrong_type->Validate());
477490
478491 {
479492 // malformed_array has its buffers deallocated after the RunEndEncodedArray is
@@ -506,37 +519,42 @@ TEST_P(TestRunEndEncodedArray, Validate) {
506519 ASSERT_OK_AND_ASSIGN (std::shared_ptr<Array> run_end_zero_array,
507520 RunEndEncodedArray::Make (40 , run_ends_with_zero, values));
508521 ASSERT_OK (run_end_zero_array->Validate ());
509- ASSERT_RAISES_WITH_MESSAGE (
510- Invalid, " Invalid: All run ends must be greater than 0 but the first run end is 0" ,
522+ EXPECT_RAISES_WITH_MESSAGE_THAT (
523+ Invalid,
524+ ::testing::HasSubstr (
525+ " Invalid: All run ends must be greater than 0 but the first run end is 0" ),
511526 run_end_zero_array->ValidateFull());
512527 // The whole run ends array has to be valid even if the parent is sliced
513528 run_end_zero_array = run_end_zero_array->Slice (30 , 0 );
514- ASSERT_RAISES_WITH_MESSAGE (
515- Invalid, " Invalid: All run ends must be greater than 0 but the first run end is 0" ,
529+ EXPECT_RAISES_WITH_MESSAGE_THAT (
530+ Invalid,
531+ ::testing::HasSubstr (
532+ " Invalid: All run ends must be greater than 0 but the first run end is 0" ),
516533 run_end_zero_array->ValidateFull());
517534
518535 ASSERT_OK_AND_ASSIGN (std::shared_ptr<Array> run_ends_not_ordered_array,
519536 RunEndEncodedArray::Make (40 , run_ends_not_ordered, values));
520537 ASSERT_OK (run_ends_not_ordered_array->Validate ());
521- ASSERT_RAISES_WITH_MESSAGE (
538+ EXPECT_RAISES_WITH_MESSAGE_THAT (
522539 Invalid,
523- " Invalid: Every run end must be strictly greater than the previous run end, but "
524- " run_ends[3] is 40 and run_ends[2] is 40" ,
540+ ::testing::HasSubstr (" Invalid: Every run end must be strictly greater than the "
541+ " previous run end, but "
542+ " run_ends[3] is 40 and run_ends[2] is 40" ),
525543 run_ends_not_ordered_array->ValidateFull());
526544 // The whole run ends array has to be valid even if the parent is sliced
527545 run_ends_not_ordered_array = run_ends_not_ordered_array->Slice (30 , 0 );
528- ASSERT_RAISES_WITH_MESSAGE (
546+ EXPECT_RAISES_WITH_MESSAGE_THAT (
529547 Invalid,
530- " Invalid: Every run end must be strictly greater than the previous run end, but "
531- " run_ends[3] is 40 and run_ends[2] is 40" ,
548+ ::testing::HasSubstr (" Invalid: Every run end must be strictly greater than the "
549+ " previous run end, but "
550+ " run_ends[3] is 40 and run_ends[2] is 40" ),
532551 run_ends_not_ordered_array->ValidateFull());
533552
534- ASSERT_OK_AND_ASSIGN (auto run_ends_too_low_array,
535- RunEndEncodedArray::Make (40 , run_ends_too_low, values));
536- ASSERT_RAISES_WITH_MESSAGE (Invalid,
537- " Invalid: Last run end is 39 but it should match 40"
538- " (offset: 0, length: 40)" ,
539- run_ends_too_low_array->Validate ());
553+ EXPECT_RAISES_WITH_MESSAGE_THAT (
554+ Invalid,
555+ ::testing::HasSubstr (" Invalid: Last run end is 39 but it should match 40"
556+ " (offset: 0, length: 40)" ),
557+ RunEndEncodedArray::Make(40 , run_ends_too_low, values));
540558}
541559
542560TEST_P (TestRunEndEncodedArray, Compare) {
@@ -613,12 +631,13 @@ TEST_P(TestRunEndEncodedArray, Concatenate) {
613631 default_memory_pool ()));
614632 ASSERT_ARRAYS_EQUAL (*empty_array, *result);
615633
616- ASSERT_RAISES_WITH_MESSAGE (
634+ EXPECT_RAISES_WITH_MESSAGE_THAT (
617635 Invalid,
618- std::string (" Invalid: arrays to be concatenated must be identically typed, but "
619- " run_end_encoded<run_ends: " ) +
636+ ::testing::HasSubstr (
637+ std::string (" Invalid: arrays to be concatenated must be identically typed, but "
638+ " run_end_encoded<run_ends: " ) +
620639 run_end_type->ToString() + ", values: int32> and run_end_encoded<run_ends: " +
621- run_end_type->ToString () + " , values: string> were encountered." ,
640+ run_end_type->ToString() + ", values: string> were encountered.") ,
622641 Concatenate({int32_array, string_array}, default_memory_pool()));
623642}
624643
0 commit comments