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

Function TEST_F

publication/source_code/test/test_patas.cpp:44–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42};
43
44TEST_F(patas_test, one_vec) {
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 patas_state.Reset();
60 patas_state.SetOutputBuffer(data_arr);
61 patas_state.packed_data_buffer.SetBuffer(packed_metadata);
62
63 /*
64 *
65 * Encode
66 *
67 */
68 uint64_p = reinterpret_cast<uint64_t*>(dbl_arr);
69 for (size_t i {0}; i < 1024; ++i) {
70 alp_bench::patas::PatasCompression<uint64_t, false>::Store(uint64_p[i], patas_state);
71 }
72
73 // Init decoding
74 byte_reader.SetStream(data_arr);
75
76 /*
77 *
78 * DECODE
79 *
80 */
81
82 // UNPACKING METADATA (16 bits - 3 bytes)
83 for (idx_t i = 0; i < 1024; i++) {
84 alp_bench::PackedDataUtils<uint64_t>::Unpack(((uint16_t*)packed_metadata)[i],
85 (alp_bench::UnpackedData&)unpacked_data[i]);
86 }
87
88 // USING UNPACKED METADATA AND DATA BUFFER WE LOAD THE DOUBLE VALUES
89 dec_arr[0] = (uint64_t)0; // Not sure why without this, it does not work on the > 2nd iteration...
90 for (idx_t i = 0; i < 1024; i++) {
91 dec_arr[i] = alp_bench::patas::PatasDecompression<uint64_t>::DecompressValue(
92 byte_reader,
93 unpacked_data[i].significant_bytes,
94 unpacked_data[i].trailing_zeros,
95 dec_arr[i - unpacked_data[i].index_diff]);
96 }
97
98 dec_dbl_p = reinterpret_cast<double*>(dec_arr);
99
100 std::cout << dataset.name << std::endl;
101 for (size_t i = 0; i < 1024; ++i) {

Callers

nothing calls this directly

Calls 7

get_alp_datasetFunction · 0.85
StoreFunction · 0.85
SetOutputBufferMethod · 0.80
closeMethod · 0.65
ResetMethod · 0.45
SetBufferMethod · 0.45
SetStreamMethod · 0.45

Tested by

no test coverage detected