Package name.abuchen.portfolio.math

Source Code of name.abuchen.portfolio.math.PseudoDerivateFunctionTest

package name.abuchen.portfolio.math;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

import java.math.BigDecimal;

import name.abuchen.portfolio.math.PseudoDerivativeFunction;
import name.abuchen.portfolio.math.NewtonGoalSeek.Function;

import org.junit.Test;

public class PseudoDerivateFunctionTest
{
    @Test
    public void testSimple()
    {

        Function f = new Function()
        {
            @Override
            public double compute(double x)
            {
                return x;
            }
        };

        PseudoDerivativeFunction p = new PseudoDerivativeFunction(f);

        double result = p.compute(1d);

        assertThat(new BigDecimal(result).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue(), is(1d));
    }
}
TOP

Related Classes of name.abuchen.portfolio.math.PseudoDerivateFunctionTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.