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

Function TEST_F

publication/source_code/test/test_chimp.cpp:44–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42};
43
44TEST_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(

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