mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-28 01:55:28 +02:00
Probability factory should live within the interface
This commit is contained in:
@@ -10,7 +10,7 @@ import java.util.stream.Stream;
|
||||
import static com.gmail.nossr50.util.random.RandomChanceUtil.processProbability;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class RandomChanceUtilTest {
|
||||
class ProbabilityFactoryTest {
|
||||
|
||||
private static Stream<Arguments> provideProbabilitiesForWithinExpectations() {
|
||||
return Stream.of(
|
||||
@@ -48,6 +48,15 @@ class RandomChanceUtilTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testIsSuccessfulRollFailsOfPercentage() {
|
||||
Probability probability = Probability.ofPercentageValue(100);
|
||||
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
assertFalse(processProbability(probability));
|
||||
}
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideProbabilitiesForWithinExpectations")
|
||||
void testProcessProbabilityWithinExpectations(Probability probability, double expectedWinPercent) {
|
||||
@@ -67,10 +76,10 @@ class RandomChanceUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void chanceOfSuccessPercentage() {
|
||||
void ofPercentageValue() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testChanceOfSuccessPercentage() {
|
||||
void ofSubSkill() {
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.gmail.nossr50.util.random;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.gmail.nossr50.util.random.RandomChanceUtil.processProbability;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class ProbabilityTest {
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
void chanceOfSuccessPercentage() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testChanceOfSuccessPercentage() {
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user