Skip to content

Commit

Permalink
fix: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bpapaspyros committed Oct 18, 2024
1 parent 9b7ae7e commit 633600b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1092,12 +1092,13 @@ TEST(CartesianStateTest, TestUtilities) {
EXPECT_THROW(string_to_cartesian_state_variable("foo"), exceptions::InvalidStateVariableException);

auto state = CartesianState();
state.set_position(std::vector<double>{1.0, 2.0, 3.0});
EXPECT_TRUE(state.get_position().cwiseEqual(state.get_state_variable(CartesianStateVariable::POSITION)).all());
EXPECT_TRUE(state.get_position().cwiseEqual(state.get_state_variable(state_variable_type)).all());
auto new_values = Eigen::VectorXd(3);
new_values << 1.0, 2.0, 3.0;
state.set_position(new_values);
EXPECT_TRUE(state.get_state_variable(CartesianStateVariable::POSITION).cwiseEqual(new_values).all());
EXPECT_TRUE(state.get_state_variable(state_variable_type).cwiseEqual(new_values).all());

Eigen::VectorXd new_values(3);
new_values << 4.0, 5.0, 6.0;
state.set_state_variable(new_values, CartesianStateVariable::POSITION);
EXPECT_TRUE(state.get_position().cwiseEqual(new_values).all());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -609,12 +609,13 @@ TEST(JointStateTest, TestUtilities) {
EXPECT_THROW(string_to_joint_state_variable("foo"), exceptions::InvalidStateVariableException);

auto state = JointState("foo", 3);
state.set_positions(std::vector<double>{1.0, 2.0, 3.0});
EXPECT_TRUE(state.get_positions().cwiseEqual(state.get_state_variable(JointStateVariable::POSITIONS)).all());
EXPECT_TRUE(state.get_positions().cwiseEqual(state.get_state_variable(state_variable_type)).all());
auto new_values = Eigen::VectorXd(3);
new_values << 1.0, 2.0, 3.0;
state.set_positions(new_values);
EXPECT_TRUE(state.get_state_variable(JointStateVariable::POSITIONS).cwiseEqual(new_values).all());
EXPECT_TRUE(state.get_state_variable(state_variable_type).cwiseEqual(new_values).all());

Eigen::VectorXd new_values(3);
new_values << 4.0, 5.0, 6.0;
state.set_state_variable(new_values, JointStateVariable::POSITIONS);
EXPECT_TRUE(state.get_positions().cwiseEqual(new_values).all());
}
}

0 comments on commit 633600b

Please sign in to comment.