ci(tests): add test framework (#1603)
This commit is contained in:
parent
934f81182a
commit
89e8b9628c
43 changed files with 1519 additions and 136 deletions
19
tests/unit/test_file_handler.cpp
Normal file
19
tests/unit/test_file_handler.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* @file tests/test_file_handler.cpp
|
||||
* @brief Test src/file_handler.*.
|
||||
*/
|
||||
#include <src/file_handler.h>
|
||||
|
||||
#include <tests/conftest.cpp>
|
||||
|
||||
TEST(FileHandlerTests, WriteFileTest) {
|
||||
EXPECT_EQ(file_handler::write_file("write_file_test.txt", "test"), 0);
|
||||
}
|
||||
|
||||
TEST(FileHandlerTests, ReadFileTest) {
|
||||
// read file from WriteFileTest
|
||||
EXPECT_EQ(file_handler::read_file("write_file_test.txt"), "test\n"); // sunshine adds a newline
|
||||
|
||||
// read missing file
|
||||
EXPECT_EQ(file_handler::read_file("non-existing-file.txt"), "");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue