Home | History | Annotate | Download | only in test
      1 package org.opencv.test.core;
      2 
      3 import org.opencv.core.DMatch;
      4 
      5 import junit.framework.TestCase;
      6 
      7 public class DMatchTest extends TestCase {
      8     public void testDMatch() {
      9         new DMatch();
     10     }
     11 
     12     public void testDMatchIntIntFloat() {
     13         DMatch dm1 = new DMatch(1, 4, 4.0f);
     14 
     15         assertEquals(1, dm1.queryIdx);
     16         assertEquals(4, dm1.trainIdx);
     17         assertEquals(4.0f, dm1.distance);
     18     }
     19 
     20     public void testDMatchIntIntIntFloat() {
     21         DMatch dm2 = new DMatch(2, 6, -1, 8.0f);
     22 
     23         assertEquals(2, dm2.queryIdx);
     24         assertEquals(6, dm2.trainIdx);
     25         assertEquals(-1, dm2.imgIdx);
     26         assertEquals(8.0f, dm2.distance);
     27     }
     28 
     29     public void testLessThan() {
     30         DMatch dm1 = new DMatch(1, 4, 4.0f);
     31         DMatch dm2 = new DMatch(2, 6, -1, 8.0f);
     32         assertTrue(dm1.lessThan(dm2));
     33     }
     34 
     35     public void testToString() {
     36         DMatch dm2 = new DMatch(2, 6, -1, 8.0f);
     37 
     38         String actual = dm2.toString();
     39 
     40         String expected = "DMatch [queryIdx=2, trainIdx=6, imgIdx=-1, distance=8.0]";
     41         assertEquals(expected, actual);
     42     }
     43 
     44 }
     45