emkornfield commented on a change in pull request #9582: URL: https://github.com/apache/arrow/pull/9582#discussion_r584864172
########## File path: cpp/src/parquet/statistics_test.cc ########## @@ -111,21 +117,28 @@ TEST(Comparison, UnsignedByteArray) { } TEST(Comparison, SignedFLBA) { - int size = 10; + int size = 4; auto comparator = MakeComparator<FLBAType>(Type::FIXED_LEN_BYTE_ARRAY, SortOrder::SIGNED, size); - std::string s1 = "Anti123456"; - std::string s2 = "Bunkd123456"; - FLBA s1flba = FLBAFromString(s1); - FLBA s2flba = FLBAFromString(s2); - ASSERT_TRUE(comparator->Compare(s1flba, s2flba)); + std::vector<uint8_t> byte_values[] = { + {0x80, 0, 0, 0}, {0xFF, 0xFF, 0x01, 0}, {0xFF, 0xFF, 0x80, 0}, + {0xFF, 0xFF, 0xFF, 0x80}, {0xFF, 0xFF, 0xFF, 0xFF}, {0, 0, 0x01, 0x01}, + {0, 0x01, 0x01, 0}, {0x01, 0x01, 0, 0}}; + std::vector<FLBA> values_to_compare; + for (auto& bytes : byte_values) { + values_to_compare.emplace_back(FLBA(bytes.data())); + } - s1 = "Bünk123456"; - s2 = "Bunk123456"; - s1flba = FLBAFromString(s1); - s2flba = FLBAFromString(s2); - ASSERT_TRUE(comparator->Compare(s1flba, s2flba)); + for (size_t x = 0; x < values_to_compare.size(); x++) { + EXPECT_FALSE(comparator->Compare(values_to_compare[x], values_to_compare[x])) << x; + for (size_t y = x + 1; y < values_to_compare.size(); y++) { + EXPECT_TRUE(comparator->Compare(values_to_compare[x], values_to_compare[y])) + << x << " " << y; + EXPECT_FALSE(comparator->Compare(values_to_compare[y], values_to_compare[x])) + << y << " " << x; + } + } Review comment: I think for FLBA these tests should be fairly complete. the bytes can be interepreted as big-endian two's complement number. I think I need to add an additional case that covers sign extension equality from the example I gave above. Is your concern upon representation here? Or would you like me to explicitly use util::Decimal* classes for the test cases? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org