
/*
 * Carrot2 project.
 *
 * Copyright (C) 2002-2009, Dawid Weiss, Stanisław Osiński.
 * All rights reserved.
 *
 * Refer to the full license file "carrot2.LICENSE"
 * in the root folder of the repository checkout or at:
 * http://www.carrot2.org/carrot2.LICENSE
 */

package org.carrot2.util.test;

import static org.fest.assertions.Assertions.assertThat;

import org.fest.assertions.AssertExtension;
import org.fest.assertions.DoubleAssert;
import org.fest.assertions.DoubleAssert.Delta;

/**
 * Additional assertions on <code>double []</code> arrays.
 */
public class DoubleArrayAssert implements AssertExtension
{
    /** The actual array */
    private double [] actualArray;

    /** Description of the assertion */
    private String description;

    DoubleArrayAssert(double [] array)
    {
        this.actualArray = array;
    }

    /**
     * Asserts that the array is equal to the provided with a <code>delta</code> on each
     * element.
     */
    public DoubleArrayAssert isEqualTo(double [] expected, double delta)
    {
        assertThat(expected).as(description).isNotNull();
        assertThat(actualArray.length).as(description).isEqualTo(expected.length);

        final Delta deltaObject = DoubleAssert.delta(delta);
        for (int i = 0; i < expected.length; i++)
        {
            assertThat(actualArray[i]).as(description + "[" + i + "]").isEqualTo(
                expected[i], deltaObject);
        }
        return this;
    }

    public DoubleArrayAssert as(String description)
    {
        this.description = description;
        return this;
    }
}

@@ -427,62 +427,8 @@
 ons.
-DoubleAssert;%0Aimport org.fest.assertions.DoubleAssert.
 Delt
@@ -1162,19 +1162,12 @@
  = D
-oubleAssert
+elta
 .del

Use newer versions of deprecated methods.