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

            Assert.IsFalse(v.Validate(value));
            Assert.IsFalse(validateValueOk(v, value));
        }
Exemple #2
0
        public void Test_short()
        {
            Test(Validator_short.Get(2), 2,

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

            Test(Validator_short.Get(2), 2,

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

            Test(Validator_short.Get(2), 2,

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

            Test(Validator_short.Get(2), 2,

                 new short[][] { new short[] { SByte.MaxValue, SByte.MaxValue }, new short[] { SByte.MaxValue, SByte.MaxValue } });

            Test(Validator_short.Get(2), 2,

                 new short[][] { new short[] { SByte.MinValue, SByte.MinValue }, new short[] { SByte.MinValue, SByte.MinValue } });

            Test(Validator_short.Get(2), 2,

                 new short[][] { new short[] { short.MaxValue, short.MaxValue }, new short[] { short.MaxValue, short.MaxValue } });

            Test(Validator_short.Get(2), 2,

                 new short[][] { new short[] { short.MinValue, short.MinValue }, new short[] { short.MinValue, short.MinValue } });
        }
Exemple #3
0
        private void testelementvalidator(int n, String descr, Type expectedClass)
        {
            TypeValidator v = (TypeValidator)Validator_short.Get(n).ElementValidator();

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

            Assert.AreEqual(n, v.GetNDims());
            Assert.AreSame(expectedClass, v.GetExpectedClass());
            Assert.AreEqual(descr, v.ToString());
        }
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_short Get(int nDims)
        {
            CheckDims(nDims);

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

            Validator_short v = validators[nDims];

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

            return(v);
        }
Exemple #6
0
 public void constructor3()
 {
     Validator_short.Get(Validator.MAX_NDIMS + 1);
 }
Exemple #7
0
 public void constructor2()
 {
     Validator_short.Get(-1);
 }
Exemple #8
0
 public void elementvalidator2()
 {
     Validator_short.Get(0).ElementValidator();
 }