diff --git a/tests/ModelScaleGPUTest.cpp b/tests/ModelScaleGPUTest.cpp index 3728c81b9..8dbd576f8 100644 --- a/tests/ModelScaleGPUTest.cpp +++ b/tests/ModelScaleGPUTest.cpp @@ -212,8 +212,12 @@ void CheckSameScale(const ModelScaleParams &gpu, const gemmi::Scaling &cp const double b_cpu[6] = {cpu.b_star.u11, cpu.b_star.u22, cpu.b_star.u33, cpu.b_star.u12, cpu.b_star.u13, cpu.b_star.u23}; CHECK(std::fabs(gpu.k_overall - cpu.k_overall) <= 1e-4 * std::fabs(cpu.k_overall)); + // b_star = F B_cart F^T, so a B of 0.001 A^2 is 0.001 / a^2 in it for the longest edge a. Without that + // floor a fit whose B comes out near zero is held to 1e-4 of almost nothing (a cubic case at B 0.6 A^2 + // differed by 1e-4 A^2). + const double edge = std::max({cpu.cell.a, cpu.cell.b, cpu.cell.c}); for (int i = 0; i < 6; i++) - CHECK(std::fabs(gpu.b_star[i] - b_cpu[i]) <= 1e-4 * MaxAbs(b_cpu) + 1e-12); + CHECK(std::fabs(gpu.b_star[i] - b_cpu[i]) <= 1e-4 * MaxAbs(b_cpu) + 1e-3 / (edge * edge)); } struct Case { diff --git a/tests/WriteReflectionsTest.cpp b/tests/WriteReflectionsTest.cpp index 83ed12ab7..7f3e070ab 100644 --- a/tests/WriteReflectionsTest.cpp +++ b/tests/WriteReflectionsTest.cpp @@ -200,10 +200,13 @@ TEST_CASE("SHELX .hkl of unmerged fulls: fixed 3I4,2F8.2, scaled to fit, 0 0 0 t const auto path = (std::filesystem::temp_directory_path() / "jfjoch_scaled_fulls_test.hkl").string(); WriteShelxHklReflections(fulls, path, 2); - std::ifstream in(path); std::vector lines; - for (std::string line; std::getline(in, line);) - lines.push_back(line); + { + // Closed before the remove: Windows refuses to delete a file that is still open. + std::ifstream in(path); + for (std::string line; std::getline(in, line);) + lines.push_back(line); + } std::filesystem::remove(path); REQUIRE(lines.size() == 4);