GCC Code Coverage Report


libs/base/src/base/
File: vec4.cc
Date: 2025-03-19 20:55:25
Lines:
22/24
91.7%
Functions:
9/9
100.0%
Branches:
4/38
10.5%

Line Branch Exec Source
1 #include "base/vec4.h"
2
3 namespace eu
4 {
5 469 v4::v4(float ax, float ay, float az, float aw)
6 469 : x(ax), y(ay), z(az), w(aw)
7 {
8 469 }
9
10 18 v4::v4(const v3 &a, float aw)
11 18 : x(a.x), y(a.y), z(a.z), w(aw)
12 {
13 18 }
14
15 1 v4::v4(const float *a)
16 1 : x(a[0]), y(a[1]), z(a[2]), w(a[3])
17 {
18 1 }
19
20 v3
21 8 v4::to_vec3(float ww) const
22 {
23
1/10
✗ Branch 0 (3 → 4) not taken.
✓ Branch 1 (3 → 18) taken 8 times.
✗ Branch 2 (10 → 11) not taken.
✗ Branch 3 (10 → 24) not taken.
✗ Branch 4 (11 → 12) not taken.
✗ Branch 5 (11 → 22) not taken.
✗ Branch 6 (15 → 16) not taken.
✗ Branch 7 (15 → 17) not taken.
✗ Branch 8 (28 → 29) not taken.
✗ Branch 9 (28 → 30) not taken.
8 ASSERTX(is_equal(w, ww), w, ww);
24 8 return {x, y, z};
25 }
26
27 v3
28 16 v4::to_vec3_persp_div() const
29 {
30
1/10
✗ Branch 0 (3 → 4) not taken.
✓ Branch 1 (3 → 17) taken 16 times.
✗ Branch 2 (9 → 10) not taken.
✗ Branch 3 (9 → 23) not taken.
✗ Branch 4 (10 → 11) not taken.
✗ Branch 5 (10 → 21) not taken.
✗ Branch 6 (14 → 15) not taken.
✗ Branch 7 (14 → 16) not taken.
✗ Branch 8 (27 → 28) not taken.
✗ Branch 9 (27 → 29) not taken.
16 ASSERTX(is_equal(w, 0.0f) == false, w);
31 16 return {x/w, y/w, z/w};
32 }
33
34 float *
35 1 v4::get_data_ptr()
36 {
37 1 return &x;
38 }
39
40 const float *
41 1 v4::get_data_ptr() const
42 {
43 1 return &x;
44 }
45
46 2 std::string string_from(const v4 &v)
47 {
48 4 return fmt::format("({}, {}, {}, {})", v.x, v.y, v.z, v.w);
49 }
50
51
2/4
✓ Branch 0 (2 → 3) taken 1 times.
✗ Branch 1 (2 → 10) not taken.
✓ Branch 2 (3 → 4) taken 1 times.
✗ Branch 3 (3 → 8) not taken.
1 ADD_CATCH_FORMATTER_IMPL(v4)
52 }
53