GCC Code Coverage Report


Directory: ./
File: openvdb_ax/openvdb_ax/test/integration/TestBinary.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 595 595 100.0%
Functions: 159 159 100.0%
Branches: 966 1832 52.7%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include "TestHarness.h"
5
6 #include "../util.h"
7
8 #include <cppunit/extensions/HelperMacros.h>
9
10 using namespace openvdb::points;
11
12 // Configuration values for binary code
13
14 static const unittest_util::ConfigMap integral = {
15 { "bool", { { "_L1_", "true" }, { "_L2_", "false" } } },
16 { "int16", { { "_L1_", "2" }, { "_L2_", "3" } } },
17 { "int32", { { "_L1_", "2" }, { "_L2_", "3" } } },
18 { "int64", { { "_L1_", "2l" }, { "_L2_", "3l" } } }
19 };
20
21 static const unittest_util::ConfigMap floating = {
22 { "float", { { "_L1_", "1.1f" }, { "_L2_", "2.3f" } } },
23 { "double", { { "_L1_", "1.1" }, { "_L2_", "2.3" } } }
24 };
25
26 static const unittest_util::ConfigMap vec2 = {
27 { "vec2i", { { "_L1_", "{1, 2}" }, { "_L2_", "{3, 4}" } } },
28 { "vec2f", { { "_L1_", "{1.1f, 2.3f}" }, { "_L2_", "{4.1f, 5.3f}" } } },
29 { "vec2d", { { "_L1_", "{1.1, 2.3}" }, { "_L2_", "{4.1, 5.3}" } } }
30 };
31
32 static const unittest_util::ConfigMap vec3 = {
33 { "vec3i", { { "_L1_", "{1, 2, 3}" }, { "_L2_", "{4, 5, 6}" } } },
34 { "vec3f", { { "_L1_", "{1.1f, 2.3f, 4.3f}" }, { "_L2_", "{4.1f, 5.3f, 6.3f}" } } },
35 { "vec3d", { { "_L1_", "{1.1, 2.3 , 4.3}" }, { "_L2_", "{4.1, 5.3, 6.3}" } } }
36 };
37
38 static const unittest_util::ConfigMap vec4 = {
39 { "vec4i", { { "_L1_", "{1, 2, 3, 4}" }, { "_L2_", "{5, 6, 7, 8}" } } },
40 { "vec4f", { { "_L1_", "{1.1f, 2.3f, 4.3f, 5.4f}" }, { "_L2_", "{5.1f, 6.3f, 7.3f, 8.4f}" } } },
41 { "vec4d", { { "_L1_", "{1.1, 2.3, 4.3, 5.4}" }, { "_L2_", "{5.1, 6.3, 7.3, 8.4}" } } }
42 };
43
44 static const unittest_util::ConfigMap mat3 = {
45 { "mat3f", { { "_L1_", "{1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f }" },
46 { "_L2_", "{9.1f, 7.3f, -1.3f, 4.4f, -6.7f, 0.8f, 9.1f,-0.5f, 8.2f }" } }
47 },
48 { "mat3d", { { "_L1_", "{1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2 }" },
49 { "_L2_", "{9.1, 7.3, -1.3, 4.4, -6.7, 0.8, 9.1,-0.5, 8.2 }" } }
50 }
51 };
52
53 static const unittest_util::ConfigMap mat4 = {
54 { "mat4f", { { "_L1_", "{1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 3.3f, 2.9f, 5.9f, 0.1f, 0.3f, 5.1f, 1.9f}" },
55 { "_L2_", "{0.1f, 2.3f,-9.3f, 4.5f, -1.7f, 7.8f, 2.1f, 3.3f, 3.3f,-3.3f,-0.3f, 2.5f, 5.1f, 0.5f, 8.1f,-1.7f}" } }
56 },
57 { "mat4d", { { "_L1_", "{1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 3.3, 2.9, 5.9, 0.1, 0.3, 5.1, 1.9}" },
58 { "_L2_", "{0.1, 2.3,-9.3, 4.5, -1.7, 7.8, 2.1, 3.3, 3.3,-3.3,-0.3, 2.5, 5.1, 0.5, 8.1,-1.7}" } }
59 }
60 };
61
62 static const unittest_util::ConfigMap string = {
63 { "string", { { "_L1_", "\"foo\"" }, { "_L2_", "\"bar\"" } } }
64 };
65
66
67
2/4
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 18 times.
✗ Branch 4 not taken.
18 class TestBinary : public unittest_util::AXTestCase
68 {
69 public:
70
71
3/6
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 40 times.
✗ Branch 8 not taken.
120 std::string dir() const override { return GET_TEST_DIRECTORY(); }
72
73
3/6
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
4 CPPUNIT_TEST_SUITE(TestBinary);
74
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(plus);
75
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(minus);
76
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(mult);
77
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(div);
78
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(mod);
79
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(btand);
80
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(btor);
81
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(btxor);
82
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(logicaland);
83
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(logicalor);
84
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(equalsequals);
85
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(notequals);
86
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(greaterthan);
87
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(lessthan);
88
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(greaterthanequals);
89
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(lessthanequals);
90
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(shiftleft);
91
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
6 CPPUNIT_TEST(shiftright);
92
4/8
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
4 CPPUNIT_TEST_SUITE_END();
93
94 void plus();
95 void minus();
96 void mult();
97 void div();
98 void mod();
99 void btand();
100 void btor();
101 void btxor();
102 void logicaland();
103 void logicalor();
104 void equalsequals();
105 void notequals();
106 void greaterthan();
107 void lessthan();
108 void greaterthanequals();
109 void lessthanequals();
110 void shiftleft();
111 void shiftright();
112 };
113
114 CPPUNIT_TEST_SUITE_REGISTRATION(TestBinary);
115
116
117 void
118 1 TestBinary::plus()
119 {
120
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
121 _T1_@_A1_ = _L1_ + _L2_;)";
122
123 std::string repl;
124 8 auto generate = [&](const auto& map) {
125
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 8 times.
28 for (const auto& config : map) {
126
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 std::string tmp = code;
127
2/4
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
20 unittest_util::replace(tmp, "_T1_", config.first);
128
3/6
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
40 unittest_util::replace(tmp, "_A1_", "test" + config.first);
129
2/2
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 20 times.
60 for (const auto& settings : config.second) {
130
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 unittest_util::replace(tmp, settings.first, settings.second);
131 }
132
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 repl += tmp;
133 }
134 8 };
135
136
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
137
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
138
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec2);
139
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec3);
140
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec4);
141
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat3);
142
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat4);
143
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(string);
144
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_plus.ax");
145
146 const std::map<std::string, std::function<void()>> expected = {
147
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "bool", [&](){ mHarness.addAttribute<bool>("testbool", true); } },
148
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int16", [&](){ mHarness.addAttribute<int16_t>("testint16", 5); } },
149
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int32", [&](){ mHarness.addAttribute<int32_t>("testint32", 5); } },
150
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int64", [&](){ mHarness.addAttribute<int64_t>("testint64", 5); } },
151
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "float", [&](){ mHarness.addAttribute<float>("testfloat", 1.1f + 2.3f); } },
152
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "double", [&](){ mHarness.addAttribute<double>("testdouble", 1.1 + 2.3); } },
153
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2i", [&](){ mHarness.addAttribute<openvdb::math::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(4,6)); } },
154
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2f", [&](){ mHarness.addAttribute<openvdb::math::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(1.1f+4.1f, 2.3f+5.3f)); } },
155
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2d", [&](){ mHarness.addAttribute<openvdb::math::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(1.1+4.1, 2.3+5.3)); } },
156
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec3i", [&](){ mHarness.addAttribute<openvdb::math::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(5,7,9)); } },
157
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec3f", [&](){ mHarness.addAttribute<openvdb::math::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(1.1f+4.1f, 2.3f+5.3f, 4.3f+6.3f)); } },
158
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "vec3d", [&](){ mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(1.1+4.1, 2.3+5.3, 4.3+6.3)); } },
159
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec4i", [&](){ mHarness.addAttribute<openvdb::math::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(6,8,10,12)); } },
160
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec4f", [&](){ mHarness.addAttribute<openvdb::math::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(1.1f+5.1f, 2.3f+6.3f, 4.3f+7.3f, 5.4f+8.4f)); } },
161
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "vec4d", [&](){ mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(1.1+5.1, 2.3+6.3, 4.3+7.3, 5.4+8.4)); } },
162
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat3f", [&](){ mHarness.addAttribute<openvdb::math::Mat3<float>>("testmat3f",
163 1 openvdb::math::Mat3<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f) +
164 2 openvdb::math::Mat3<float>(9.1f, 7.3f,-1.3f, 4.4f,-6.7f, 0.8f, 9.1f,-0.5f, 8.2f)); }
165 },
166
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat3d", [&](){ mHarness.addAttribute<openvdb::math::Mat3<double>>("testmat3d",
167 1 openvdb::math::Mat3<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2) +
168 2 openvdb::math::Mat3<double>(9.1, 7.3,-1.3, 4.4,-6.7, 0.8, 9.1,-0.5, 8.2)); }
169 },
170
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat4f", [&](){ mHarness.addAttribute<openvdb::math::Mat4<float>>("testmat4f",
171 1 openvdb::math::Mat4<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 3.3f, 2.9f, 5.9f, 0.1f, 0.3f, 5.1f, 1.9f) +
172 2 openvdb::math::Mat4<float>(0.1f, 2.3f,-9.3f, 4.5f, -1.7f, 7.8f, 2.1f, 3.3f, 3.3f,-3.3f,-0.3f, 2.5f, 5.1f, 0.5f, 8.1f,-1.7f)); }
173 },
174
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat4d", [&](){ mHarness.addAttribute<openvdb::math::Mat4<double>>("testmat4d",
175 1 openvdb::math::Mat4<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 3.3, 2.9, 5.9, 0.1, 0.3, 5.1, 1.9) +
176 2 openvdb::math::Mat4<double>(0.1, 2.3,-9.3, 4.5, -1.7, 7.8, 2.1, 3.3, 3.3,-3.3,-0.3, 2.5, 5.1, 0.5, 8.1,-1.7)); }
177 },
178
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 { "string", [&](){ mHarness.addAttribute<std::string>("teststring", "foobar"); } }
179
21/44
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✓ Branch 62 taken 1 times.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
42 };
180
181
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
21 for (const auto& expc : expected) {
182
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 expc.second.operator()();
183 }
184
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_plus.ax");
185 1 }
186
187
188 void
189 1 TestBinary::minus()
190 {
191
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
192 _T1_@_A1_ = _L1_ - _L2_;)";
193
194 std::string repl;
195 7 auto generate = [&](const auto& map) {
196
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 7 times.
26 for (const auto& config : map) {
197
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 std::string tmp = code;
198
2/4
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
19 unittest_util::replace(tmp, "_T1_", config.first);
199
3/6
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 19 times.
✗ Branch 8 not taken.
38 unittest_util::replace(tmp, "_A1_", "test" + config.first);
200
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 19 times.
57 for (const auto& settings : config.second) {
201
1/2
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
38 unittest_util::replace(tmp, settings.first, settings.second);
202 }
203
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 repl += tmp;
204 }
205 7 };
206
207
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
208
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
209
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec2);
210
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec3);
211
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec4);
212
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat3);
213
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat4);
214
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_minus.ax");
215
216 const std::map<std::string, std::function<void()>> expected = {
217
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "bool", [&](){ mHarness.addAttribute<bool>("testbool", true); } },
218
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int16", [&](){ mHarness.addAttribute<int16_t>("testint16", -1); } },
219
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int32", [&](){ mHarness.addAttribute<int32_t>("testint32", -1); } },
220
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int64", [&](){ mHarness.addAttribute<int64_t>("testint64", -1); } },
221
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "float", [&](){ mHarness.addAttribute<float>("testfloat", 1.1f - 2.3f); } },
222
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "double", [&](){ mHarness.addAttribute<double>("testdouble", 1.1 - 2.3); } },
223
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2i", [&](){ mHarness.addAttribute<openvdb::math::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(-2,-2)); } },
224
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2f", [&](){ mHarness.addAttribute<openvdb::math::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(1.1f-4.1f, 2.3f-5.3f)); } },
225
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2d", [&](){ mHarness.addAttribute<openvdb::math::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(1.1-4.1, 2.3-5.3)); } },
226
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec3i", [&](){ mHarness.addAttribute<openvdb::math::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(-3,-3,-3)); } },
227
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec3f", [&](){ mHarness.addAttribute<openvdb::math::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(1.1f-4.1f, 2.3f-5.3f, 4.3f-6.3f)); } },
228
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "vec3d", [&](){ mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(1.1-4.1, 2.3-5.3, 4.3-6.3)); } },
229
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec4i", [&](){ mHarness.addAttribute<openvdb::math::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(-4,-4,-4,-4)); } },
230
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec4f", [&](){ mHarness.addAttribute<openvdb::math::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(1.1f-5.1f, 2.3f-6.3f, 4.3f-7.3f, 5.4f-8.4f)); } },
231
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "vec4d", [&](){ mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(1.1-5.1, 2.3-6.3, 4.3-7.3, 5.4-8.4)); } },
232
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat3f", [&](){ mHarness.addAttribute<openvdb::math::Mat3<float>>("testmat3f",
233 1 openvdb::math::Mat3<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f) -
234 2 openvdb::math::Mat3<float>(9.1f, 7.3f,-1.3f, 4.4f,-6.7f, 0.8f, 9.1f,-0.5f, 8.2f)); }
235 },
236
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat3d", [&](){ mHarness.addAttribute<openvdb::math::Mat3<double>>("testmat3d",
237 1 openvdb::math::Mat3<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2) -
238 2 openvdb::math::Mat3<double>(9.1, 7.3,-1.3, 4.4,-6.7, 0.8, 9.1,-0.5, 8.2)); }
239 },
240
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat4f", [&](){ mHarness.addAttribute<openvdb::math::Mat4<float>>("testmat4f",
241 1 openvdb::math::Mat4<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 3.3f, 2.9f, 5.9f, 0.1f, 0.3f, 5.1f, 1.9f) -
242 2 openvdb::math::Mat4<float>(0.1f, 2.3f,-9.3f, 4.5f, -1.7f, 7.8f, 2.1f, 3.3f, 3.3f,-3.3f,-0.3f, 2.5f, 5.1f, 0.5f, 8.1f,-1.7f)); }
243 },
244
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat4d", [&](){ mHarness.addAttribute<openvdb::math::Mat4<double>>("testmat4d",
245 1 openvdb::math::Mat4<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 3.3, 2.9, 5.9, 0.1, 0.3, 5.1, 1.9) -
246 2 openvdb::math::Mat4<double>(0.1, 2.3,-9.3, 4.5, -1.7, 7.8, 2.1, 3.3, 3.3,-3.3,-0.3, 2.5, 5.1, 0.5, 8.1,-1.7)); }
247 },
248
20/42
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✓ Branch 59 taken 1 times.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
40 };
249
250
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 1 times.
20 for (const auto& expc : expected) {
251
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 expc.second.operator()();
252 }
253
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_minus.ax");
254 1 }
255
256 void
257 1 TestBinary::mult()
258 {
259
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
260 _T1_@_A1_ = _L1_ * _L2_;)";
261
262 std::string repl;
263 7 auto generate = [&](const auto& map) {
264
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 7 times.
26 for (const auto& config : map) {
265
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 std::string tmp = code;
266
2/4
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
19 unittest_util::replace(tmp, "_T1_", config.first);
267
3/6
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 19 times.
✗ Branch 8 not taken.
38 unittest_util::replace(tmp, "_A1_", "test" + config.first);
268
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 19 times.
57 for (const auto& settings : config.second) {
269
1/2
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
38 unittest_util::replace(tmp, settings.first, settings.second);
270 }
271
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 repl += tmp;
272 }
273 7 };
274
275
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
276
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
277
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec2);
278
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec3);
279
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec4);
280
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat3);
281
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat4);
282
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_mult.ax");
283
284 const std::map<std::string, std::function<void()>> expected = {
285
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "bool", [&](){ mHarness.addAttribute<bool>("testbool", false); } },
286
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int16", [&](){ mHarness.addAttribute<int16_t>("testint16", 6); } },
287
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int32", [&](){ mHarness.addAttribute<int32_t>("testint32", 6); } },
288
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int64", [&](){ mHarness.addAttribute<int64_t>("testint64", 6); } },
289
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "float", [&](){ mHarness.addAttribute<float>("testfloat", 1.1f * 2.3f); } },
290
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "double", [&](){ mHarness.addAttribute<double>("testdouble", 1.1 * 2.3); } },
291
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2i", [&](){ mHarness.addAttribute<openvdb::math::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(3,8)); } },
292
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2f", [&](){ mHarness.addAttribute<openvdb::math::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(1.1f*4.1f, 2.3f*5.3f)); } },
293
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2d", [&](){ mHarness.addAttribute<openvdb::math::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(1.1*4.1, 2.3*5.3)); } },
294
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec3i", [&](){ mHarness.addAttribute<openvdb::math::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(4,10,18)); } },
295
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec3f", [&](){ mHarness.addAttribute<openvdb::math::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(1.1f*4.1f, 2.3f*5.3f, 4.3f*6.3f)); } },
296
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "vec3d", [&](){ mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(1.1*4.1, 2.3*5.3, 4.3*6.3)); } },
297
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec4i", [&](){ mHarness.addAttribute<openvdb::math::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(5,12,21,32)); } },
298
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec4f", [&](){ mHarness.addAttribute<openvdb::math::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(1.1f*5.1f, 2.3f*6.3f, 4.3f*7.3f, 5.4f*8.4f)); } },
299
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "vec4d", [&](){ mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(1.1*5.1, 2.3*6.3, 4.3*7.3, 5.4*8.4)); } },
300
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat3f", [&](){ mHarness.addAttribute<openvdb::math::Mat3<float>>("testmat3f",
301 1 openvdb::math::Mat3<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f) *
302 2 openvdb::math::Mat3<float>(9.1f, 7.3f,-1.3f, 4.4f,-6.7f, 0.8f, 9.1f,-0.5f, 8.2f)); }
303 },
304
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat3d", [&](){ mHarness.addAttribute<openvdb::math::Mat3<double>>("testmat3d",
305 1 openvdb::math::Mat3<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2) *
306 2 openvdb::math::Mat3<double>(9.1, 7.3,-1.3, 4.4,-6.7, 0.8, 9.1,-0.5, 8.2)); }
307 },
308
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat4f", [&](){ mHarness.addAttribute<openvdb::math::Mat4<float>>("testmat4f",
309 1 openvdb::math::Mat4<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 3.3f, 2.9f, 5.9f, 0.1f, 0.3f, 5.1f, 1.9f) *
310 2 openvdb::math::Mat4<float>(0.1f, 2.3f,-9.3f, 4.5f, -1.7f, 7.8f, 2.1f, 3.3f, 3.3f,-3.3f,-0.3f, 2.5f, 5.1f, 0.5f, 8.1f,-1.7f)); }
311 },
312
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 { "mat4d", [&](){ mHarness.addAttribute<openvdb::math::Mat4<double>>("testmat4d",
313 1 openvdb::math::Mat4<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 3.3, 2.9, 5.9, 0.1, 0.3, 5.1, 1.9) *
314 2 openvdb::math::Mat4<double>(0.1, 2.3,-9.3, 4.5, -1.7, 7.8, 2.1, 3.3, 3.3,-3.3,-0.3, 2.5, 5.1, 0.5, 8.1,-1.7)); }
315 }
316
20/42
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✓ Branch 59 taken 1 times.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
40 };
317
318
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 1 times.
20 for (const auto& expc : expected) {
319
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 expc.second.operator()();
320 }
321
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_mult.ax");
322 1 }
323
324
325 void
326 1 TestBinary::div()
327 {
328 // @note reverses L1 and L2 as L2 is usually larger
329
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
330 _T1_@_A1_ = _L2_ / _L1_;)";
331
332 std::string repl;
333 5 auto generate = [&](const auto& map) {
334
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 5 times.
20 for (const auto& config : map) {
335
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
15 std::string tmp = code;
336
2/4
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
15 unittest_util::replace(tmp, "_T1_", config.first);
337
3/6
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 15 times.
✗ Branch 8 not taken.
30 unittest_util::replace(tmp, "_A1_", "test" + config.first);
338
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 15 times.
45 for (const auto& settings : config.second) {
339
1/2
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
30 unittest_util::replace(tmp, settings.first, settings.second);
340 }
341
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
15 repl += tmp;
342 }
343 5 };
344
345
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
346
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
347
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec2);
348
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec3);
349
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec4);
350
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_div.ax");
351
352 const std::map<std::string, std::function<void()>> expected = {
353
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "bool", [&](){ mHarness.addAttribute<bool>("testbool", false); } },
354
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int16", [&](){ mHarness.addAttribute<int16_t>("testint16", 1); } },
355
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int32", [&](){ mHarness.addAttribute<int32_t>("testint32", 1); } },
356
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int64", [&](){ mHarness.addAttribute<int64_t>("testint64", 1); } },
357
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "float", [&](){ mHarness.addAttribute<float>("testfloat", 2.3f/1.1f); } },
358
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "double", [&](){ mHarness.addAttribute<double>("testdouble", 2.3/1.1); } },
359
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2i", [&](){ mHarness.addAttribute<openvdb::math::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(3,2)); } },
360
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2f", [&](){ mHarness.addAttribute<openvdb::math::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(4.1f/1.1f, 5.3f/2.3f)); } },
361
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2d", [&](){ mHarness.addAttribute<openvdb::math::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(4.1/1.1, 5.3/2.3)); } },
362
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec3i", [&](){ mHarness.addAttribute<openvdb::math::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(4,2,2)); } },
363
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec3f", [&](){ mHarness.addAttribute<openvdb::math::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(4.1f/1.1f, 5.3f/2.3f, 6.3f/4.3f)); } },
364
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "vec3d", [&](){ mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(4.1/1.1, 5.3/2.3, 6.3/4.3)); } },
365
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec4i", [&](){ mHarness.addAttribute<openvdb::math::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(5,3,2,2)); } },
366
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec4f", [&](){ mHarness.addAttribute<openvdb::math::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(5.1f/1.1f, 6.3f/2.3f, 7.3f/4.3f, 8.4f/5.4f)); } },
367
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "vec4d", [&](){ mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(5.1/1.1, 6.3/2.3, 7.3/4.3, 8.4/5.4)); } },
368
16/34
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✓ Branch 47 taken 1 times.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
32 };
369
370
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 1 times.
16 for (const auto& expc : expected) {
371
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
15 expc.second.operator()();
372 }
373
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_div.ax");
374 1 }
375
376
377 void
378 1 TestBinary::mod()
379 {
380 // @note reverses L1 and L2 as L2 is usually larger
381
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
382 _T1_@_A1_ = _L2_ % _L1_;)";
383
384 std::string repl;
385 5 auto generate = [&](const auto& map) {
386
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 5 times.
20 for (const auto& config : map) {
387
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
15 std::string tmp = code;
388
2/4
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
15 unittest_util::replace(tmp, "_T1_", config.first);
389
3/6
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 15 times.
✗ Branch 8 not taken.
30 unittest_util::replace(tmp, "_A1_", "test" + config.first);
390
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 15 times.
45 for (const auto& settings : config.second) {
391
1/2
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
30 unittest_util::replace(tmp, settings.first, settings.second);
392 }
393
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
15 repl += tmp;
394 }
395 5 };
396
397
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
398
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
399
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec2);
400
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec3);
401
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec4);
402
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_mod.ax");
403
404 const std::map<std::string, std::function<void()>> expected = {
405
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "bool", [&](){ mHarness.addAttribute<bool>("testbool", false); } },
406
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int16", [&](){ mHarness.addAttribute<int16_t>("testint16", 1); } },
407
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int32", [&](){ mHarness.addAttribute<int32_t>("testint32", 1); } },
408
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int64", [&](){ mHarness.addAttribute<int64_t>("testint64", 1); } },
409
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "float", [&](){ mHarness.addAttribute<float>("testfloat", std::fmod(2.3f,1.1f)); } },
410
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "double", [&](){ mHarness.addAttribute<double>("testdouble", std::fmod(2.3,1.1)); } },
411
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2i", [&](){ mHarness.addAttribute<openvdb::math::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(0,0)); } },
412
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2f", [&](){ mHarness.addAttribute<openvdb::math::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(std::fmod(4.1f,1.1f), std::fmod(5.3f,2.3f))); } },
413
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec2d", [&](){ mHarness.addAttribute<openvdb::math::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(std::fmod(4.1,1.1), std::fmod(5.3,2.3))); } },
414
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec3i", [&](){ mHarness.addAttribute<openvdb::math::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(0,1,0)); } },
415
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec3f", [&](){ mHarness.addAttribute<openvdb::math::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(std::fmod(4.1f,1.1f), std::fmod(5.3f,2.3f), std::fmod(6.3f,4.3f))); } },
416
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "vec3d", [&](){ mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(std::fmod(4.1,1.1), std::fmod(5.3,2.3), std::fmod(6.3,4.3))); } },
417
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec4i", [&](){ mHarness.addAttribute<openvdb::math::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(0,0,1,0)); } },
418
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 { "vec4f", [&](){ mHarness.addAttribute<openvdb::math::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(std::fmod(5.1f,1.1f), std::fmod(6.3f,2.3f), std::fmod(7.3f,4.3f), std::fmod(8.4f,5.4f))); } },
419
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "vec4d", [&](){ mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(std::fmod(5.1,1.1), std::fmod(6.3,2.3), std::fmod(7.3,4.3), std::fmod(8.4,5.4))); } },
420
16/34
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✓ Branch 47 taken 1 times.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
32 };
421
422
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 1 times.
16 for (const auto& expc : expected) {
423
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
15 expc.second.operator()();
424 }
425
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_mod.ax");
426 1 }
427
428
429 void
430 1 TestBinary::btand()
431 {
432
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
433 _T1_@_A1_ = _L1_ & _L2_;)";
434
435 std::string repl;
436 1 auto generate = [&](const auto& map) {
437
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& config : map) {
438
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 std::string tmp = code;
439
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 unittest_util::replace(tmp, "_T1_", config.first);
440
3/6
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
8 unittest_util::replace(tmp, "_A1_", "test" + config.first);
441
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
12 for (const auto& settings : config.second) {
442
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 unittest_util::replace(tmp, settings.first, settings.second);
443 }
444
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 repl += tmp;
445 }
446 1 };
447
448
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
449
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_bitand.ax");
450
451 const std::map<std::string, std::function<void()>> expected = {
452
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "bool", [&](){ mHarness.addAttribute<bool>("testbool", false); } },
453
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int16", [&](){ mHarness.addAttribute<int16_t>("testint16", 2); } },
454
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int32", [&](){ mHarness.addAttribute<int32_t>("testint32", 2); } },
455
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int64", [&](){ mHarness.addAttribute<int64_t>("testint64", 2); } },
456
5/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
10 };
457
458
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& expc : expected) {
459
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 expc.second.operator()();
460 }
461
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_bitand.ax");
462 1 }
463
464
465 void
466 1 TestBinary::btor()
467 {
468
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
469 _T1_@_A1_ = _L1_ | _L2_;)";
470
471 std::string repl;
472 1 auto generate = [&](const auto& map) {
473
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& config : map) {
474
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 std::string tmp = code;
475
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 unittest_util::replace(tmp, "_T1_", config.first);
476
3/6
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
8 unittest_util::replace(tmp, "_A1_", "test" + config.first);
477
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
12 for (const auto& settings : config.second) {
478
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 unittest_util::replace(tmp, settings.first, settings.second);
479 }
480
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 repl += tmp;
481 }
482 1 };
483
484
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
485
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_bitor.ax");
486
487 const std::map<std::string, std::function<void()>> expected = {
488
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "bool", [&](){ mHarness.addAttribute<bool>("testbool", true); } },
489
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int16", [&](){ mHarness.addAttribute<int16_t>("testint16", 3); } },
490
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int32", [&](){ mHarness.addAttribute<int32_t>("testint32", 3); } },
491
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int64", [&](){ mHarness.addAttribute<int64_t>("testint64", 3); } },
492
5/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
10 };
493
494
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& expc : expected) {
495
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 expc.second.operator()();
496 }
497
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_bitor.ax");
498 1 }
499
500
501 void
502 1 TestBinary::btxor()
503 {
504
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
505 _T1_@_A1_ = _L1_ ^ _L2_;)";
506
507 std::string repl;
508 1 auto generate = [&](const auto& map) {
509
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& config : map) {
510
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 std::string tmp = code;
511
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 unittest_util::replace(tmp, "_T1_", config.first);
512
3/6
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
8 unittest_util::replace(tmp, "_A1_", "test" + config.first);
513
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
12 for (const auto& settings : config.second) {
514
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 unittest_util::replace(tmp, settings.first, settings.second);
515 }
516
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 repl += tmp;
517 }
518 1 };
519
520
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
521
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_bitxor.ax");
522
523 const std::map<std::string, std::function<void()>> expected = {
524
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "bool", [&](){ mHarness.addAttribute<bool>("testbool", true); } },
525
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int16", [&](){ mHarness.addAttribute<int16_t>("testint16", 1); } },
526
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int32", [&](){ mHarness.addAttribute<int32_t>("testint32", 1); } },
527
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int64", [&](){ mHarness.addAttribute<int64_t>("testint64", 1); } },
528
5/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
10 };
529
530
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& expc : expected) {
531
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 expc.second.operator()();
532 }
533
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_bitxor.ax");
534 1 }
535
536
537 void
538 1 TestBinary::logicaland()
539 {
540
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
541 _T1_@_A1_ = _L1_ && _L2_;)";
542
543 std::string repl;
544 2 auto generate = [&](const auto& map) {
545
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
8 for (const auto& config : map) {
546
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 std::string tmp = code;
547
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
6 unittest_util::replace(tmp, "_T1_", config.first);
548
3/6
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
12 unittest_util::replace(tmp, "_A1_", "test" + config.first);
549
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
18 for (const auto& settings : config.second) {
550
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 unittest_util::replace(tmp, settings.first, settings.second);
551 }
552
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 repl += tmp;
553 }
554 2 };
555
556
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
557
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
558
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_logicaland.ax");
559
560 const std::map<std::string, std::function<void()>> expected = {
561
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "bool", [&](){ mHarness.addAttribute<bool>("testbool", false); } },
562
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int16", [&](){ mHarness.addAttribute<int16_t>("testint16", 1); } },
563
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int32", [&](){ mHarness.addAttribute<int32_t>("testint32", 1); } },
564
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int64", [&](){ mHarness.addAttribute<int64_t>("testint64", 1); } },
565
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "float", [&](){ mHarness.addAttribute<float>("testfloat", 1.0f); } },
566
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "double", [&](){ mHarness.addAttribute<double>("testdouble", 1.0); } },
567
7/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
14 };
568
569
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1 times.
7 for (const auto& expc : expected) {
570
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 expc.second.operator()();
571 }
572
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->execute("binary_logicaland.ax");
573
574 // Also test short circuiting logical op for &&
575
576
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.reset();
577
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 this->registerTest(R"(
578 int@scircuit1 = 0;
579 int@scircuit2 = 1;
580 int@scircuit3 = 2;
581 int@scircuit1++ && ++int@scircuit2;
582 ++int@scircuit1 && ++int@scircuit3;
583 int@scircuit4 = 1;
584 int@scircuit5 = 1;
585 true && int@scircuit4 = 2;
586 false && int@scircuit5 = 2;)",
587 "binary_logicaland_scircuit.ax");
588
589
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
1 mHarness.addAttributes<int32_t>(unittest_util::nameSequence("scircuit", 5), { 2, 1, 3, 2, 1 });
590
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_logicaland_scircuit.ax");
591 1 }
592
593
594 void
595 1 TestBinary::logicalor()
596 {
597
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
598 _T1_@_A1_ = _L1_ || _L2_;)";
599
600 std::string repl;
601 2 auto generate = [&](const auto& map) {
602
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
8 for (const auto& config : map) {
603
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 std::string tmp = code;
604
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
6 unittest_util::replace(tmp, "_T1_", config.first);
605
3/6
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
12 unittest_util::replace(tmp, "_A1_", "test" + config.first);
606
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
18 for (const auto& settings : config.second) {
607
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 unittest_util::replace(tmp, settings.first, settings.second);
608 }
609
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 repl += tmp;
610 }
611 2 };
612
613
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
614
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
615
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_logicalor.ax");
616
617 const std::map<std::string, std::function<void()>> expected = {
618
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "bool", [&](){ mHarness.addAttribute<bool>("testbool", true); } },
619
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int16", [&](){ mHarness.addAttribute<int16_t>("testint16", 1); } },
620
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int32", [&](){ mHarness.addAttribute<int32_t>("testint32", 1); } },
621
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "int64", [&](){ mHarness.addAttribute<int64_t>("testint64", 1); } },
622
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "float", [&](){ mHarness.addAttribute<float>("testfloat", 1.0f); } },
623
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 { "double", [&](){ mHarness.addAttribute<double>("testdouble", 1.0); } },
624
7/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
14 };
625
626
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1 times.
7 for (const auto& expc : expected) {
627
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 expc.second.operator()();
628 }
629
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->execute("binary_logicalor.ax");
630
631 // Also test short circuiting logical op for ||
632
633
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.reset();
634
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 this->registerTest(R"(
635 int@scircuit1 = 0;
636 int@scircuit2 = 1;
637 int@scircuit3 = 2;
638 int@scircuit1++ || ++int@scircuit2;
639 ++int@scircuit1 || ++int@scircuit3;
640 int@scircuit4 = 1;
641 int@scircuit5 = 1;
642 true || int@scircuit4 = 2;
643 false || int@scircuit5 = 2;)",
644 "binary_logicalor_scircuit.ax");
645
646
5/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
1 mHarness.addAttributes<int32_t>(unittest_util::nameSequence("scircuit", 5), { 2, 2, 2, 1, 2 });
647
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_logicalor_scircuit.ax");
648 1 }
649
650
651 void
652 1 TestBinary::equalsequals()
653 {
654 1 const std::string code = R"(
655 bool@_A1_ = _L1_ == _L2_;
656 bool@_A2_ = _L2_ == _L2_;)";
657
658
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t idx = 1;
659 std::string repl;
660 7 auto generate = [&](const auto& map) {
661
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 7 times.
26 for (const auto& config : map) {
662
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 std::string tmp = code;
663
4/8
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 19 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 19 times.
✗ Branch 11 not taken.
38 unittest_util::replace(tmp, "_A1_", "test" + std::to_string(idx++));
664
4/8
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 19 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 19 times.
✗ Branch 11 not taken.
38 unittest_util::replace(tmp, "_A2_", "test" + std::to_string(idx++));
665
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 19 times.
57 for (const auto& settings : config.second) {
666
1/2
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
38 unittest_util::replace(tmp, settings.first, settings.second);
667 }
668
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 repl += tmp;
669 }
670 7 };
671
672
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
673
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
674
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec2);
675
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec3);
676
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec4);
677
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat3);
678
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat4);
679
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_relational_equalsequals.ax");
680
681
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
1 CPPUNIT_ASSERT(idx != 0);
682
683
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 const auto names = unittest_util::nameSequence("test", idx-1);
684 std::vector<bool> results;
685
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 1 times.
39 for (size_t i = 0; i < idx-1; ++i) {
686
1/2
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
38 results.emplace_back((i % 2 == 0) ? false : true);
687 }
688
689
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttributes<bool>(names, results);
690
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_relational_equalsequals.ax");
691 1 }
692
693
694 void
695 1 TestBinary::notequals()
696 {
697 1 const std::string code = R"(
698 bool@_A1_ = _L1_ != _L2_;
699 bool@_A2_ = _L2_ != _L2_;)";
700
701
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t idx = 1;
702 std::string repl;
703 7 auto generate = [&](const auto& map) {
704
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 7 times.
26 for (const auto& config : map) {
705
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 std::string tmp = code;
706
4/8
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 19 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 19 times.
✗ Branch 11 not taken.
38 unittest_util::replace(tmp, "_A1_", "test" + std::to_string(idx++));
707
4/8
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 19 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 19 times.
✗ Branch 11 not taken.
38 unittest_util::replace(tmp, "_A2_", "test" + std::to_string(idx++));
708
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 19 times.
57 for (const auto& settings : config.second) {
709
1/2
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
38 unittest_util::replace(tmp, settings.first, settings.second);
710 }
711
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 repl += tmp;
712 }
713 7 };
714
715
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
716
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
717
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec2);
718
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec3);
719
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec4);
720
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat3);
721
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat4);
722
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_relational_notequals.ax");
723
724
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
1 CPPUNIT_ASSERT(idx != 0);
725
726
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 const auto names = unittest_util::nameSequence("test", idx-1);
727 std::vector<bool> results;
728
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 1 times.
39 for (size_t i = 0; i < idx-1; ++i) {
729
1/2
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
38 results.emplace_back((i % 2 == 1) ? false : true);
730 }
731
732
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttributes<bool>(names, results);
733
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_relational_notequals.ax");
734 1 }
735
736
737 void
738 1 TestBinary::greaterthan()
739 {
740 1 const std::string code = R"(
741 bool@_A1_ = _L1_ > _L2_;
742 bool@_A2_ = _L2_ > _L1_;
743 bool@_A3_ = _L2_ > _L2_;)";
744
745
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t idx = 1;
746 std::string repl;
747 2 auto generate = [&](const auto& map) {
748
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
8 for (const auto& config : map) {
749
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 std::string tmp = code;
750
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A1_", "test" + std::to_string(idx++));
751
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A2_", "test" + std::to_string(idx++));
752
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A3_", "test" + std::to_string(idx++));
753
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
18 for (const auto& settings : config.second) {
754
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 unittest_util::replace(tmp, settings.first, settings.second);
755 }
756
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 repl += tmp;
757 }
758 2 };
759
760
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
761
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
762
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_relational_greaterthan.ax");
763
764
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
1 CPPUNIT_ASSERT(idx != 0);
765
766
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 const auto names = unittest_util::nameSequence("test", idx-1);
767
768 std::vector<bool> results;
769
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& config : integral) {
770
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 3 times.
4 if (config.first == "bool") {
771 // L1 and L2 for bools are swapped
772 results.emplace_back(true);
773 results.emplace_back(false);
774 results.emplace_back(false);
775 }
776 else {
777 results.emplace_back(false);
778 results.emplace_back(true);
779 results.emplace_back(false);
780 }
781 }
782
783 const size_t typecount = floating.size();
784
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (size_t i = 0; i < typecount; ++i) {
785 results.emplace_back(false);
786 results.emplace_back(true);
787 results.emplace_back(false);
788 }
789
790
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttributes<bool>(names, results);
791
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_relational_greaterthan.ax");
792 1 }
793
794
795 void
796 1 TestBinary::lessthan()
797 {
798 1 const std::string code = R"(
799 bool@_A1_ = _L1_ < _L2_;
800 bool@_A2_ = _L2_ < _L1_;
801 bool@_A3_ = _L2_ < _L2_;)";
802
803
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t idx = 1;
804 std::string repl;
805 2 auto generate = [&](const auto& map) {
806
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
8 for (const auto& config : map) {
807
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 std::string tmp = code;
808
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A1_", "test" + std::to_string(idx++));
809
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A2_", "test" + std::to_string(idx++));
810
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A3_", "test" + std::to_string(idx++));
811
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
18 for (const auto& settings : config.second) {
812
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 unittest_util::replace(tmp, settings.first, settings.second);
813 }
814
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 repl += tmp;
815 }
816 2 };
817
818
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
819
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
820
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_relational_lessthan.ax");
821
822
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
1 CPPUNIT_ASSERT(idx != 0);
823
824
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 const auto names = unittest_util::nameSequence("test", idx-1);
825
826 std::vector<bool> results;
827
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& config : integral) {
828
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 3 times.
4 if (config.first == "bool") {
829 // L1 and L2 for bools are swapped
830 results.emplace_back(false);
831 results.emplace_back(true);
832 results.emplace_back(false);
833 }
834 else {
835 results.emplace_back(true);
836 results.emplace_back(false);
837 results.emplace_back(false);
838 }
839 }
840
841 const size_t typecount = floating.size();
842
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (size_t i = 0; i < typecount; ++i) {
843 results.emplace_back(true);
844 results.emplace_back(false);
845 results.emplace_back(false);
846 }
847
848
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttributes<bool>(names, results);
849
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_relational_lessthan.ax");
850 1 }
851
852
853
854 void
855 1 TestBinary::greaterthanequals()
856 {
857 1 const std::string code = R"(
858 bool@_A1_ = _L1_ >= _L2_;
859 bool@_A2_ = _L2_ >= _L1_;
860 bool@_A3_ = _L2_ >= _L2_;)";
861
862
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t idx = 1;
863 std::string repl;
864 2 auto generate = [&](const auto& map) {
865
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
8 for (const auto& config : map) {
866
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 std::string tmp = code;
867
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A1_", "test" + std::to_string(idx++));
868
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A2_", "test" + std::to_string(idx++));
869
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A3_", "test" + std::to_string(idx++));
870
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
18 for (const auto& settings : config.second) {
871
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 unittest_util::replace(tmp, settings.first, settings.second);
872 }
873
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 repl += tmp;
874 }
875 2 };
876
877
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
878
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
879
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_relational_greaterthanequals.ax");
880
881
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
1 CPPUNIT_ASSERT(idx != 0);
882
883
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 const auto names = unittest_util::nameSequence("test", idx-1);
884
885 std::vector<bool> results;
886
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& config : integral) {
887
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 3 times.
4 if (config.first == "bool") {
888 // L1 and L2 for bools are swapped
889 results.emplace_back(true);
890 results.emplace_back(false);
891 results.emplace_back(true);
892 }
893 else {
894 results.emplace_back(false);
895 results.emplace_back(true);
896 results.emplace_back(true);
897 }
898 }
899
900 const size_t typecount = floating.size();
901
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (size_t i = 0; i < typecount; ++i) {
902 results.emplace_back(false);
903 results.emplace_back(true);
904 results.emplace_back(true);
905 }
906
907
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttributes<bool>(names, results);
908
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_relational_greaterthanequals.ax");
909 1 }
910
911
912 void
913 1 TestBinary::lessthanequals()
914 {
915 1 const std::string code = R"(
916 bool@_A1_ = _L1_ <= _L2_;
917 bool@_A2_ = _L2_ <= _L1_;
918 bool@_A3_ = _L2_ <= _L2_;)";
919
920
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t idx = 1;
921 std::string repl;
922 2 auto generate = [&](const auto& map) {
923
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
8 for (const auto& config : map) {
924
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 std::string tmp = code;
925
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A1_", "test" + std::to_string(idx++));
926
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A2_", "test" + std::to_string(idx++));
927
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 unittest_util::replace(tmp, "_A3_", "test" + std::to_string(idx++));
928
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
18 for (const auto& settings : config.second) {
929
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 unittest_util::replace(tmp, settings.first, settings.second);
930 }
931
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 repl += tmp;
932 }
933 2 };
934
935
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
936
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
937
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_relational_lessthanequals.ax");
938
939
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
1 CPPUNIT_ASSERT(idx != 0);
940
941
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 const auto names = unittest_util::nameSequence("test", idx-1);
942
943 std::vector<bool> results;
944
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& config : integral) {
945
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 3 times.
4 if (config.first == "bool") {
946 // L1 and L2 for bools are swapped
947 results.emplace_back(false);
948 results.emplace_back(true);
949 results.emplace_back(true);
950 }
951 else {
952 results.emplace_back(true);
953 results.emplace_back(false);
954 results.emplace_back(true);
955 }
956 }
957
958 const size_t typecount = floating.size();
959
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (size_t i = 0; i < typecount; ++i) {
960 results.emplace_back(true);
961 results.emplace_back(false);
962 results.emplace_back(true);
963 }
964
965
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttributes<bool>(names, results);
966
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_relational_lessthanequals.ax");
967 1 }
968
969
970 void
971 1 TestBinary::shiftleft()
972 {
973
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
974 _T1_@_A1_ = _L1_ << _L2_;
975 _T1_@_A2_ = _L2_ << _L1_;)";
976
977 std::string repl;
978 1 auto generate = [&](const auto& map) {
979
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& config : map) {
980
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 std::string tmp = code;
981
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 unittest_util::replace(tmp, "_T1_", config.first);
982
4/8
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
8 unittest_util::replace(tmp, "_A1_", "test" + config.first + "1");
983
4/8
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
8 unittest_util::replace(tmp, "_A2_", "test" + config.first + "2");
984
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
12 for (const auto& settings : config.second) {
985
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 unittest_util::replace(tmp, settings.first, settings.second);
986 }
987
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 repl += tmp;
988 }
989 1 };
990
991
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
992
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_shiftleft.ax");
993
994 const std::map<std::string, std::function<void()>> expected = {
995 1 { "bool", [&](){
996
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<bool>("testbool1", true);
997
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<bool>("testbool2", false);
998 1 }
999 },
1000 1 { "int16", [&](){
1001
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int16_t>("testint161", 16);
1002
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int16_t>("testint162", 12);
1003 1 }
1004 },
1005 1 { "int32", [&](){
1006
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int32_t>("testint321", 16);
1007
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int32_t>("testint322", 12);
1008 1 }
1009 },
1010 1 { "int64", [&](){
1011
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int64_t>("testint641", 16);
1012
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int64_t>("testint642", 12);
1013 1 }
1014 },
1015
5/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
10 };
1016
1017
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& expc : expected) {
1018
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 expc.second.operator()();
1019 }
1020
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_shiftleft.ax");
1021 1 }
1022
1023
1024 void
1025 1 TestBinary::shiftright()
1026 {
1027
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::string code = R"(
1028 _T1_@_A1_ = _L1_ >> _L2_;
1029 _T1_@_A2_ = _L2_ >> _L1_;)";
1030
1031 std::string repl;
1032 1 auto generate = [&](const auto& map) {
1033
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& config : map) {
1034
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 std::string tmp = code;
1035
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 unittest_util::replace(tmp, "_T1_", config.first);
1036
4/8
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
8 unittest_util::replace(tmp, "_A1_", "test" + config.first + "1");
1037
4/8
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
8 unittest_util::replace(tmp, "_A2_", "test" + config.first + "2");
1038
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
12 for (const auto& settings : config.second) {
1039
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 unittest_util::replace(tmp, settings.first, settings.second);
1040 }
1041
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 repl += tmp;
1042 }
1043 1 };
1044
1045
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
1046
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(repl, "binary_shiftright.ax");
1047
1048 const std::map<std::string, std::function<void()>> expected = {
1049 1 { "bool", [&](){
1050
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<bool>("testbool1", true);
1051
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<bool>("testbool2", false);
1052 1 }
1053 },
1054 1 { "int16", [&](){
1055
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int16_t>("testint161", 0);
1056
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int16_t>("testint162", 0);
1057 1 }
1058 },
1059 1 { "int", [&](){
1060
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int32_t>("testint321", 0);
1061
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int32_t>("testint322", 0);
1062 1 }
1063 },
1064 1 { "int64", [&](){
1065
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int64_t>("testint641", 0);
1066
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int64_t>("testint642", 0);
1067 1 }
1068 },
1069
5/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
10 };
1070
1071
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& expc : expected) {
1072
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 expc.second.operator()();
1073 }
1074
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 this->execute("binary_shiftright.ax");
1075 1 }
1076
1077