Updated filemanager to use dynamically allocated strings

converted filename to dynamically allocated string
created cstr_helper
This commit is contained in:
Michael Tryby
2019-04-02 11:05:56 -04:00
parent 2c6d4ca74d
commit c98d13de80
7 changed files with 73 additions and 24 deletions

View File

@@ -7,11 +7,14 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
add_executable(test_errormanager ./test_errormanager.cpp ../../src/util/errormanager.c)
add_executable(test_errormanager ./test_errormanager.cpp
../../src/util/errormanager.c)
target_include_directories(test_errormanager PUBLIC ../../src/)
target_link_libraries(test_errormanager ${Boost_LIBRARIES})
add_executable(test_filemanager ./test_filemanager.cpp ../../src/util/filemanager.c)
add_executable(test_filemanager ./test_filemanager.cpp
../../src/util/filemanager.c
../../src/util/cstr_helper.c)
target_include_directories(test_filemanager PUBLIC ../../src/)
target_link_libraries(test_filemanager ${Boost_LIBRARIES})

View File

@@ -80,10 +80,11 @@ struct Fixture{
BOOST_FIXTURE_TEST_CASE(test_temp_file, Fixture)
{
char *filename;
size_t size;
printf_file(file_handle, "%s", "This is a test.");
get_filename(file_handle, &filename);
get_filename(file_handle, &filename, &size);
//BOOST_CHECK(check_string(filename, "./test_file.txt"));
BOOST_CHECK(boost::filesystem::exists(filename) == true);