forked from kscience/kmath
Replaced assertFailsWith with assertFailsWithTypeAndMessage.
This commit is contained in:
parent
102e83b478
commit
39088ec36b
@ -8,16 +8,22 @@ package space.kscience.kmath.functions
|
|||||||
import space.kscience.kmath.misc.UnstableKMathAPI
|
import space.kscience.kmath.misc.UnstableKMathAPI
|
||||||
import space.kscience.kmath.test.misc.Rational
|
import space.kscience.kmath.test.misc.Rational
|
||||||
import space.kscience.kmath.test.misc.RationalField
|
import space.kscience.kmath.test.misc.RationalField
|
||||||
|
import space.kscience.kmath.test.misc.assertFailsWithTypeAndMessage
|
||||||
import kotlin.test.Ignore
|
import kotlin.test.Ignore
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertFailsWith
|
|
||||||
|
|
||||||
|
|
||||||
@OptIn(UnstableKMathAPI::class)
|
@OptIn(UnstableKMathAPI::class)
|
||||||
class ListPolynomialUtilTest {
|
class ListPolynomialUtilTest {
|
||||||
@Test
|
@Test
|
||||||
fun test_Polynomial_substitute_Double() {
|
fun test_Polynomial_substitute_Double() {
|
||||||
|
assertEquals(
|
||||||
|
0.0,
|
||||||
|
ListPolynomial(1.0, -2.0, 1.0).substitute(1.0),
|
||||||
|
0.001,
|
||||||
|
"test 1"
|
||||||
|
)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
0.0,
|
0.0,
|
||||||
ListPolynomial(1.0, -2.0, 1.0).substitute(1.0),
|
ListPolynomial(1.0, -2.0, 1.0).substitute(1.0),
|
||||||
@ -859,7 +865,10 @@ class ListPolynomialUtilTest {
|
|||||||
ListPolynomial(Rational(1), Rational(-2), Rational(1)).nthDerivative(RationalField, 1),
|
ListPolynomial(Rational(1), Rational(-2), Rational(1)).nthDerivative(RationalField, 1),
|
||||||
"test 1"
|
"test 1"
|
||||||
)
|
)
|
||||||
assertFailsWith<IllegalArgumentException>("test2") {
|
assertFailsWithTypeAndMessage<IllegalArgumentException>(
|
||||||
|
"Order of derivative must be non-negative",
|
||||||
|
"test2"
|
||||||
|
) {
|
||||||
ListPolynomial(Rational(1), Rational(-2), Rational(1)).nthDerivative(RationalField, -1)
|
ListPolynomial(Rational(1), Rational(-2), Rational(1)).nthDerivative(RationalField, -1)
|
||||||
}
|
}
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -928,7 +937,10 @@ class ListPolynomialUtilTest {
|
|||||||
ListPolynomial(Rational(1), Rational(-2), Rational(1)).nthAntiderivative(RationalField, 1),
|
ListPolynomial(Rational(1), Rational(-2), Rational(1)).nthAntiderivative(RationalField, 1),
|
||||||
"test 1"
|
"test 1"
|
||||||
)
|
)
|
||||||
assertFailsWith<IllegalArgumentException>("test2") {
|
assertFailsWithTypeAndMessage<IllegalArgumentException>(
|
||||||
|
"Order of antiderivative must be non-negative",
|
||||||
|
"test2"
|
||||||
|
) {
|
||||||
ListPolynomial(Rational(1), Rational(-2), Rational(1)).nthAntiderivative(RationalField, -1)
|
ListPolynomial(Rational(1), Rational(-2), Rational(1)).nthAntiderivative(RationalField, -1)
|
||||||
}
|
}
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
Loading…
Reference in New Issue
Block a user