7 #include <gtest/gtest.h> 80 data3.
all_ = 0xff000000;
81 EXPECT_TRUE(data != data2);
82 EXPECT_TRUE(data == data3);
99 .errorAccSaturated_ = 0,
100 .errorGyroSaturated_ = 0,
101 .errorAdcOutOfSync_ = 0,
102 .errorSensingRangeExceeded_ = 0,
103 .warningOvertemperature_ = 0,
104 .fatalSupplyVoltage_ = 0 };
106 data.
bits_ = databits;
109 .errorAccSaturated_ = 1,
110 .errorGyroSaturated_ = 1,
111 .errorAdcOutOfSync_ = 1,
112 .errorSensingRangeExceeded_ = 1,
113 .warningOvertemperature_ = 1,
114 .fatalSupplyVoltage_ = 1 };
116 data2.
bits_ = databits2;
118 std::vector<std::string> infos, warnings, errors, fatals;
122 EXPECT_EQ(infos.size(), (uint32_t)0);
123 ASSERT_EQ(warnings.size(), (uint32_t)1);
124 ASSERT_EQ(errors.size(), (uint32_t)5);
125 ASSERT_EQ(fatals.size(), (uint32_t)1);
126 EXPECT_STREQ(warnings[0].c_str(),
"High temperature in Rokubimini Sensor");
127 EXPECT_STREQ(errors[0].c_str(),
"Force/Torque is invalid. ADC saturation");
128 EXPECT_STREQ(errors[1].c_str(),
"Acceleration has saturated.");
129 EXPECT_STREQ(errors[2].c_str(),
"Angular rates have saturated.");
130 EXPECT_STREQ(errors[3].c_str(),
"Force/Torque is invalid. ADCs are not synced");
131 EXPECT_STREQ(errors[4].c_str(),
"Sensing range exceeded.");
132 EXPECT_STREQ(fatals[0].c_str(),
"Supply voltage exceeds limits.");
138 .errorAccSaturated_ = 0,
139 .errorGyroSaturated_ = 0,
140 .errorAdcOutOfSync_ = 0,
141 .errorSensingRangeExceeded_ = 0,
142 .warningOvertemperature_ = 0,
143 .fatalSupplyVoltage_ = 0 };
145 data.
bits_ = databits;
148 .errorAccSaturated_ = 1,
149 .errorGyroSaturated_ = 1,
150 .errorAdcOutOfSync_ = 1,
151 .errorSensingRangeExceeded_ = 1,
152 .warningOvertemperature_ = 1,
153 .fatalSupplyVoltage_ = 1 };
155 data2.
bits_ = databits2;
156 std::vector<std::string> infos, warnings, errors, fatals;
160 EXPECT_EQ(warnings.size(), (uint32_t)0);
161 EXPECT_EQ(errors.size(), (uint32_t)0);
162 EXPECT_EQ(fatals.size(), (uint32_t)0);
163 ASSERT_EQ(infos.size(), (uint32_t)7);
164 EXPECT_STREQ(infos[0].c_str(),
"Temperature in Rokubimini Sensor is normal again");
165 EXPECT_STREQ(infos[1].c_str(),
"Force/Torque is valid again. ADC is not saturated");
166 EXPECT_STREQ(infos[2].c_str(),
"Acceleration is not saturated anymore.");
167 EXPECT_STREQ(infos[3].c_str(),
"Angular rates are not saturated anymore.");
168 EXPECT_STREQ(infos[4].c_str(),
"Force/Torque is valid again. ADCs are synced");
169 EXPECT_STREQ(infos[5].c_str(),
"Sensing range is not exceeded.");
170 EXPECT_STREQ(infos[6].c_str(),
"Supply voltage is normal.");
bool hasErrorAccSaturated() const
Checks if the statusword has error ACC saturated.
~StatusWordTest() override
bool hasErrorSensingRangeExceeded() const
Checks if the statusword has error sensing range exceeded.
void setData(const uint32_t data)
Sets the data variable.
Class representing the different states the communication or the sensors can be in.
uint32_t all_
All the bits in a "raw" uint32_t format.
TEST_F(ReadingTest, StatusWordWorksCorrectly)
bool isEmpty() const
Checks whether the statusword is empty.
uint32_t errorAdcSaturated_
Bits representing errors.
uint32_t getData() const
Gets the data variable.
void getMessagesDiff(Statusword &previousStatusword, std::vector< std::string > &infos, std::vector< std::string > &warnings, std::vector< std::string > &errors, std::vector< std::string > &fatals) const
Gets the different messages form the previous statusword.
bool hasErrorGyroSaturated() const
Checks if the statusword has error gyro saturated.
bool hasErrorAdcOutOfSync() const
Checks if the statusword has error ADC out-of-sync.
bool hasFatalSupplyVoltage() const
Checks if the statusword has fatal supply voltage.
TimePoint getStamp() const
Gets the stamp variable.
Data associated with a Status Word.
bool hasWarningOvertemperature() const
Checks if the statusword has warning over temperature.
bool hasErrorAdcSaturated() const
Checks if the statusword has error ADC saturated.
DataBits bits_
The bits of the data.