Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed rectification or normal distribution
- Loading branch information
1 parent
7213f25
commit 46e648f
Showing
2 changed files
with
33 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.kalasim.test | ||
|
||
import io.kotest.matchers.doubles.shouldBeGreaterThanOrEqual | ||
import org.junit.Test | ||
import org.kalasim.Environment | ||
import org.kalasim.normal | ||
import kotlin.time.Duration.Companion.days | ||
import kotlin.time.DurationUnit | ||
|
||
class DistributionTests { | ||
|
||
@Test | ||
fun `it should correctly rectify a normal distribution`() { | ||
|
||
Environment().apply { | ||
val tbf = normal(3.days, 2.days, rectify = true) | ||
val tbf2 = normal(3, 2, rectify = true) | ||
|
||
repeat(1000) { | ||
tbf().toDouble(DurationUnit.HOURS) shouldBeGreaterThanOrEqual 0.0 | ||
tbf2.sample() shouldBeGreaterThanOrEqual 0.0 | ||
} | ||
} | ||
} | ||
} |