Пример #1
0
    static void Main(string[] args)
    {
        Issue634();

        HashMapRemoveTest();
        HashMapRemoveTest2();


        TestSubs.Test();

        SeqPerf.Broken1();
        return;

        HashMapPerf.Run();
        SeqPerf.Run();

        Test533();

        IEnumerableOptionBindT_NotEnumerabled_NotEvaluated();

        var xs = (new[] { 1, 2, 3 }).ConcatFast(new[] { 4, 5, 6 });
        var ys = (new int [0]).ConcatFast(new[] { 4, 5, 6 });
        var zs = (new[] { 1, 2, 3 }).ConcatFast(new int[0]);

        var nxs = ((IEnumerable <int>)null).ConcatFast(new[] { 4, 5, 6 });
        var nzs = (new[] { 1, 2, 3 }).ConcatFast(((IEnumerable <int>)null));

        var bxs = new[] { 1, 2, 3 }.Bind(va => new[] { 1 * va, 2 * va, 3 * va });


        var xyz  = new TestWith("Paul", "Louth");
        var xyz2 = new TestWith2("Paul", "Louth");
        var xyz3 = new TestWith3 <string>("Test", "Paul", "Louth");
        var xyz4 = new TestWith4("", "", "", "");

        //[email protected]

        xyz3 = xyz3.With(Value: "Another");

        xyz2 = xyz2.With();
        xyz2 = xyz2.With(Name: Some("P"));
        xyz2 = xyz2.With(Surname: Some("L"));
        xyz2 = xyz2.With(Name: None, Surname: None);

        xyz = xyz.With(Name: "Test1");
        xyz = TestWith.surname.Set("Test2", xyz);


        var asq = typeof(LanguageExt.CodeGen.RecordWithAndLensGenerator).AssemblyQualifiedName;

        var r = MonadicGetGenderByIdAsync(Guid.NewGuid()).Result;

        WriterTest1();
        WriterTest2();
        WriterTest3();
        Asm();

        var x = new TestStruct(1, "Hello", Guid.Empty);
        var y = new TestStruct(1, "Hello", Guid.Empty);
        var z = new TestStruct(1, "Hello", Guid.NewGuid());

        var a = x == y;
        var b = x == z;
        var c = x.Equals((object)y);
        var d = x.Equals((object)z);
        var e = x.Equals(y);
        var f = x.Equals(z);
        var g = JsonConvert.SerializeObject(x);
        var h = JsonConvert.DeserializeObject <TestStruct>(g);
        var i = x.ToString();
        var j = x > y;
        var k = x < z;
        var l = x.GetHashCode();
        var m = y.GetHashCode();
        var n = z.GetHashCode();


        Console.WriteLine("Coming soon");
    }
