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; }
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); }
public void TestIsOddWith11() { bool res = Utils.IsOdd(11); Tester.Assert(false, res); }
public void TestIsOddFor7() { bool res = Utils.IsOdd(7); Tester.Assert(true, res); }
public void TestIsOdd(int val) { bool res = Utils.IsOdd(val); Tester.Assert(true, res); }
public void TestIsOddWithOddNumber() { bool res = Utils.IsOdd(7); Tester.Assert(true, res); }