Directory: | ./ |
---|---|
File: | tests/TestB.cpp |
Date: | 2024-08-26 22:54:11 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 10 | 15 | 66.7% |
Branches: | 8 | 36 | 22.2% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | #include "TestB.hpp" | ||
2 | |||
3 | #include <Eigen/Core> | ||
4 | #include <iostream> | ||
5 | |||
6 | using namespace eiquadprog::solvers; | ||
7 | namespace eiquadprog { | ||
8 | namespace tests { | ||
9 | |||
10 |
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.
|
1 | B::B() : solution_(2) { solution_.setZero(); } |
11 | |||
12 | 1 | bool B::do_something() { | |
13 | 1 | eiquadprog::solvers::EiquadprogFast_status expected = EIQUADPROG_FAST_OPTIMAL; | |
14 | |||
15 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | Eigen::VectorXd x(2); |
16 | |||
17 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | eiquadprog::solvers::EiquadprogFast_status status = A_.solve(x); |
18 | |||
19 | 1 | bool rstatus = true; | |
20 | |||
21 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if (status != expected) { |
22 | ✗ | std::cerr << "Status not to true for A_" << expected << " " << status | |
23 | ✗ | << std::endl; | |
24 | ✗ | rstatus = false; | |
25 | } | ||
26 | |||
27 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
1 | if (!x.isApprox(solution_)) { |
28 | ✗ | std::cerr << "x!=solution : " << x << "!=" << solution_ << std::endl; | |
29 | ✗ | rstatus = false; | |
30 | } | ||
31 | 1 | return rstatus; | |
32 | 1 | } | |
33 | |||
34 | } // namespace tests | ||
35 | } // namespace eiquadprog | ||
36 |