Example #1
0
        private void testbadvalue(int n, Object value)
        {
            TypeValidator v = Validator_double.Get(n);

            Assert.IsFalse(v.Validate(value));
            Assert.IsFalse(ValidateValueOk(v, value));
        }
Example #2
0
        private void testelementvalidator(int n, String descr, Type expectedClass)
        {
            TypeValidator v = (TypeValidator)Validator_double.Get(n).ElementValidator();

            Assert.AreEqual(n - 1, v.GetNDims());
            Assert.AreSame(expectedClass, v.GetExpectedClass());
            Assert.AreEqual(descr, v.ToString());
        }
Example #3
0
        private void testconstructor(int n, String descr, Type expectedClass)
        {
            TypeValidator v = Validator_double.Get(n);

            Assert.AreEqual(n, v.GetNDims());
            Assert.AreSame(expectedClass, v.GetExpectedClass());
            Assert.AreEqual(descr, v.ToString());
        }
Example #4
0
        /// <summary></summary>
        /// <param name="nDims">number of dimensions. 0 for a scalar.</param>
        /// <returns>an instance of the validator</returns>
        public static Validator_double Get(int nDims)
        {
            CheckDims(nDims);

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

            Validator_double v = validators[nDims];

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

            return(v);
        }
Example #5
0
        public void Test_double()
        {
            Test(Validator_double.Get(2), 2,

                 new double[][] { new double[] { 0, 0 }, new double[] { 0, 0 } });

            Test(Validator_double.Get(2), 2,

                 new double[][] { new double[] { 1, 1 }, new double[] { 1, 1 } });

            Test(Validator_double.Get(2), 2,

                 new double[][] { new double[] { -1, -1 }, new double[] { -1, -1 } });

            Test(Validator_double.Get(2), 2,

                 new double[][] { new double[] { Double.MaxValue, Double.MaxValue }, new double[] { Double.MaxValue, Double.MaxValue } });

            Test(Validator_double.Get(2), 2,

                 new double[][] { new double[] { Double.MinValue, Double.MinValue }, new double[] { Double.MinValue, Double.MinValue } });
        }
Example #6
0
 public void constructor3()
 {
     Validator_double.Get(Validator.MAX_NDIMS + 1);
 }
Example #7
0
 public void constructor2()
 {
     Validator_double.Get(-1);
 }
Example #8
0
 public void elementvalidator2()
 {
     Validator_double.Get(0).ElementValidator();
 }