TestRokubimini.cpp
Go to the documentation of this file.
1 
7 #include <gtest/gtest.h>
8 
9 #include <ros/package.h>
10 
12 
13 namespace rokubimini
14 {
15 // class RokubiminiTest : public ::testing::Test
16 // {
17 // protected:
18 // std::vector<std::shared_ptr<rokubimini::Rokubimini>> rokubiminis;
19 // rokubimini::Rokubimini* rokubimini;
20 // const std::string setupYaml = ros::package::getPath("rokubimini") + "/test/setup.yaml";
21 // RokubiminiTest() : rokubiminis()
22 // {
23 // rokubimini = new Rokubimini();
24 // }
25 
26 // ~RokubiminiTest() override
27 // {
28 // delete rokubimini;
29 // // You can do clean-up work that doesn't throw exceptions here.
30 // }
31 
32 // // If the constructor and destructor are not enough for setting up
33 // // and cleaning up each test, you can define the following methods:
34 
35 // void SetUp() override
36 // {
37 // // Code here will be called immediately after the constructor (right
38 // // before each test).
39 // }
40 
41 // void TearDown() override
42 // {
43 // // Code here will be called immediately after each test (right
44 // // before the destructor).
45 // }
46 // };
47 
48 // TEST_F(RokubiminiTest, FromFileWorksCorrectly)
49 // {
50 // rokubimini::setup::Setup* setup = new rokubimini::setup::Setup();
51 // setup->fromFile(setupYaml);
52 // for (const auto& rokubimini_setup : setup->rokubiminis_)
53 // {
54 // auto rokubimini = std::make_shared<rokubimini::Rokubimini>();
55 // rokubimini->loadRokubiminiSetup(rokubimini_setup);
56 // rokubiminis->emplace_back(rokubimini);
57 // }
58 // ASSERT_EQ(rokubiminis.empty(), false);
59 // ASSERT_EQ(rokubiminis.size(), (uint32_t)4);
60 
61 // EXPECT_STREQ(rokubiminis[0]->getName().c_str(), "ROKUB_ETHERCAT_1");
62 
63 // EXPECT_STREQ(rokubiminis[1]->getName().c_str(), "ROKUB_SERIAL_USB0");
64 
65 // EXPECT_STREQ(rokubiminis[2]->getName().c_str(), "ROKUB_ETHERCAT_2");
66 
67 // EXPECT_STREQ(rokubiminis[3]->getName().c_str(), "ROKUB_SERIAL_ACM0");
68 // }
69 
70 // TEST_F(RokubiminiTest, StatusWordWorksCorrectly)
71 // {
72 // Statusword word = Statusword();
73 // rokubimini->setStatusword(word);
74 // auto word_expected = reading->getStatusword();
75 // EXPECT_EQ(word.getData(), word_expected.getData());
76 // EXPECT_EQ(word.getStamp(), word_expected.getStamp());
77 // EXPECT_EQ(word.hasErrorAdcSaturated(), word_expected.hasErrorAdcSaturated());
78 // EXPECT_EQ(word.hasErrorAccSaturated(), word_expected.hasErrorAccSaturated());
79 // EXPECT_EQ(word.hasErrorGyroSaturated(), word_expected.hasErrorGyroSaturated());
80 // EXPECT_EQ(word.hasErrorAdcOutOfSync(), word_expected.hasErrorAdcOutOfSync());
81 // EXPECT_EQ(word.hasErrorSensingRangeExceeded(), word_expected.hasErrorSensingRangeExceeded());
82 // EXPECT_EQ(word.hasWarningOvertemperature(), word_expected.hasWarningOvertemperature());
83 // EXPECT_EQ(word.hasFatalSupplyVoltage(), word_expected.hasFatalSupplyVoltage());
84 // }
85 
86 // TEST_F(RokubiminiTest, StagingCommandWorksCorrectly)
87 // {
88 // Command new_command = Command();
89 // rokubimini->stageCommand(new_command);
90 // EXPECT_EQ(rokubimini->commandIsStaged(), true);
91 // }
92 
93 // void customCb(const std::string& str)
94 // {
95 // EXPECT_EQ(str.empty(), true);
96 // return;
97 // }
98 // void customCb2(const std::string& str)
99 // {
100 // EXPECT_EQ(str.empty(), true);
101 // return;
102 // }
103 // TEST_F(RokubiminiTest, CallbacksWorkCorrectly)
104 // {
105 // rokubimini->addErrorCb(customCb, 1);
106 // rokubimini->addErrorCb(customCb2, 2);
107 // }
108 } // namespace rokubimini
Tests Configuration.


rokubimini
Author(s):
autogenerated on Wed Mar 3 2021 03:09:12