Exemple #1
0
        private void TestBadValue(int n, Object value)
        {
            TypeValidator v = Validator_boolean.Get(n);

            Assert.IsFalse(v.Validate(value));
            Assert.IsFalse(ValidateValueOk(v, value));
        }
Exemple #2
0
        private void TestElementValidator(int n, String descr, Type expectedClass)
        {
            Validator_boolean v = (Validator_boolean)Validator_boolean.Get(n).ElementValidator();

            Assert.AreEqual(n - 1, v.GetNDims());
            Assert.AreSame(expectedClass, v.GetExpectedClass());
            Assert.AreEqual(descr, v.ToString());
        }
Exemple #3
0
        private void TestConstructor(int n, string descr, Type expectedClass)
        {
            Validator_boolean v = Validator_boolean.Get(n);

            Assert.AreEqual(n, v.GetNDims());
            Assert.AreSame(expectedClass, v.GetExpectedClass());
            Assert.AreEqual(descr, v.ToString());
        }
Exemple #4
0
        public void Test_boolean()
        {
            Test(Validator_boolean.Get(2), 2,
                 new Boolean[][] { new Boolean[] { false, false }, new Boolean[] { false, false } });

            Test(Validator_boolean.Get(2), 2,
                 new Boolean[][] { new Boolean[] { true, true }, new Boolean[] { true, true } });
        }
Exemple #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="nDims">number of dimensions. 0 for a scalar.</param>
        /// <returns>an instance of the validator</returns>
        public static Validator_boolean Get(int nDims)
        {
            CheckDims(nDims);

            if (nDims >= validators.Length)
            {
                return(new Validator_boolean(nDims));
            }

            Validator_boolean v = validators[nDims];

            if (v == null)
            {
                v = validators[nDims] = new Validator_boolean(nDims);
            }

            return(v);
        }
Exemple #6
0
 public void Constructor3()
 {
     Validator_boolean.Get(Validator.MAX_NDIMS + 1);
 }
Exemple #7
0
 public void Constructor2()
 {
     Validator_boolean.Get(-1);
 }
Exemple #8
0
 public void ElementValidator2()
 {
     Validator_boolean.Get(0).ElementValidator();
 }