Java and junit: derivative of polynomial method testing issue

Posted by Curtis on Stack Overflow See other posts from Stack Overflow or by Curtis
Published on 2010-03-30T20:42:12Z Indexed on 2010/03/30 20:43 UTC
Read the original article Hit count: 629

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about java

Related posts about junit