views:

160

answers:

4

Can't believe I don't know the answer to this, but getting late and SO is my only hope of getting some decent sleep ;)

So far I know these are not it: assert solver.solveArray(array3) == -1 assert solver.solveArray(array3) == (-1)

+1  A: 

assertEquals("message", expectedNegativeValue, func() ); ??

anjanb
Oh, are we using JUnit?
Chris Conway
+1  A: 

In what way do you know those aren't it? This short but complete program works fine:

public class Solver
{
    public static void main(String[] args)
    {
        Solver solver = new Solver();
        assert solver.solveArray(-1) == -1; // Pass
        assert solver.solveArray(-1) == 2;  // Fail
    }

    int solveArray(int x)
    {
        return x;
    }
}
Jon Skeet
+1  A: 

Hard to say based on what you've written, but you may need parentheses

assert( solver.solveArray(array3) == -1 )
Chris Conway
A: 

My algorithm was fubar.... thanks for the help anyways

DanielHonig