public static void IntTotalOrderTest(int x, int y) { var order = TotalOrder.Make <int>((a, b) => a <= b); Assert.Equal(x < y, order.Le(x, y)); Assert.Equal(x <= y, order.Leq(x, y)); Assert.Equal(x >= y, order.Geq(x, y)); Assert.Equal(x > y, order.Ge(x, y)); }
public static void TotalOrderTest(int x, int y) { var r = TotalOrder.Make <int>((x, y) => x <y ? (short)-1 : x> y ? (short)1 : (short)0); Assert.Equal(x < y, r.Le(x, y)); Assert.Equal(x <= y, r.Leq(x, y)); Assert.Equal(x == y, r.Eq(x, y)); Assert.Equal(x != y, r.Neq(x, y)); Assert.Equal(x >= y, r.Geq(x, y)); Assert.Equal(x > y, r.Ge(x, y)); }
public static void IntInfinityTotalOrderTest(Maybe <int> x, Maybe <int> y, int expected) { var order = TotalOrder.Make <int>((a, b) => a <= b).LiftTotalOrderWithInfinity(); Assert.Equal(expected < 0, order.Le(x, y)); Assert.Equal(expected >= 0, !order.Le(x, y)); Assert.Equal(expected <= 0, order.Leq(x, y)); Assert.Equal(expected > 0, !order.Leq(x, y)); Assert.Equal(expected >= 0, order.Geq(x, y)); Assert.Equal(expected < 0, !order.Geq(x, y)); Assert.Equal(expected > 0, order.Ge(x, y)); Assert.Equal(expected <= 0, !order.Ge(x, y)); }