| 56 | }; |
| 57 | |
| 58 | TEST_F(chimp128_test, test_chimp) { |
| 59 | for (auto& dataset : alp_bench::get_alp_dataset()) { |
| 60 | std::ifstream ifile(dataset.csv_file_path, std::ios::in); |
| 61 | ASSERT_EQ(ifile.fail(), false); |
| 62 | |
| 63 | // Read Data |
| 64 | double num = 0.0; |
| 65 | // keep storing values from the text file so long as data exists: |
| 66 | size_t c {0}; |
| 67 | while (ifile >> num) { |
| 68 | dbl_arr[c] = num; |
| 69 | c = c + 1; |
| 70 | } |
| 71 | |
| 72 | // Init Encoding |
| 73 | com_stt.Reset(); |
| 74 | com_stt.output.SetStream(data_arr); |
| 75 | com_stt.leading_zero_buffer.SetBuffer(leading_zero_arr); |
| 76 | com_stt.flag_buffer.SetBuffer(flags_arr); |
| 77 | com_stt.packed_data_buffer.SetBuffer(packed_data_arr); |
| 78 | |
| 79 | /* |
| 80 | * |
| 81 | * Encode |
| 82 | * |
| 83 | */ |
| 84 | uint64_p = reinterpret_cast<uint64_t*>(dbl_arr); |
| 85 | for (size_t i {0}; i < 1024; ++i) { |
| 86 | alp_bench::Chimp128Compression<uint64_t, false>::Store(uint64_p[i], com_stt); |
| 87 | } |
| 88 | com_stt.Flush(); |
| 89 | com_stt.output.Flush(); |
| 90 | |
| 91 | // Init decoding |
| 92 | leading_zero_block_count = com_stt.leading_zero_buffer.BlockCount(); |
| 93 | leading_zero_block_size = static_cast<idx_t>(leading_zero_block_count) * 8; |
| 94 | unpacked_index = 0; |
| 95 | leading_zero_index = 0; |
| 96 | chimp_de_state.input.SetStream(data_arr); |
| 97 | flag_buffer.SetBuffer(flags_arr); |
| 98 | leading_zero_buffer.SetBuffer(leading_zero_arr); |
| 99 | |
| 100 | /* |
| 101 | * |
| 102 | * DECODE |
| 103 | * |
| 104 | */ |
| 105 | |
| 106 | // Decode flags |
| 107 | flags[0] = alp_bench::ChimpConstants::Flags::VALUE_IDENTICAL; // First value doesn't require a flag |
| 108 | for (idx_t i = 0; i < 1023; i++) { |
| 109 | flags[1 + i] = (alp_bench::ChimpConstants::Flags)flag_buffer.Extract(); |
| 110 | } |
| 111 | |
| 112 | // Decode leading zero |
| 113 | for (idx_t i = 0; i < leading_zero_block_size; i++) { |
| 114 | leading_zero_unpacked[i] = |
| 115 | alp_bench::ChimpConstants::Decompression::LEADING_REPRESENTATION[leading_zero_buffer.Extract()]; |
nothing calls this directly
no test coverage detected