Skip to content

Commit

Permalink
update knot.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
ManifoldFR committed Oct 17, 2024
1 parent 2e8e76b commit 2a7f57c
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions tests/gar/knot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ BOOST_FIXTURE_TEST_CASE(move, knot_fixture) {
BOOST_FIXTURE_TEST_CASE(copy, knot_fixture) {

knot_t knot2{knot};
BOOST_CHECK_EQUAL(knot.Q, knot2.Q);
BOOST_CHECK_EQUAL(knot.S, knot2.S);
BOOST_CHECK_EQUAL(knot.R, knot2.R);
BOOST_CHECK_EQUAL(knot.q, knot2.q);
BOOST_CHECK_EQUAL(knot.r, knot2.r);

BOOST_CHECK_EQUAL(knot.A, knot2.A);
BOOST_CHECK_EQUAL(knot.B, knot2.B);
BOOST_CHECK_EQUAL(knot.E, knot2.E);
BOOST_CHECK_EQUAL(knot.f, knot2.f);

BOOST_CHECK_EQUAL(knot, knot2);
}

Expand Down Expand Up @@ -100,3 +89,32 @@ BOOST_AUTO_TEST_CASE(knot_vec) {
BOOST_CHECK_EQUAL(v2[i], vc[i]);
}
}

auto make_problem() -> problem_t {
uint nx = 4;
uint nu = 2;
std::vector<knot_t> v;
v.reserve(10);
for (int i = 0; i < 10; i++) {
v.push_back(generate_knot(nx, nu, 0));
}
problem_t prob{v, nx};
return prob;
}

BOOST_AUTO_TEST_CASE(problem) {
BOOST_TEST_MESSAGE("problem");
auto prob = make_problem();
fmt::print("Q[0] = \n{}\n", prob.stages[0].Q);

problem_t prob_copy{prob};

for (size_t i = 0; i < 10; i++) {
BOOST_CHECK_EQUAL(prob.stages[i], prob_copy.stages[i]);
}

prob_copy.addParameterization(1);
for (size_t i = 0; i < 10; i++) {
BOOST_CHECK_EQUAL(prob.stages[i].Q, prob_copy.stages[i].Q);
}
}

0 comments on commit 2a7f57c

Please sign in to comment.