// Copyright (C) Stichting Deltares 2025. All rights reserved. // // This file is part of the Dam Engine. // // The Dam Engine is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon; using NUnit.Framework; namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.MacroStabilityCommon; public static class CompareHelper { public static void CompareUpliftVanCalculationGrid(UpliftVanCalculationGrid expectedSlipPlaneUpliftVan, UpliftVanCalculationGrid actualSlipPlaneUpliftVan, bool areTangentLineSpecified) { const double tolerance = 1e-3; Assert.Multiple(() => { Assert.That(actualSlipPlaneUpliftVan.LeftGridXLeft, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridXLeft).Within(tolerance)); Assert.That(actualSlipPlaneUpliftVan.LeftGridXRight, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridXRight).Within(tolerance)); Assert.That(actualSlipPlaneUpliftVan.LeftGridZTop, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridZTop).Within(tolerance)); Assert.That(actualSlipPlaneUpliftVan.LeftGridZBottom, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridZBottom).Within(tolerance)); Assert.That(actualSlipPlaneUpliftVan.LeftGridXCount, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridXCount)); Assert.That(actualSlipPlaneUpliftVan.LeftGridZCount, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridZCount)); Assert.That(actualSlipPlaneUpliftVan.RightGridXLeft, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridXLeft).Within(tolerance)); Assert.That(actualSlipPlaneUpliftVan.RightGridXRight, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridXRight).Within(tolerance)); Assert.That(actualSlipPlaneUpliftVan.RightGridZTop, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridZTop).Within(tolerance)); Assert.That(actualSlipPlaneUpliftVan.RightGridZBottom, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridZBottom).Within(tolerance)); Assert.That(actualSlipPlaneUpliftVan.RightGridXCount, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridXCount)); Assert.That(actualSlipPlaneUpliftVan.RightGridZCount, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridZCount)); }); if (areTangentLineSpecified) { Assert.That(actualSlipPlaneUpliftVan.TangentLineLevels, Is.EqualTo(expectedSlipPlaneUpliftVan.TangentLineLevels).AsCollection.Within(tolerance)); } } }