MCPcopy Create free account
hub / github.com/cwida/ALP / TEST_F

Function TEST_F

publication/source_code/test/test_chimp128.cpp:58–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56};
57
58TEST_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()];

Callers

nothing calls this directly

Calls 10

get_alp_datasetFunction · 0.85
StoreFunction · 0.85
LoadFunction · 0.85
BlockCountMethod · 0.80
closeMethod · 0.65
ResetMethod · 0.45
SetStreamMethod · 0.45
SetBufferMethod · 0.45
FlushMethod · 0.45
ExtractMethod · 0.45

Tested by

no test coverage detected