Java and junit: derivative of polynomial method testing issue
- by Curtis
Hello all, im trying to finish up my junit testing for finding the derivative of a polynomial method and im having some trouble making it work. here is the method:
public Polynomial derivative() {
MyDouble a = new MyDouble(0);
MyDouble b = this.a.add(this.a);
MyDouble c = this.b;
Polynomial poly = new Polynomial (a, b, c);
return poly;
}
and here is the junit test:
public void testDerivative() {
MyDouble a = new MyDouble(2), b = new MyDouble(4), c = new MyDouble(8);
MyDouble d = new MyDouble(0), e = new MyDouble(4), f = new MyDouble(4);
Polynomial p1 = new Polynomial(a, b, c);
Polynomial p2 = new Polynomial(d,e,f);
assertTrue(p1.derivative().equals(p2));
}
im not too sure why it isnt working...ive gone over it again and again and i know im missing something. thank you all for any help given, appreciate it