|
BoosterSeat
0.1
A C++ library that includes common utilities that are used in other projects.
|
#include <BoosterSeat/exception.hpp>#include <BoosterSeat/filesystem.hpp>#include <BoosterSeat/numbers.hpp>#include "gtest/gtest.h"#include <filesystem>#include <fstream>#include <sstream>Macros | |
| #define | NO_PERM_CHECKS |
Functions | |
| void | createFileOfSizeMb (const std::string file_path, const int file_size_mb) |
| TEST (bst_filesystem, appendToFile) | |
| TEST (bst_filesystem, copyFile) | |
| TEST (bst_filesystem, createFile) | |
| TEST (bst_filesystem, deleteFile) | |
| TEST (bst_filesystem, directorySize) | |
| TEST (bst_filesystem, doesDirectoryExist_createDirectory) | |
| TEST (bst_filesystem, doesFileExist) | |
| TEST (bst_filesystem, getFileName) | |
| TEST (bst_filesystem, getFileSize) | |
| TEST (bst_filesystem, hasReadPermission) | |
| TEST (bst_filesystem, hasWritePermission) | |
| TEST (bst_filesystem, moveFileTest) | |
| TEST (bst_filesystem, NO_PERM_hasWritePermission) | |
| TEST (bst_filesystem, overwriteFile) | |
| void | validateSize (const double size, const double expected_size) |
| #define NO_PERM_CHECKS |
Manually need to create files/directories for "NO_PERM_CHECKS".
In the same directory as the executable, create the following with no read/write permissions for the user: ./perm_test_dir ./perm_test_dir/perm_test_file.txt
|
inline |
| TEST | ( | bst_filesystem | , |
| doesFileExist | |||
| ) |
References bst::filesystem::doesFileExist(), bst::BoosterSeatException::errorNumberEnum(), and bst::FS_PATH_NOT_REGULAR_FILE.
| TEST | ( | bst_filesystem | , |
| createFile | |||
| ) |
References bst::filesystem::createFile(), bst::filesystem::doesFileExist(), bst::BoosterSeatException::errorNumberEnum(), bst::fs_int::exists(), and bst::FS_PATH_ALREADY_EXISTS.
| TEST | ( | bst_filesystem | , |
| appendToFile | |||
| ) |
References bst::filesystem::appendToFile(), bst::BoosterSeatException::errorNumberEnum(), and bst::FS_PATH_DOES_NOT_EXIST.
| TEST | ( | bst_filesystem | , |
| overwriteFile | |||
| ) |
References bst::BoosterSeatException::errorNumberEnum(), bst::FS_PATH_DOES_NOT_EXIST, and bst::filesystem::overwriteFile().
|
inline |
References bst::isApproxEqualPercent().
Referenced by TEST().
| TEST | ( | bst_filesystem | , |
| getFileSize | |||
| ) |
References createFileOfSizeMb(), bst::filesystem::getFileSize(), and validateSize().
| TEST | ( | bst_filesystem | , |
| deleteFile | |||
| ) |
References bst::filesystem::deleteFile(), bst::filesystem::doesFileExist(), bst::BoosterSeatException::errorNumberEnum(), and bst::FS_PATH_DOES_NOT_EXIST.
| TEST | ( | bst_filesystem | , |
| doesDirectoryExist_createDirectory | |||
| ) |
References bst::filesystem::createDirectory(), bst::filesystem::doesDirectoryExist(), bst::filesystem::doesFileExist(), bst::BoosterSeatException::errorNumberEnum(), bst::fs_int::exists(), and bst::FS_PATH_NOT_DIRECTORY.
| TEST | ( | bst_filesystem | , |
| directorySize | |||
| ) |
References bst::filesystem::createDirectory(), createFileOfSizeMb(), bst::fs_int::exists(), bst::filesystem::getDirectorySize(), and validateSize().
| TEST | ( | bst_filesystem | , |
| hasWritePermission | |||
| ) |
| TEST | ( | bst_filesystem | , |
| hasReadPermission | |||
| ) |
| TEST | ( | bst_filesystem | , |
| NO_PERM_hasWritePermission | |||
| ) |
| TEST | ( | bst_filesystem | , |
| moveFileTest | |||
| ) |
References bst::filesystem::createDirectory(), bst::filesystem::doesFileExist(), bst::fs_int::exists(), and bst::filesystem::moveFile().
| TEST | ( | bst_filesystem | , |
| getFileName | |||
| ) |
| TEST | ( | bst_filesystem | , |
| copyFile | |||
| ) |
References bst::filesystem::appendToFile(), bst::filesystem::copyFile(), bst::filesystem::createFile(), bst::filesystem::doesFileExist(), bst::BoosterSeatException::errorNumberEnum(), bst::fs_int::exists(), bst::FS_PATH_ALREADY_EXISTS, and bst::filesystem::getFileSizeBytes().