Added test structure and Unity usage
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
find_package(unity REQUIRED)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src)
|
||||
add_executable(testing
|
||||
test.cpp
|
||||
)
|
||||
set_target_properties(testing PROPERTIES LINKER_LANGUAGE CXX)
|
||||
target_link_libraries(testing unity)
|
||||
@@ -0,0 +1,21 @@
|
||||
#include <unity/unity.h>
|
||||
#include <unity/unity_internals.h>
|
||||
|
||||
void setUp() { ; }
|
||||
void tearDown() { ; }
|
||||
|
||||
int Math(void) {
|
||||
return 2+2;
|
||||
}
|
||||
|
||||
void test_Math(void) {
|
||||
TEST_ASSERT_EQUAL_INT(4, Math());
|
||||
}
|
||||
|
||||
|
||||
int main(void) {
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(test_Math);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user