Skip to content
Snippets Groups Projects
Commit 0697084e authored by a.croix's avatar a.croix
Browse files

Add new tests

parent cbab63de
No related branches found
No related tags found
No related merge requests found
Pipeline #2086 passed
package be.cylab.java.roc;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import static org.junit.jupiter.api.Assertions.*;
class UtilsTest {
List<Point> points;
@BeforeEach
void setUp() {
points = new ArrayList<>();
Random rnd = new Random(5875);
for (int i = 0; i < 30; i++) {
double score = rnd.nextDouble();
if (rnd.nextDouble() < 0.5) {
points.add(new Point(score, false));
} else {
points.add(new Point(score, true));
}
}
}
@AfterEach
void tearDown() {
}
@Test
void testCountPositiveExamples() {
assertEquals(20, Utils.countPositiveExamples(points));
}
@Test
void testCountNegativeExamples() {
assertEquals(10, Utils.countNegativeExamples(points));
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment