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

Function TEST_F

publication/source_code/test/test_gorillas.cpp:35–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33};
34
35TEST_F(gorillas_test, test_gorillas) {
36 for (auto& dataset : alp_bench::get_alp_dataset()) {
37 std::ifstream ifile(dataset.csv_file_path, std::ios::in);
38 ASSERT_EQ(ifile.fail(), false);
39
40 // Read Data
41 double num = 0.0;
42 // keep storing values from the text file so long as data exists:
43 size_t c {0};
44 while (ifile >> num) {
45 dbl_arr[c] = num;
46 c = c + 1;
47 }
48
49 // Init Encoding
50 state.Reset();
51 state.output.SetStream(data_arr);
52 state.flag_buffer.SetBuffer(flags_arr);
53
54 /*
55 *
56 * Encode
57 *
58 */
59 uint64_p = reinterpret_cast<uint64_t*>(dbl_arr);
60 for (size_t i {0}; i < 1024; ++i) {
61 alp_bench::GorillasCompression<uint64_t, false>::Store(uint64_p[i], state);
62 }
63
64 state.Flush();
65 state.output.Flush();
66
67 // Init decoding
68 gorillas_de_state.input.SetStream(data_arr);
69 flag_buffer.SetBuffer(flags_arr);
70
71 /*
72 *
73 * DECODE
74 *
75 */
76 flags[0] = alp_bench::GorillasConstants::Flags::VALUE_IDENTICAL; // First value doesn't require a flag
77 for (idx_t i = 0; i < 1023; i++) {
78 flags[1 + i] = (alp_bench::GorillasConstants::Flags)flag_buffer.Extract();
79 }
80
81 for (idx_t i = 0; i < 1024; i++) {
82 dec_arr[i] = alp_bench::GorillasDecompression<uint64_t>::Load(flags[i], gorillas_de_state);
83 }
84 gorillas_de_state.Reset();
85
86 dec_dbl_p = reinterpret_cast<double*>(dec_arr);
87
88 for (size_t i = 0; i < 1024; ++i) {
89 auto l = dbl_arr[i];
90 auto r = dec_dbl_p[i];
91 if (l != r) { std::cerr << l << ", " << r << dataset.name << "\n"; }
92

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected