| 1623 | |
| 1624 | template <typename Type> |
| 1625 | void TestByteStreamSplitEncoding<Type>::CheckEncode() { |
| 1626 | if constexpr (std::is_same_v<c_type, FLBA>) { |
| 1627 | // FIXED_LEN_BYTE_ARRAY |
| 1628 | // - type_length = 3 |
| 1629 | { |
| 1630 | const std::vector<uint8_t> raw_data{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, |
| 1631 | 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC}; |
| 1632 | const std::vector<FLBA> data{FLBA{&raw_data[0]}, FLBA{&raw_data[3]}, |
| 1633 | FLBA{&raw_data[6]}, FLBA{&raw_data[9]}}; |
| 1634 | const std::vector<uint8_t> expected_output{0x11, 0x44, 0x77, 0xAA, 0x22, 0x55, |
| 1635 | 0x88, 0xBB, 0x33, 0x66, 0x99, 0xCC}; |
| 1636 | CheckEncode(std::span{data}, std::span{expected_output}, |
| 1637 | FLBAColumnDescriptor(3).get()); |
| 1638 | } |
| 1639 | // - type_length = 1 |
| 1640 | { |
| 1641 | const std::vector<uint8_t> raw_data{0x11, 0x22, 0x33}; |
| 1642 | const std::vector<FLBA> data{FLBA{&raw_data[0]}, FLBA{&raw_data[1]}, |
| 1643 | FLBA{&raw_data[2]}}; |
| 1644 | const std::vector<uint8_t> expected_output{0x11, 0x22, 0x33}; |
| 1645 | CheckEncode(std::span{data}, std::span{expected_output}, |
| 1646 | FLBAColumnDescriptor(1).get()); |
| 1647 | } |
| 1648 | } else if constexpr (sizeof(c_type) == 4) { |
| 1649 | // INT32, FLOAT |
| 1650 | const auto data = ToLittleEndian<uint32_t>({0xaabbccddUL, 0x11223344UL}); |
| 1651 | const std::vector<uint8_t> expected_output{0xdd, 0x44, 0xcc, 0x33, |
| 1652 | 0xbb, 0x22, 0xaa, 0x11}; |
| 1653 | CheckEncode(std::span{data}, std::span{expected_output}); |
| 1654 | } else { |
| 1655 | // INT64, DOUBLE |
| 1656 | const auto data = ToLittleEndian<uint64_t>( |
| 1657 | {0x4142434445464748ULL, 0x0102030405060708ULL, 0xb1b2b3b4b5b6b7b8ULL}); |
| 1658 | const std::vector<uint8_t> expected_output{ |
| 1659 | 0x48, 0x08, 0xb8, 0x47, 0x07, 0xb7, 0x46, 0x06, 0xb6, 0x45, 0x05, 0xb5, |
| 1660 | 0x44, 0x04, 0xb4, 0x43, 0x03, 0xb3, 0x42, 0x02, 0xb2, 0x41, 0x01, 0xb1, |
| 1661 | }; |
| 1662 | CheckEncode(std::span{data}, std::span{expected_output}); |
| 1663 | } |
| 1664 | } |
| 1665 | |
| 1666 | using ByteStreamSplitTypes = |
| 1667 | ::testing::Types<Int32Type, Int64Type, FloatType, DoubleType, FLBAType>; |
no test coverage detected