| 42 | }; |
| 43 | |
| 44 | TEST_F(chimp_test, test_chimp) { |
| 45 | for (auto& dataset : alp_bench::get_alp_dataset()) { |
| 46 | std::ifstream ifile(dataset.csv_file_path, std::ios::in); |
| 47 | ASSERT_EQ(ifile.fail(), false); |
| 48 | |
| 49 | // Read Data |
| 50 | double num = 0.0; |
| 51 | // keep storing values from the text file so long as data exists: |
| 52 | size_t c {0}; |
| 53 | while (ifile >> num) { |
| 54 | dbl_arr[c] = num; |
| 55 | c = c + 1; |
| 56 | } |
| 57 | |
| 58 | // Init Encoding |
| 59 | state.Reset(); |
| 60 | state.output.SetStream(data_arr); |
| 61 | state.leading_zero_buffer.SetBuffer(leading_zero_arr); |
| 62 | state.flag_buffer.SetBuffer(flags_arr); |
| 63 | |
| 64 | /* |
| 65 | * |
| 66 | * Encode |
| 67 | * |
| 68 | */ |
| 69 | uint64_p = reinterpret_cast<uint64_t*>(dbl_arr); |
| 70 | for (size_t i {0}; i < 1024; ++i) { |
| 71 | alp_bench::ChimpCompression<uint64_t, false>::Store(uint64_p[i], state); |
| 72 | } |
| 73 | |
| 74 | state.Flush(); |
| 75 | state.output.Flush(); |
| 76 | |
| 77 | // Init decoding |
| 78 | leading_zero_block_count = state.leading_zero_buffer.BlockCount(); |
| 79 | leading_zero_block_size = static_cast<int64_t>(leading_zero_block_count) * 8; |
| 80 | leading_zero_index = 0; |
| 81 | chimp_de_state.input.SetStream(data_arr); |
| 82 | flag_buffer.SetBuffer(flags_arr); |
| 83 | leading_zero_buffer.SetBuffer(leading_zero_arr); |
| 84 | |
| 85 | /* |
| 86 | * |
| 87 | * DECODE |
| 88 | * |
| 89 | */ |
| 90 | flags[0] = alp_bench::ChimpConstants::Flags::VALUE_IDENTICAL; // First value doesn't require a flag |
| 91 | for (idx_t i = 0; i < 1023; i++) { |
| 92 | flags[1 + i] = (alp_bench::ChimpConstants::Flags)flag_buffer.Extract(); |
| 93 | } |
| 94 | |
| 95 | for (idx_t i = 0; i < leading_zero_block_size; i++) { |
| 96 | leading_zero_unpacked[i] = |
| 97 | alp_bench::ChimpConstants::Decompression::LEADING_REPRESENTATION[leading_zero_buffer.Extract()]; |
| 98 | } |
| 99 | |
| 100 | for (idx_t i = 0; i < 1024; i++) { |
| 101 | dec_arr[i] = alp_bench::ChimpDecompression<uint64_t>::Load( |
nothing calls this directly
no test coverage detected