parent
a349cbed67
commit
a3dacdd1a7
|
|
@ -23,8 +23,11 @@ FetchContent_MakeAvailable(googletest)
|
|||
enable_testing()
|
||||
|
||||
add_executable(wtpp_test tests/wtpp_test.cpp)
|
||||
add_executable(wave_test tests/wave_test.cpp)
|
||||
|
||||
target_link_libraries(wtpp_test GTest::gtest_main)
|
||||
target_link_libraries(wave_test GTest::gtest_main)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(wtpp_test)
|
||||
gtest_discover_tests(wave_test)
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -9,7 +9,7 @@ clean:
|
|||
rm build/wtpp
|
||||
|
||||
test: build
|
||||
cd build && ctest
|
||||
cd build && ctest --output-on-failure
|
||||
|
||||
debug:
|
||||
$(CC) -g $(CFLAGS) $(OBJECTS)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
#include "../src/wave.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
// Initialize index at 0 for wave cycles
|
||||
uint16_t Wave::m_nid = 0;
|
||||
|
||||
TEST(Wave, DefaultConstructor)
|
||||
{
|
||||
Wave w1, w2;
|
||||
// Check that ids are correct
|
||||
EXPECT_EQ(w1.getId(), 0);
|
||||
EXPECT_EQ(w2.getId(), 1);
|
||||
// Sample table should be 0 initialized
|
||||
EXPECT_EQ(w1.getVal(0), 0);
|
||||
}
|
||||
|
||||
TEST(Wave, CopyConstructor) {
|
||||
Wave w1;
|
||||
Wave w2(w1);
|
||||
// Check id is correct
|
||||
EXPECT_EQ(w2.getId(), 0);
|
||||
// Sample table should be 0 initialized
|
||||
EXPECT_EQ(w2.getVal(0), 0);
|
||||
}
|
||||
|
||||
TEST(Wave, CopyAssignment)
|
||||
{
|
||||
Wave w1;
|
||||
Wave w2 = w1;
|
||||
// Check id is correct
|
||||
EXPECT_EQ(w2.getId(), 0);
|
||||
// Sample table should be 0 initialized
|
||||
EXPECT_EQ(w2.getVal(0), 0);
|
||||
}
|
||||
Loading…
Reference in New Issue