From a177228238eb5113fa04dcd7d70e513ece402808 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Wed, 1 May 2013 17:47:14 +0200 Subject: [PATCH] RootFinding: simplify unit test --- .../RootFindingTests/BrentRootFinderTest.cs | 22 ------------------- .../RootFindingTests/BrentRootFindingTest.cs | 17 ++++++++++++++ src/UnitTests/UnitTests.csproj | 2 +- 3 files changed, 18 insertions(+), 23 deletions(-) delete mode 100644 src/UnitTests/RootFindingTests/BrentRootFinderTest.cs create mode 100644 src/UnitTests/RootFindingTests/BrentRootFindingTest.cs diff --git a/src/UnitTests/RootFindingTests/BrentRootFinderTest.cs b/src/UnitTests/RootFindingTests/BrentRootFinderTest.cs deleted file mode 100644 index 9c00ee76..00000000 --- a/src/UnitTests/RootFindingTests/BrentRootFinderTest.cs +++ /dev/null @@ -1,22 +0,0 @@ -using MathNet.Numerics.RootFinding; -using NUnit.Framework; -using System; - -namespace MathNet.Numerics.UnitTests.RootFindingTests -{ - [TestFixture] - public class BrentRootFinderTest - { - readonly BrentRootFinder _solver = new BrentRootFinder(100, 1e-14); - - [Test] - public void MultipleRoots() - { - Func f = (x) => { return x * x - 4; }; - _solver.Func = f; - double root = _solver.Solve(-5, 5); - - Assert.AreEqual(0, f(root)); - } - } -} diff --git a/src/UnitTests/RootFindingTests/BrentRootFindingTest.cs b/src/UnitTests/RootFindingTests/BrentRootFindingTest.cs new file mode 100644 index 00000000..4a264a91 --- /dev/null +++ b/src/UnitTests/RootFindingTests/BrentRootFindingTest.cs @@ -0,0 +1,17 @@ +using MathNet.Numerics.RootFinding; +using NUnit.Framework; + +namespace MathNet.Numerics.UnitTests.RootFindingTests +{ + [TestFixture] + public class BrentRootFindingTest + { + [Test] + public void MultipleRoots() + { + var solver = new BrentRootFinder(100, 1e-14) {Func = x => x*x - 4}; + double root = solver.Solve(-5, 5); + Assert.AreEqual(0, solver.Func(root)); + } + } +} diff --git a/src/UnitTests/UnitTests.csproj b/src/UnitTests/UnitTests.csproj index 552e2bef..916dc10f 100644 --- a/src/UnitTests/UnitTests.csproj +++ b/src/UnitTests/UnitTests.csproj @@ -770,7 +770,7 @@ - +