forked from kscience/kmath
Added usage of more correct exceptions.
This commit is contained in:
parent
25ec59b985
commit
88e0dcf413
@ -295,7 +295,7 @@ public interface AbstractPolynomialSpace<C, P: AbstractPolynomial<C>> : Ring<P>
|
||||
* If polynomial is a constant polynomial represents and returns it as constant.
|
||||
* Otherwise, (when the polynomial is not constant polynomial) raises corresponding exception.
|
||||
*/
|
||||
public fun P.asConstant(): C = asConstantOrNull() ?: error("Can not represent non-constant polynomial as a constant")
|
||||
public fun P.asConstant(): C = requireNotNull(asConstantOrNull()) { "Can not represent non-constant polynomial as a constant" }
|
||||
|
||||
override fun add(left: P, right: P): P = left + right
|
||||
override fun multiply(left: P, right: P): P = left * right
|
||||
|
@ -460,7 +460,7 @@ public interface AbstractRationalFunctionalSpace<C, P: AbstractPolynomial<C>, R:
|
||||
* If polynomial is a constant polynomial represents and returns it as constant.
|
||||
* Otherwise, (when the polynomial is not constant polynomial) raises corresponding exception.
|
||||
*/
|
||||
public fun P.asConstant(): C = asConstantOrNull() ?: error("Can not represent non-constant polynomial as a constant")
|
||||
public fun P.asConstant(): C = requireNotNull(asConstantOrNull()) { "Can not represent non-constant polynomial as a constant" }
|
||||
|
||||
/**
|
||||
* Degree of the polynomial, [see also](https://en.wikipedia.org/wiki/Degree_of_a_polynomial). If the polynomial is
|
||||
|
@ -11,6 +11,7 @@ import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFailsWith
|
||||
|
||||
|
||||
class PolynomialUtilTest {
|
||||
@Test
|
||||
fun test_substitute_Double() {
|
||||
|
Loading…
Reference in New Issue
Block a user