Fix shuffleboard C++ tests, and run them on desktop (#1351)

This commit is contained in:
Thad House
2018-10-02 20:55:03 -07:00
committed by Peter Johnson
parent 7b471d8c62
commit fd82153456
12 changed files with 318 additions and 18 deletions

View File

@@ -79,37 +79,37 @@ TEST_F(ShuffleboardTabTest, AddNamedSendableWithProperties) {
}
TEST_F(ShuffleboardTabTest, AddNumberArray) {
std::array<double, 3> expect = {1.0, 2.0, 3.0};
std::array<double, 3> expect = {{1.0, 2.0, 3.0}};
auto entry = m_tab->Add("DoubleArray", expect).GetEntry();
EXPECT_EQ("/Shuffleboard/Tab/DoubleArray", entry.GetName());
auto actual = entry.GetValue()->GetDoubleArray();
EXPECT_EQ(sizeof(expect), sizeof(actual));
for (size_t i = 0; i < sizeof(expect); i++) {
EXPECT_EQ(expect.size(), actual.size());
for (size_t i = 0; i < expect.size(); i++) {
EXPECT_FLOAT_EQ(expect[i], actual[i]);
}
}
TEST_F(ShuffleboardTabTest, AddBooleanArray) {
std::array<bool, 2> expect = {true, false};
std::array<bool, 2> expect = {{true, false}};
auto entry = m_tab->Add("BoolArray", expect).GetEntry();
EXPECT_EQ("/Shuffleboard/Tab/BoolArray", entry.GetName());
auto actual = entry.GetValue()->GetBooleanArray();
EXPECT_EQ(sizeof(expect), sizeof(actual));
for (size_t i = 0; i < sizeof(expect); i++) {
EXPECT_EQ(expect.size(), actual.size());
for (size_t i = 0; i < expect.size(); i++) {
EXPECT_EQ(expect[i], actual[i]);
}
}
TEST_F(ShuffleboardTabTest, AddStringArray) {
std::array<std::string, 2> expect = {"foo", "bar"};
std::array<std::string, 2> expect = {{"foo", "bar"}};
auto entry = m_tab->Add("StringArray", expect).GetEntry();
EXPECT_EQ("/Shuffleboard/Tab/StringArray", entry.GetName());
auto actual = entry.GetValue()->GetStringArray();
EXPECT_EQ(sizeof(expect), sizeof(actual));
for (size_t i = 0; i < sizeof(expect); i++) {
EXPECT_EQ(expect.size(), actual.size());
for (size_t i = 0; i < expect.size(); i++) {
EXPECT_EQ(expect[i], actual[i]);
}
}