a few tests
This commit is contained in:
parent
3ef86aea06
commit
a7108eb32b
@ -35,6 +35,7 @@ set(TARGET_MAIN main)
|
||||
set(TARGET_ASYNC async)
|
||||
set(TARGET_CHECK check)
|
||||
set(TARGET_EMITTER emitter)
|
||||
set(TARGET_EVENT event)
|
||||
set(TARGET_HANDLE handle)
|
||||
set(TARGET_IDLE idle)
|
||||
set(TARGET_LOOP loop)
|
||||
@ -75,6 +76,14 @@ target_include_directories(${TARGET_EMITTER} PRIVATE ${COMMON_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_EMITTER} PRIVATE ${COMMON_LINK_LIBS})
|
||||
add_test(NAME ${TARGET_EMITTER} COMMAND ${TARGET_EMITTER})
|
||||
|
||||
# Test TARGET_EVENT
|
||||
|
||||
set(TARGET_EVENT_SOURCES $<TARGET_OBJECTS:odr> uvw/event.cpp)
|
||||
add_executable(${TARGET_EVENT} ${TARGET_EVENT_SOURCES})
|
||||
target_include_directories(${TARGET_EVENT} PRIVATE ${COMMON_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_EVENT} PRIVATE ${COMMON_LINK_LIBS})
|
||||
add_test(NAME ${TARGET_EVENT} COMMAND ${TARGET_EMITTER})
|
||||
|
||||
# Test TARGET_HANDLE
|
||||
|
||||
set(TARGET_HANDLE_SOURCES $<TARGET_OBJECTS:odr> uvw/handle.cpp)
|
||||
|
||||
15
test/uvw/event.cpp
Normal file
15
test/uvw/event.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <uvw/event.hpp>
|
||||
|
||||
|
||||
struct EventA: uvw::Event<EventA> {};
|
||||
struct EventB: uvw::Event<EventB> {};
|
||||
|
||||
|
||||
TEST(Event, Uniqueness) {
|
||||
ASSERT_EQ(EventA::type(), EventA::type());
|
||||
ASSERT_EQ(EventA::type(), EventA{}.type());
|
||||
|
||||
ASSERT_NE(EventA::type(), EventB::type());
|
||||
ASSERT_NE(EventA::type(), EventB{}.type());
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user