mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[apriltag] Clean up apriltag JNI (#4823)
This commit is contained in:
@@ -4,13 +4,24 @@
|
||||
|
||||
package edu.wpi.first.apriltag.jni;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class JNITest {
|
||||
@Test
|
||||
void jniLinkTest() {
|
||||
// Test to verify that the JNI test link works correctly.
|
||||
void validCreationTest() {
|
||||
var detector = AprilTagJNI.aprilTagCreate("tag16h5", 2.0, 0.0, 1, false, false);
|
||||
assertTrue(detector >= 0);
|
||||
AprilTagJNI.aprilTagDestroy(detector);
|
||||
}
|
||||
|
||||
@Test
|
||||
void invalidCreationTest() {
|
||||
var detector = AprilTagJNI.aprilTagCreate("badtag", 2.0, 0.0, 1, false, false);
|
||||
assertEquals(detector, -1);
|
||||
// Still call destroy to ensure passing a bad destroy value doesn't break
|
||||
AprilTagJNI.aprilTagDestroy(detector);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user