SET(src ${CMAKE_SOURCE_DIR}/haltest/main.cpp
${CMAKE_SOURCE_DIR}/haltest/display.cpp
- ${CMAKE_SOURCE_DIR}/haltest/battery.cpp)
+ ${CMAKE_SOURCE_DIR}/haltest/battery.cpp
+ ${CMAKE_SOURCE_DIR}/haltest/board.cpp)
ADD_EXECUTABLE(${PROJECT_NAME} ${src})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${gtest_LDFLAGS} ${gtest_pkgs_LDFLAGS} -ldl ${HALAPI_LIBRARY})
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/hal)
--- /dev/null
+#include "haltest.h"
+#include "hal-board.h"
+
+class BOARD : public testing::Test {
+ protected:
+ void SetUp() override {}
+
+ void TearDown() override {}
+};
+
+TEST_F(BOARD, GetBackendP)
+{
+ int ret_val;
+
+ ret_val = hal_device_board_get_backend();
+ EXPECT_EQ(ret_val, 0) << "Failed to get board device (" << ret_val << ")";
+}
+
+TEST_F(BOARD, GetDeviceSerialP)
+{
+ int ret_val;
+ char *serial = nullptr;
+
+ ret_val = hal_device_board_get_device_serial(&serial);
+ EXPECT_EQ(ret_val, 0) << "Failed to get device serial (" << ret_val << ")";
+ EXPECT_NE(serial, nullptr) << "Failed to get device serial (nullptr)";
+
+ if (ret_val == 0 && serial)
+ DEBUG_MESSAGE("Serial=%s", serial);
+
+ free(serial);
+}
+
+TEST_F(BOARD, GetDeviceRevisionP)
+{
+ int ret_val;
+ int revision;
+
+ ret_val = hal_device_board_get_device_revision(&revision);
+ EXPECT_EQ(ret_val, 0) << "Failed to get device revision (" << ret_val << ")";
+
+ if (ret_val == 0)
+ DEBUG_MESSAGE("Revision=%d", revision);
+}
}
}
-#define SKIP_MESSAGE(args...) \
+#define SKIP_MESSAGE(fmt, args...) \
do { \
testing::internal::ColoredPrintf(testing::internal::COLOR_YELLOW, "[ SKIPPED ] "); \
- testing::internal::ColoredPrintf(testing::internal::COLOR_YELLOW, ##args); \
+ testing::internal::ColoredPrintf(testing::internal::COLOR_YELLOW, fmt, ##args); \
testing::internal::ColoredPrintf(testing::internal::COLOR_YELLOW, "\n"); \
} while (0)
+#define DEBUG_MESSAGE(fmt, args...) \
+do { \
+ testing::internal::ColoredPrintf(testing::internal::COLOR_GREEN, "[ DEBUG ] "); \
+ testing::internal::ColoredPrintf(testing::internal::COLOR_DEFAULT, fmt, ##args); \
+ testing::internal::ColoredPrintf(testing::internal::COLOR_DEFAULT, "\n"); \
+} while (0)
+
#define FEATURE_BATTERY "http://tizen.org/feature/battery"
#define FEATURE_DISPLAY "http://tizen.org/feature/display"
#define FEATURE_LED "http://tizen.org/feature/led"
#define FEATURE_THERMISTOR "http://tizen.org/feature/thermistor.ap"
#define FEATURE_BEZEL "http://tizen.org/feature/input.rotating_bezel"
-
#endif /* __HALTEST_H__ */