Пример #1
0
 public bool TestCast(Tester t)
 {
     var ints = new int[100000];
     Random r = new Random(42324232);
     for (int i = 0; i < ints.Length; i++) { ints[i] = r.Next(); }
     var bytes = ints.Slice().Cast<int, byte>();
     t.Assert(bytes.Length == ints.Length * sizeof(int));
     for (int i = 0; i < ints.Length; i++) {
         t.AssertEqual(bytes[i*4], (ints[i]&0xff));
         t.AssertEqual(bytes[i*4+1], (ints[i]>>8&0xff));
         t.AssertEqual(bytes[i*4+2], (ints[i]>>16&0xff));
         t.AssertEqual(bytes[i*4+3], (ints[i]>>24&0xff));
     }
     return true;
 }
Пример #2
0
    public bool TestCast(Tester t)
    {
        var    ints = new int[100000];
        Random r    = new Random(42324232);

        for (int i = 0; i < ints.Length; i++)
        {
            ints[i] = r.Next();
        }
        var bytes = ints.Slice().Cast <int, byte>();

        t.Assert(bytes.Length == ints.Length * sizeof(int));
        for (int i = 0; i < ints.Length; i++)
        {
            t.AssertEqual(bytes[i * 4], (ints[i] & 0xff));
            t.AssertEqual(bytes[i * 4 + 1], (ints[i] >> 8 & 0xff));
            t.AssertEqual(bytes[i * 4 + 2], (ints[i] >> 16 & 0xff));
            t.AssertEqual(bytes[i * 4 + 3], (ints[i] >> 24 & 0xff));
        }
        return(true);
    }
Пример #3
0
    public void TestIsOddWith11()
    {
        bool res = Utils.IsOdd(11);

        Tester.Assert(false, res);
    }
Пример #4
0
    public void TestIsOddFor7()
    {
        bool res = Utils.IsOdd(7);

        Tester.Assert(true, res);
    }
Пример #5
0
    public void TestIsOdd(int val)
    {
        bool res = Utils.IsOdd(val);

        Tester.Assert(true, res);
    }
Пример #6
0
    public void TestIsOddWithOddNumber()
    {
        bool res = Utils.IsOdd(7);

        Tester.Assert(true, res);
    }