Example #1
0
        public void CrossCheck_Dynamic_Unary_UnaryPlus()
        {
            var f = CrossCheck_Dynamic_UnaryCore("+");

            var values = Integers.Concat(Floats);

            foreach (var value in values)
            {
                f(value);
            }

            f(TimeSpan.FromSeconds(42));
        }
Example #2
0
        public void CrossCheck_Dynamic_Binary_Modulo()
        {
            var f = CrossCheck_Dynamic_BinaryCore("%");

            var ls     = Integers.Concat(Floats);
            var rs     = Integers2.Concat(Floats2);
            var values = ls.Zip(rs, (l, r) => new { l, r });

            foreach (var lr in values)
            {
                f(lr.l, lr.r);
            }
        }
Example #3
0
        public void CrossCheck_Dynamic_Binary_ExclusiveOr()
        {
            var f = CrossCheck_Dynamic_BinaryCore("^");

            var ls     = Integers.Concat(Booleans).Concat(Booleans);
            var rs     = Integers2.Concat(Booleans).Concat(Booleans.Reverse());
            var values = ls.Zip(rs, (l, r) => new { l, r });

            foreach (var lr in values)
            {
                f(lr.l, lr.r);
            }

            f(BindingFlags.Public, BindingFlags.Instance);
        }
Example #4
0
        public void CrossCheck_Dynamic_Binary_GreaterThanOrEqual()
        {
            var f = CrossCheck_Dynamic_BinaryCore(">=");

            var ls     = Integers.Concat(Integers).Concat(Floats).Concat(Floats);
            var rs     = Integers.Concat(Integers2).Concat(Floats).Concat(Floats2);
            var values = ls.Zip(rs, (l, r) => new { l, r });

            foreach (var lr in values)
            {
                f(lr.l, lr.r);
            }

            f(TimeSpan.Zero, TimeSpan.Zero);
            f(TimeSpan.FromSeconds(42), TimeSpan.Zero);
            f(TimeSpan.FromSeconds(42), TimeSpan.FromSeconds(42));
        }
Example #5
0
        public void CrossCheck_Dynamic_Binary_Subtract()
        {
            var f = CrossCheck_Dynamic_BinaryCore("-");

            var ls     = Integers.Concat(Floats);
            var rs     = Integers2.Concat(Floats2);
            var values = ls.Zip(rs, (l, r) => new { l, r });

            foreach (var lr in values)
            {
                f(lr.l, lr.r);
            }

            f(new DateTime(1983, 2, 11), TimeSpan.FromDays(32 * 365.25));
            f(TimeSpan.FromSeconds(42), TimeSpan.FromSeconds(1));
            f(ConsoleColor.Red, 1);
        }
Example #6
0
        public void CrossCheck_Dynamic_Binary_NotEqual()
        {
            var f = CrossCheck_Dynamic_BinaryCore("!=");

            var ls     = Integers.Concat(Integers).Concat(Floats).Concat(Floats).Concat(Booleans).Concat(Booleans);
            var rs     = Integers.Concat(Integers2).Concat(Floats).Concat(Floats2).Concat(Booleans).Concat(Booleans.Reverse());
            var values = ls.Zip(rs, (l, r) => new { l, r });

            foreach (var lr in values)
            {
                f(lr.l, lr.r);
            }

            // TODO: null cases (doesn't work with Return<T> because T can't be inferred)

            f("bar", "bar");
            f("bar", "foo");
            f(TimeSpan.Zero, TimeSpan.Zero);
            f(TimeSpan.FromSeconds(42), TimeSpan.Zero);
            f(TimeSpan.FromSeconds(42), TimeSpan.FromSeconds(42));
        }