Changeset 17299


Ignore:
Timestamp:
10/03/19 10:10:35 (12 days ago)
Author:
gkronber
Message:

#2994 add a unit test for Abs()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/AutoDiffIntervalTest.cs

    r17293 r17299  
    214214    [TestCategory("Problems.DataAnalysis")]
    215215    [TestProperty("Time", "short")]
     216    public void TestIntervalAbsOperator() {
     217      AssertAreEqualInterval(new AlgebraicInterval(1, 2), new AlgebraicInterval(1, 2).Abs());
     218      AssertAreEqualInterval(new AlgebraicInterval(1, 2), new AlgebraicInterval(-2, -1).Abs());
     219      AssertAreEqualInterval(new AlgebraicInterval(0, 2), new AlgebraicInterval(-2, 2).Abs());
     220      AssertAreEqualInterval(new AlgebraicInterval(0, double.PositiveInfinity), new AlgebraicInterval(double.NegativeInfinity, double.PositiveInfinity).Abs());
     221      AssertAreEqualInterval(new AlgebraicInterval(double.NaN, 1), new AlgebraicInterval(-1, double.NaN).Abs()); // XXX unclear how we should handle NaN
     222      AssertAreEqualInterval(new AlgebraicInterval(double.NaN, 1), new AlgebraicInterval(double.NaN, -1).Abs());
     223    }
     224
     225
     226    [TestMethod]
     227    [TestCategory("Problems.DataAnalysis")]
     228    [TestProperty("Time", "short")]
    216229    public void TestIntervalCbrtOperator() {
    217230      AssertAreEqualInterval(new AlgebraicInterval(1, 2), CubicRoot(new AlgebraicInterval(1, 8)));
Note: See TracChangeset for help on using the changeset viewer.