Browse Source

Added test code for FileOperation of the Configuration subsystem.

master
DomtronVox 1 year ago
parent
commit
0d24c74aa4
2 changed files with 39 additions and 0 deletions
  1. +5
    -0
      tests/CMakeLists.txt
  2. +34
    -0
      tests/test_FileOperations.cpp

+ 5
- 0
tests/CMakeLists.txt View File

@ -1,6 +1,11 @@
#pull in the project's headers
include_directories( ${PROJECT_HEADER_DIR} )
#add FileOperations unit test
ADD_EXECUTABLE( test_FileOperations test_FileOperations.cpp )
target_link_libraries( test_FileOperations ModdingFramework)
ADD_TEST( FileOperations test_FileOperations )
#add ConfigStore unit test
ADD_EXECUTABLE( test_ConfigStore test_ConfigStore.cpp )
target_link_libraries( test_ConfigStore ModdingFramework)


+ 34
- 0
tests/test_FileOperations.cpp View File

@ -0,0 +1,34 @@
#include "TestBase.h"
#include "Configuration/FileOperations.h"
int main (int argc, char* argv[]) {
//TEST_BEGIN( "test1" );
//ASSERT_EQUAL( 0, 0 );
//ASSERT_THROW( 0 == 0 );
//EXPECT_EXCEPTION( fakeFileLoad("does_not_exist.txt"), FileNotFound );
//TEST_END();
TEST_BEGIN( "Test trimString" );
ASSERT_THROW( trimString(" roo") == "roo" );
ASSERT_THROW( trimString("roo ") == "roo" );
ASSERT_THROW( trimString(" roo ") == "roo" );
ASSERT_THROW( trimString(" roo ") == "roo" );
TEST_END();
//TODO need way to test the GetCurrentDir function reliably
/*TEST_BEGIN( "Test cleanPath" );
ASSERT_THROW( cleanPath("/path/to/location") == "/path/to/location" );
ASSERT_THROW( cleanPath("../../path") == "/path" );
ASSERT_THROW( cleanPath("./path") == "/path" );
ASSERT_THROW( cleanPath("//path//to") == "/path/to" );
TEST_END();*/
return 0;
}

Loading…
Cancel
Save