Tests: Refactor tests with better names, etc.

The basic tests now run on Windows correctly without needing to manually
copy any files -- the executables are output in the same location as the
necessary DLLs. However, tests that require *.pyd files (all code in the
Mod subdirectory, basically) still do not work on Windows as the test
executables cannot find those files. This is a work in progress.
This commit is contained in:
Chris Hennes
2025-06-15 10:29:41 -05:00
committed by Chris Hennes
parent 376b162239
commit 98eee8a563
30 changed files with 138 additions and 87 deletions

View File

@@ -44,7 +44,8 @@ protected:
void SetUp() override
{
_tempDir = std::filesystem::temp_directory_path() / ("fc_backup_policy-" + randomString(16));
_tempDir =
std::filesystem::temp_directory_path() / ("fc_backup_policy-" + randomString(16));
std::filesystem::create_directory(_tempDir);
}
@@ -79,13 +80,11 @@ protected:
private:
std::string randomString(size_t length)
{
static constexpr std::string_view chars =
"0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static constexpr std::string_view chars = "0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::random_device rd;
std::mt19937 gen(rd());
@@ -103,7 +102,6 @@ private:
App::BackupPolicy _policy;
std::filesystem::path _tempDir;
};
TEST_F(BackupPolicyTest, StandardSourceDoesNotExist)
@@ -113,4 +111,4 @@ TEST_F(BackupPolicyTest, StandardSourceDoesNotExist)
// Act & Assert
EXPECT_THROW(apply("nonexistent.fcstd", "backup.fcstd"), Base::FileException);
}
}