private void testbadvalue(int n, Object value) { TypeValidator v = Validator_double.Get(n); Assert.IsFalse(v.Validate(value)); Assert.IsFalse(ValidateValueOk(v, value)); }
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()); }
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()); }
/// <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); }
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 } }); }
public void constructor3() { Validator_double.Get(Validator.MAX_NDIMS + 1); }
public void constructor2() { Validator_double.Get(-1); }
public void elementvalidator2() { Validator_double.Get(0).ElementValidator(); }