Committed. I reluctantly commented out NegativeBinomialTest.sample(),
since it was the straggler I couldn't fix. I was able to get it to
pass or fail reliably by just seeding the RNG differently, so I
somehow suspect the test conditions are too strict, or else it needs
to be simply re-tuned for the current RNG's behavior. Hope that's OK.
I also saw a very odd problem. The superclass of all test cases lives
in mahout-math, and defines a constant EPSILON to use for asserting
floating-point equality within bounds (you have to use an epsilon now
in JUnit 4). It all works fine. But for some reason when building with
Maven, this symbol is not visible across modules. Methods, all else
are.
I had to artificially stick a sub-superclass within each module that
redefines the constant. It works, isn't too messy, but isn't ideal. If
anyone has any clue what's going on I'd love to hear it.
All else should be OK, but, I wouldn't be shocked if some subtle issue
pops up once this hits Hudson. Bear with me.
So, the headline is: write JUnit 4 tests now.
public final class MyTest extends MahoutTestCase {
@Test
public void testFoo() {
assertEquals(3.1415926535, Math.PI, EPSILON);
}
}
On Fri, Sep 3, 2010 at 10:48 AM, Sean Owen <[email protected]> wrote:
> I've finished, and boy it did take some work. All the tests are on
> JUnit 4 and in the process have been standardized a bit (e.g. some
> tests were still manually managing temp files).
>
> I am having some strange trouble with NegativeBinomialTest -- passes
> in my IDE, not via Maven. I'd blame randomness but I have pretty
> thoroughly hunted down those causes. And it consistently passes/fails
> in these contexts.
>
> I am considering commenting out the one test that fails ("sample()")
> with a TODO and then asking for other eyes to look at this?
>
> Because this is a good big change I'd like to get in. It standardizes
> the tests a lot more.