public static void Bool32() { bool result = true; Random64 rng = new Random64(RNG_SEED); for (int i = 0; i < NUM_TESTS; i++) { bool32 x = new bool32(rng.NextBool8(), rng.NextBool8(), rng.NextBool8(), rng.NextBool8()); int test = 0; for (int j = 0; j < 32; j++) { if (x[j]) { test++; } } result &= test == maxmath.count(x); } Assert.AreEqual(true, result); }
public static void Bool32() { bool result = true; Random64 rng = new Random64(RNG_SEED); for (int i = 0; i < NUM_TESTS; i++) { bool32 x = new bool32(rng.NextBool8(), rng.NextBool8(), rng.NextBool8(), rng.NextBool8()); int test = maxmath.first(x); int j = 0; while (j < 32 && !x[j]) { j++; } result &= test == j; } Assert.AreEqual(result && maxmath.first(default(bool32)) == 32, true); }
public static void Bool16() { bool result = true; Random64 rng = new Random64(RNG_SEED); for (int i = 0; i < NUM_TESTS; i++) { bool16 x = new bool16(rng.NextBool8(), rng.NextBool8()); int test = maxmath.last(x); int j = 15; while (j != -1 && !x[j]) { j--; } result &= test == j; } Assert.AreEqual(result && maxmath.last(default(bool16)) == -1, true); }
public static void Float8() { bool result = true; Random64 x = new Random64(47); for (int i = 0; i < Tests.Float8.NUM_TESTS; i++) { bool8 b = x.NextBool8(); float8 a = maxmath.negate(Tests.Float8.TestData_LHS[i], b); result &= maxmath.all(a == maxmath.select(Tests.Float8.TestData_LHS[i], -Tests.Float8.TestData_LHS[i], b)); } Assert.AreEqual(true, result); }