| 28 | }; |
| 29 | |
| 30 | TEST_F(SingleColumnCodecTest, TestEncodec) { |
| 31 | std::vector<std::string> vec; |
| 32 | {// encode part |
| 33 | {std::string val_1 = ""; |
| 34 | val_1.resize(1); |
| 35 | char* buf = const_cast<char*>(val_1.data()); |
| 36 | ::fedb::codec::Convert(true, buf); |
| 37 | vec.push_back(val_1); |
| 38 | } |
| 39 | { |
| 40 | std::string val_2 = ""; |
| 41 | val_2.resize(1); |
| 42 | char* buf = const_cast<char*>(val_2.data()); |
| 43 | ::fedb::codec::Convert(false, buf); |
| 44 | vec.push_back(val_2); |
| 45 | } |
| 46 | { |
| 47 | int16_t int16_val = 33; |
| 48 | std::string val_3 = ""; |
| 49 | val_3.resize(2); |
| 50 | char* buf = const_cast<char*>(val_3.data()); |
| 51 | ::fedb::codec::Convert(int16_val, buf); |
| 52 | vec.push_back(val_3); |
| 53 | } |
| 54 | { |
| 55 | int32_t int32_val = 44; |
| 56 | std::string val_4 = ""; |
| 57 | val_4.resize(4); |
| 58 | char* buf = const_cast<char*>(val_4.data()); |
| 59 | ::fedb::codec::Convert(int32_val, buf); |
| 60 | vec.push_back(val_4); |
| 61 | } |
| 62 | { |
| 63 | int64_t int64_val = 55; |
| 64 | std::string val_5 = ""; |
| 65 | val_5.resize(8); |
| 66 | char* buf = const_cast<char*>(val_5.data()); |
| 67 | ::fedb::codec::Convert(int64_val, buf); |
| 68 | vec.push_back(val_5); |
| 69 | } |
| 70 | { |
| 71 | float float_val = 3.3; |
| 72 | std::string val_6 = ""; |
| 73 | val_6.resize(4); |
| 74 | char* buf = const_cast<char*>(val_6.data()); |
| 75 | ::fedb::codec::Convert(float_val, buf); |
| 76 | vec.push_back(val_6); |
| 77 | } |
| 78 | { |
| 79 | double double_val = 4.4; |
| 80 | std::string val_7 = ""; |
| 81 | val_7.resize(8); |
| 82 | char* buf = const_cast<char*>(val_7.data()); |
| 83 | ::fedb::codec::Convert(double_val, buf); |
| 84 | vec.push_back(val_7); |
| 85 | } |
| 86 | } // namespace base |
| 87 | { |