public void TestTypeOrdering() { ParameterExpression x = Expression.Parameter(typeof(int), "x"); ConstantExpression c = Expression.Constant(2); BinaryExpression sum = Expression.Add(x, c); BinaryExpression product = Expression.Multiply(x, c); Expression cos = Trigonometry.Cosine(x); Expression sin = Trigonometry.Sine(x); Assert.IsTrue(Ordering.Compare(c, x) < 0, "2 < x"); Assert.IsTrue(Ordering.Compare(x, c) > 0, "x > 2"); Assert.IsTrue(Ordering.Compare(c, sum) < 0, "2 < (2+x)"); Assert.IsTrue(Ordering.Compare(sum, c) > 0, "(2+x) > 2"); Assert.IsTrue(Ordering.Compare(x, sum) < 0, "x < (2+x)"); Assert.IsTrue(Ordering.Compare(sum, x) > 0, "(2+x) > x"); Assert.IsTrue(Ordering.Compare(x, sin) < 0, "x < sin(x)"); Assert.IsTrue(Ordering.Compare(sin, x) > 0, "sin(x) > x"); Assert.IsTrue(Ordering.Compare(product, sum) < 0, "2*x < (2+x)"); Assert.IsTrue(Ordering.Compare(sum, product) > 0, "(2+x) > 2*x"); Assert.IsTrue(Ordering.Compare(sum, sum) == 0, "(2+x) = (2+x)"); Assert.IsTrue(Ordering.Compare(product, product) == 0, "2*x = 2*x"); Assert.IsTrue(Ordering.Compare(product, sin) < 0, "2*x < sin(x)"); Assert.IsTrue(Ordering.Compare(sin, product) > 0, "sin(x) > 2*x"); Assert.IsTrue(Ordering.Compare(cos, sin) < 0, "cos(x) < sin(x)"); Assert.IsTrue(Ordering.Compare(sin, cos) > 0, "sin(x) > cos(x)"); }