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

Function TEST

publication/source_code/bench_end_to_end/src/test/tpch.cpp:37–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37TEST(TPCH, q1) {
38 configFromEnv();
39 using namespace types;
40 std::map<tuple<Char<1>, Char<1>>, tuple<Numeric<12, 2>, Numeric<12, 2>, Numeric<12, 4>, Numeric<12, 6>, int64_t>>
41 expected = {{make_tuple(Char<1>::castString("A"), Char<1>::castString("F")),
42 make_tuple(Numeric<12, 2>::castString("37734107.00"),
43 Numeric<12, 2>::castString("56586554400.73"),
44 Numeric<12, 4>::castString("53758257134.8700"),
45 Numeric<12, 6>::castString("55909065222.827692"),
46 1478493)},
47
48 {make_tuple(Char<1>::castString("N"), Char<1>::castString("F")),
49 make_tuple(Numeric<12, 2>::castString("991417.00"),
50 Numeric<12, 2>::castString("1487504710.38"),
51 Numeric<12, 4>::castString("1413082168.0541"),
52 Numeric<12, 6>::castString("1469649223.194375"),
53 38854)},
54
55 {make_tuple(Char<1>::castString("N"), Char<1>::castString("O")),
56 make_tuple(Numeric<12, 2>::castString("74476040.00"),
57 Numeric<12, 2>::castString("111701729697.74"),
58 Numeric<12, 4>::castString("106118230307.6056"),
59 Numeric<12, 6>::castString("110367043872.497010"),
60 2920374)},
61
62 {make_tuple(Char<1>::castString("R"), Char<1>::castString("F")),
63 make_tuple(Numeric<12, 2>::castString("37719753.00"),
64 Numeric<12, 2>::castString("56568041380.90"),
65 Numeric<12, 4>::castString("53741292684.6040"),
66 Numeric<12, 6>::castString("55889619119.831932"),
67 1478870)}};
68
69 auto checkResult = [&](BlockRelation* result) {
70 size_t found = 0;
71 auto retAttr = result->getAttribute("l_returnflag");
72 auto statusAttr = result->getAttribute("l_linestatus");
73 auto qtyAttr = result->getAttribute("sum_qty");
74 auto base_priceAttr = result->getAttribute("sum_base_price");
75 auto disc_priceAttr = result->getAttribute("sum_disc_price");
76 auto chargeAttr = result->getAttribute("sum_charge");
77 auto count_orderAttr = result->getAttribute("count_order");
78 for (auto& block : *result) {
79 auto elementsInBlock = block.size();
80 found += elementsInBlock;
81 auto ret = reinterpret_cast<Char<1>*>(block.data(retAttr));
82 auto status = reinterpret_cast<Char<1>*>(block.data(statusAttr));
83 auto qty = reinterpret_cast<Numeric<12, 2>*>(block.data(qtyAttr));
84 auto base_price = reinterpret_cast<Numeric<12, 2>*>(block.data(base_priceAttr));
85 auto disc_price = reinterpret_cast<Numeric<12, 4>*>(block.data(disc_priceAttr));
86 auto charge = reinterpret_cast<Numeric<12, 6>*>(block.data(chargeAttr));
87 auto count_order = reinterpret_cast<int64_t*>(block.data(count_orderAttr));
88 for (size_t i = 0; i < elementsInBlock; ++i) {
89 auto& exValues = expected[make_tuple(ret[i], status[i])];
90 ASSERT_EQ(qty[i], get<0>(exValues));
91 ASSERT_EQ(base_price[i], get<1>(exValues));
92 ASSERT_EQ(disc_price[i], get<2>(exValues));
93 ASSERT_EQ(charge[i], get<3>(exValues));
94 ASSERT_EQ(count_order[i], get<4>(exValues));

Callers

nothing calls this directly

Calls 15

q1_vectorwiseFunction · 0.85
q3_expectedFunction · 0.85
q3_vectorwiseFunction · 0.85
q5_vectorwiseFunction · 0.85
q6_hyperFunction · 0.85
q6_vectorwiseFunction · 0.85
q9_hyperFunction · 0.85
q9_vectorwiseFunction · 0.85
q18_vectorwiseFunction · 0.85
getAttributeMethod · 0.80
configFromEnvFunction · 0.70
getThreadsFunction · 0.70

Tested by

no test coverage detected