forked from kscience/kmath
Fix incorrect properties in verifier classes
This commit is contained in:
parent
b8e9a7d327
commit
9fbca45235
@ -12,6 +12,8 @@ internal class FieldVerifier<T>(override val algebra: Field<T>, a: T, b: T, c: T
|
|||||||
super.verify()
|
super.verify()
|
||||||
|
|
||||||
algebra {
|
algebra {
|
||||||
|
assertEquals(a + b, b + a, "Addition in $algebra is not commutative.")
|
||||||
|
assertEquals(a * b, b * a, "Multiplication in $algebra is not commutative.")
|
||||||
assertNotEquals(a / b, b / a, "Division in $algebra is not anti-commutative.")
|
assertNotEquals(a / b, b / a, "Division in $algebra is not anti-commutative.")
|
||||||
assertNotEquals((a / b) / c, a / (b / c), "Division in $algebra is associative.")
|
assertNotEquals((a / b) / c, a / (b / c), "Division in $algebra is associative.")
|
||||||
assertEquals((a + b) / c, (a / c) + (b / c), "Division in $algebra is not right-distributive.")
|
assertEquals((a + b) / c, (a / c) + (b / c), "Division in $algebra is not right-distributive.")
|
||||||
|
@ -10,7 +10,7 @@ internal open class RingVerifier<T>(override val algebra: Ring<T>, a: T, b: T, c
|
|||||||
super.verify()
|
super.verify()
|
||||||
|
|
||||||
algebra {
|
algebra {
|
||||||
assertEquals(a * b, a * b, "Multiplication in $algebra is not commutative.")
|
assertEquals(a + b, b + a, "Addition in $algebra is not commutative.")
|
||||||
assertEquals(a * b * c, a * (b * c), "Multiplication in $algebra is not associative.")
|
assertEquals(a * b * c, a * (b * c), "Multiplication in $algebra is not associative.")
|
||||||
assertEquals(c * (a + b), (c * a) + (c * b), "Multiplication in $algebra is not distributive.")
|
assertEquals(c * (a + b), (c * a) + (c * b), "Multiplication in $algebra is not distributive.")
|
||||||
assertEquals(a * one, one * a, "$one in $algebra is not a neutral multiplication element.")
|
assertEquals(a * one, one * a, "$one in $algebra is not a neutral multiplication element.")
|
||||||
|
@ -15,7 +15,6 @@ internal open class SpaceVerifier<T>(
|
|||||||
AlgebraicVerifier<T, Space<T>> {
|
AlgebraicVerifier<T, Space<T>> {
|
||||||
override fun verify() {
|
override fun verify() {
|
||||||
algebra {
|
algebra {
|
||||||
assertEquals(a + b, b + a, "Addition in $algebra is not commutative.")
|
|
||||||
assertEquals(a + b + c, a + (b + c), "Addition in $algebra is not associative.")
|
assertEquals(a + b + c, a + (b + c), "Addition in $algebra is not associative.")
|
||||||
assertEquals(x * (a + b), x * a + x * b, "Addition in $algebra is not distributive.")
|
assertEquals(x * (a + b), x * a + x * b, "Addition in $algebra is not distributive.")
|
||||||
assertEquals((a + b) * x, a * x + b * x, "Addition in $algebra is not distributive.")
|
assertEquals((a + b) * x, a * x + b * x, "Addition in $algebra is not distributive.")
|
||||||
|
Loading…
Reference in New Issue
Block a user