}
void SetUp() override {
- int ret_val = check_feature_all();
- if (!ret_val) {
- SKIP_MESSAGE("All sensor features are false");
- GTEST_SKIP();
- return;
- }
}
void TearDown() override{}
};
int SENSOR_DEV::device_count = 0;
device_registry_t SENSOR_DEV::devices;
-#define SKIP_NO_FEATURE() \
- if (!check_feature_all()) { \
- return; \
- }
-
#define SKIP_NO_DEV() \
+do { \
if (device_count <= 0) { \
SKIP_MESSAGE("There is no sensor devices."); \
return; \
- }
+ } \
+} while (0)
TEST_F(SENSOR_DEV, get_poll_fdP)
{
- SKIP_NO_FEATURE()
- SKIP_NO_DEV()
+ SKIP_NO_FEATURE();
+ SKIP_NO_DEV();
for (auto it = devices.begin(); it != devices.end(); ++it) {
EXPECT_NE((*it)->get_poll_fd(), 0);
const sensor_info_t *sensors = nullptr;
int ret_func;
- SKIP_NO_FEATURE()
- SKIP_NO_DEV()
+ SKIP_NO_FEATURE();
+ SKIP_NO_DEV();
for (auto it = devices.begin(); it != devices.end(); ++it) {
ret_func = (*it)->get_sensors(&sensors);
TEST_F(SENSOR_DEV, get_sensorsN)
{
- SKIP_NO_FEATURE()
- SKIP_NO_DEV()
+ SKIP_NO_FEATURE();
+ SKIP_NO_DEV();
for (auto it = devices.begin(); it != devices.end(); ++it) {
EXPECT_EQ((*it)->get_sensors(nullptr), -EINVAL);
sensor_data_t *data = NULL;
const sensor_info_t *sensors = nullptr;
- SKIP_NO_FEATURE()
- SKIP_NO_DEV()
+ SKIP_NO_FEATURE();
+ SKIP_NO_DEV();
for (auto it = devices.begin(); it != devices.end(); ++it) {
EXPECT_GE((*it)->get_sensors(&sensors), 1);
int length = 0;
sensor_data_t *data = NULL;
- SKIP_NO_FEATURE()
- SKIP_NO_DEV()
+ SKIP_NO_FEATURE();
+ SKIP_NO_DEV();
for (auto it = devices.begin(); it != devices.end(); ++it) {
EXPECT_EQ((*it)->get_data(0, &data, &length), -EINVAL);
#include <string.h>
#if (GTEST_VERSION_MAJOR < 1 || (GTEST_VERSION_MAJOR == 1 && GTEST_VERSION_MINOR < 10))
-#define GTEST_SKIP() ;
+#define GTEST_SKIP()
// hack gtest internal for print message
namespace testing
{
} while (0)
#define SKIP_NO_FEATURE() \
+do { \
if (!check_feature_all()) { \
+ SKIP_MESSAGE("All sensor features are false"); \
+ GTEST_SKIP(); \
return; \
- }
+ } \
+} while (0)
// SetUp/TearDown function for a testsuite differ by gtest version
#if (GTEST_VERSION_MAJOR >= 2 || (GTEST_VERSION_MAJOR == 1 && GTEST_VERSION_MINOR >= 10))