Пример #2
0
    static void Main(string[] args)
    {
        Shape <TInt, int> sw = null;
        Shape <TInt, int> sx = null;
        var sy = Shape.Circle <TInt, int>(100);
        var sz = Shape.Circle <TInt, int>(100);
        var s2 = Shape.Circle <TInt, int>(200);

        Debug.Assert((sw == sx) == true);  // both null
        Debug.Assert((sw == sy) == false); // left null
        Debug.Assert((sy == sx) == false); // right null
        Debug.Assert((sy == sz) == true);  // both set
        Debug.Assert((s2 == sz) == false); // left bigger
        Debug.Assert((sz == s2) == false); // right bigger

        Debug.Assert((sw > sx) == false);  // both null
        Debug.Assert((sw < sx) == false);
        Debug.Assert((sw >= sx) == true);
        Debug.Assert((sw <= sx) == true);

        Debug.Assert((sw > sy) == false); // left null
        Debug.Assert((sw < sy) == true);
        Debug.Assert((sw >= sy) == false);
        Debug.Assert((sw <= sy) == true);

        Debug.Assert((sy > sw) == true); // right null
        Debug.Assert((sy < sw) == false);
        Debug.Assert((sy >= sw) == true);
        Debug.Assert((sy <= sw) == false);

        Debug.Assert((sy > sz) == false); // both same
        Debug.Assert((sy < sz) == false);
        Debug.Assert((sy >= sz) == true);
        Debug.Assert((sy <= sz) == true);

        Debug.Assert((s2 > sz) == true); // left bigger
        Debug.Assert((s2 < sz) == false);
        Debug.Assert((s2 >= sz) == true);
        Debug.Assert((s2 <= sz) == false);

        Debug.Assert((sz > s2) == false); // right bigger
        Debug.Assert((sz < s2) == true);
        Debug.Assert((sz >= s2) == false);
        Debug.Assert((sz <= s2) == true);


        var c1 = Shape.Circle <TInt, int>(100);
        var c2 = Shape.Circle <TInt, int>(100);
        var c3 = Shape.Circle <TInt, int>(10);
        var r1 = Shape.Rectangle <TInt, int>(10, 10);

        Debug.Assert(c2 > c3);

        var chc1 = c1.GetHashCode();
        var chc2 = c2.GetHashCode();

        var isceq1  = c1 == c2;
        var isceq2  = c2 == c3;
        var iscreq1 = c1 == r1;


        Issue634();

        HashMapRemoveTest();
        HashMapRemoveTest2();


        TestSubs.Test();

        SeqPerf.Broken1();
        return;

        HashMapPerf.Run();
        SeqPerf.Run();

        Test533();

        IEnumerableOptionBindT_NotEnumerabled_NotEvaluated();

        var xs = (new[] { 1, 2, 3 }).ConcatFast(new[] { 4, 5, 6 });
        var ys = (new int [0]).ConcatFast(new[] { 4, 5, 6 });
        var zs = (new[] { 1, 2, 3 }).ConcatFast(new int[0]);

        var nxs = ((IEnumerable <int>)null).ConcatFast(new[] { 4, 5, 6 });
        var nzs = (new[] { 1, 2, 3 }).ConcatFast(((IEnumerable <int>)null));

        var bxs = new[] { 1, 2, 3 }.Bind(va => new[] { 1 * va, 2 * va, 3 * va });


        var xyz  = new TestWith("Paul", "Louth");
        var xyz2 = new TestWith2("Paul", "Louth");
        var xyz3 = new TestWith3 <string>("Test", "Paul", "Louth");
        var xyz4 = new TestWith4("", "", "", "");

        //[email protected]

        xyz3 = xyz3.With(Value: "Another");

        xyz2 = xyz2.With();
        xyz2 = xyz2.With(Name: Some("P"));
        xyz2 = xyz2.With(Surname: Some("L"));
        xyz2 = xyz2.With(Name: None, Surname: None);

        xyz = xyz.With(Name: "Test1");
        xyz = TestWith.surname.Set("Test2", xyz);


        var asq = typeof(LanguageExt.CodeGen.RecordWithAndLensGenerator).AssemblyQualifiedName;

        var r = MonadicGetGenderByIdAsync(Guid.NewGuid()).Result;

        WriterTest1();
        WriterTest2();
        WriterTest3();
        Asm();

        var x = new TestStruct(1, "Hello", Guid.Empty);
        var y = new TestStruct(1, "Hello", Guid.Empty);
        var z = new TestStruct(1, "Hello", Guid.NewGuid());

        var a = x == y;
        var b = x == z;
        var c = x.Equals((object)y);
        var d = x.Equals((object)z);
        var e = x.Equals(y);
        var f = x.Equals(z);
        var g = JsonConvert.SerializeObject(x);
        var h = JsonConvert.DeserializeObject <TestStruct>(g);
        var i = x.ToString();
        var j = x > y;
        var k = x < z;
        var l = x.GetHashCode();
        var m = y.GetHashCode();
        var n = z.GetHashCode();


        Console.WriteLine("Coming soon");
    }