Skip to content

Commit

Permalink
minor fix of unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
haifengl committed Jul 20, 2017
1 parent 8922d8f commit 9913f8e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
17 changes: 13 additions & 4 deletions nd4j/src/test/java/smile/nd4j/NDMatrixTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,22 @@ public void testMm() {
{-0.2808735, -0.9403636, -0.19190231},
{0.1159052, 0.1652528, -0.97941688}
};
double[][] D = {
{ 0.9887140, 0.1482942, -0.0212965},
{ 0.1482942, -0.9889421, -0.0015881},
{-0.0212965, -0.0015881, -0.9997719 }
};
double[][] E = {
{0.0000, 0.0000, 1.0000},
{0.0000, -1.0000, 0.0000},
{1.0000, 0.0000, 0.0000}
};

NDMatrix a = new NDMatrix(A);
NDMatrix b = new NDMatrix(B);
System.out.println(a.atbmm(b));
assertTrue(Math.equals(a.abmm(b).array(), C, 1E-7));
Math.abtmm(A, B, C);
assertTrue(Math.equals(a.abtmm(b).array(), C, 1E-7));
Math.atbmm(A, B, C);
assertTrue(Math.equals(a.atbmm(b).array(), C, 1E-7));
assertTrue(Math.equals(a.abtmm(b).array(), D, 1E-7));
assertTrue(Math.equals(a.atbmm(b).array(), E, 1E-5));
}
}
6 changes: 3 additions & 3 deletions nlp/src/test/java/smile/nlp/SimpleCorpusTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ public void testSearch2() {
*/
@Test
public void testSearch2WithNoHits() {
System.out.println("search 'romantic comedy'");
String[] terms = {"find", "words"};
System.out.println("search 'no hits'");
String[] terms = {"thisisnotaword"};
Iterator<Relevance> hits = corpus.search(new BM25(), terms);
assertEquals(Collections.emptyIterator(),hits);
assertEquals(false, hits.hasNext());
}
}

0 comments on commit 9913f8e

Please sign in to comment.