#![allow(non_snake_case)]
use proptest_derive::*;
use un_algebra::tests::*;
use un_algebra::prelude::*;
#[derive(Clone, Copy, PartialEq, Debug, Arbitrary)]
pub enum D3 {
R0, R1, R2, L1, L2, L3
}
impl Magma for D3 {
fn op(&self, other: &Self) -> Self {
match (self, other) {
(D3::R0, D3::R0) => D3::R0,
(D3::R0, D3::R1) => D3::R1,
(D3::R0, D3::R2) => D3::R2,
(D3::R0, D3::L1) => D3::L1,
(D3::R0, D3::L2) => D3::L2,
(D3::R0, D3::L3) => D3::L3,
(D3::R1, D3::R0) => D3::R1,
(D3::R1, D3::R1) => D3::R2,
(D3::R1, D3::R2) => D3::R0,
(D3::R1, D3::L1) => D3::L3,
(D3::R1, D3::L2) => D3::L1,
(D3::R1, D3::L3) => D3::L2,
(D3::R2, D3::R0) => D3::R2,
(D3::R2, D3::R1) => D3::R0,
(D3::R2, D3::R2) => D3::R1,
(D3::R2, D3::L1) => D3::L2,
(D3::R2, D3::L2) => D3::L3,
(D3::R2, D3::L3) => D3::L1,
(D3::L1, D3::R0) => D3::L1,
(D3::L1, D3::R1) => D3::L2,
(D3::L1, D3::R2) => D3::L3,
(D3::L1, D3::L1) => D3::R0,
(D3::L1, D3::L2) => D3::R1,
(D3::L1, D3::L3) => D3::R2,
(D3::L2, D3::R0) => D3::L2,
(D3::L2, D3::R1) => D3::L3,
(D3::L2, D3::R2) => D3::L1,
(D3::L2, D3::L1) => D3::R2,
(D3::L2, D3::L2) => D3::R0,
(D3::L2, D3::L3) => D3::R1,
(D3::L3, D3::R0) => D3::L3,
(D3::L3, D3::R1) => D3::L1,
(D3::L3, D3::R2) => D3::L2,
(D3::L3, D3::L1) => D3::R1,
(D3::L3, D3::L2) => D3::R2,
(D3::L3, D3::L3) => D3::R0,
}
}
}
impl Semigroup for D3 {}
impl Monoid for D3 {
fn id() -> Self {
D3::R0
}
}
impl Group for D3 {
fn inverse(&self) -> Self {
match self {
D3::R0 => D3::R0,
D3::R1 => D3::R2,
D3::R2 => D3::R1,
D3::L1 => D3::L1,
D3::L2 => D3::L2,
D3::L3 => D3::L3,
}
}
}
proptest! {
#![proptest_config(config::standard())]
#[test]
fn closure_s((x, y) in any::<(D3, D3)>()) {
prop_assert!(MagmaLaws::closure(&x, &y))
}
#[test]
fn closure((x, y) in any::<(D3, D3)>()) {
prop_assert!(MagmaLaws::closure(&x, &y))
}
#[test]
fn associativity((x, y, z) in any::<(D3, D3, D3)>()) {
prop_assert!(x.associativity(&y, &z))
}
#[test]
fn left_identity(x in any::<D3>()) {
prop_assert!(x.left_identity())
}
#[test]
fn left_identity_a3(xs in any::<[D3; 3]>()) {
prop_assert!(xs.left_identity())
}
#[test]
fn right_identity(x in any::<D3>()) {
prop_assert!(x.right_identity())
}
#[test]
fn right_identity_a2(xs in any::<[D3; 2]>()) {
prop_assert!(xs.right_identity())
}
#[test]
fn left_inverse(x in any::<D3>()) {
prop_assert!(x.left_inverse())
}
#[test]
fn left_inverse_a2(xs in any::<[D3; 2]>()) {
prop_assert!(xs.left_inverse())
}
#[test]
fn right_inverse(x in any::<D3>()) {
prop_assert!(x.right_inverse())
}
#[test]
fn right_inverse_a2(xs in any::<[D3; 2]>()) {
prop_assert!(xs.right_inverse())
}
}
fn main() {
}