コード例 #1
0
        public static void Bool3()
        {
            bool result = true;

            Random32 rng = new Random32(RNG_SEED);

            for (int i = 0; i < NUM_TESTS; i++)
            {
                bool3 x = rng.NextBool3();

                int test = 0;

                for (int j = 0; j < 3; j++)
                {
                    if (x[j])
                    {
                        test++;
                    }
                }

                result &= test == maxmath.count(x);
            }

            Assert.AreEqual(true, result);
        }
コード例 #2
0
        public static void Long3()
        {
            bool     result = true;
            Random32 x      = new Random32(47);

            for (long i = 0; i < Tests.Long3.NUM_TESTS; i++)
            {
                bool3 b = x.NextBool3();
                long3 a = maxmath.negate(Tests.Long3.TestData_LHS[i], b);

                result &= math.all(a == (maxmath.select(Tests.Long3.TestData_LHS[i], -Tests.Long3.TestData_LHS[i], b)));
            }

            Assert.AreEqual(true, result);
        }
コード例 #3
0
        public static void Bool3()
        {
            bool result = true;

            Random32 rng = new Random32(RNG_SEED);

            for (int i = 0; i < NUM_TESTS; i++)
            {
                bool3 x = rng.NextBool3();

                int test = maxmath.first(x);

                int j = 0;
                while (j < 3 && !x[j])
                {
                    j++;
                }

                result &= test == j;
            }

            Assert.AreEqual(result && maxmath.first(default(bool3)) == 4, true);
        }