feat: complete first MITC4 FEAST eigen implementation validation
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#define NOMINMAX
|
||||
#include "fesa/io/hdf5/eigen_hdf5_results_writer.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hdf5.h>
|
||||
|
||||
@@ -113,6 +115,22 @@ TEST(EigenHdf5ResultsWriter, WritesModalSchemaAndRejectsTamperedState) {
|
||||
const std::string retained{std::istreambuf_iterator<char>{retained_file}, {}};
|
||||
EXPECT_TRUE(retained == original);
|
||||
retained_file.close();
|
||||
// Denying delete sharing forces the actual atomic replacement to fail after
|
||||
// writing and validating a fresh candidate, while retaining a valid final.
|
||||
const HANDLE lock = CreateFileW(path.c_str(), GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
ASSERT_NE(lock, INVALID_HANDLE_VALUE);
|
||||
const auto locked_write = writer.Write(path, domain, state, {});
|
||||
EXPECT_NE(CloseHandle(lock), 0);
|
||||
ASSERT_FALSE(locked_write.IsOk());
|
||||
ASSERT_FALSE(locked_write.Diagnostics().empty());
|
||||
EXPECT_EQ(locked_write.Diagnostics()[0].code, "hdf5-finalization-failure");
|
||||
std::ifstream locked_final{path, std::ios::binary};
|
||||
const std::string after_failure{std::istreambuf_iterator<char>{locked_final},
|
||||
{}};
|
||||
EXPECT_EQ(after_failure, original);
|
||||
locked_final.close();
|
||||
ASSERT_TRUE(
|
||||
fesa::hdf5_internal::SelfCheckEigenFile(path, domain, state, {}).IsOk());
|
||||
const hid_t corrupt_file =
|
||||
|
||||
Reference in New Issue
Block a user