Пример #1
0
        private void testbadvalue(int n, Object value)
        {
            TypeValidator v = Validator_long.Get(n);

            Assert.IsFalse(v.Validate(value));
            Assert.IsFalse(validateValueOk(v, value));
        }
Пример #2
0
        public static void Init(TypeMap types, Class2TypeMap class2type)
        {
            RuntimeExceptionSerializer.Init(
                types.Get(ETCH_RUNTIME_EXCEPTION_TYPE_NAME), class2type);

            ListSerializer.Init(
                types.Get(ETCH_LIST_TYPE_NAME), class2type);

            MapSerializer.Init(
                types.Get(ETCH_MAP_TYPE_NAME), class2type);

            /*    SetSerializer.Init(
             *      types.Get(ETCH_SET_TYPE_NAME), class2type); */

            DateSerializer.Init(
                types.Get(ETCH_DATETIME_TYPE_NAME), class2type);

            AuthExceptionSerializer.Init(
                types.Get(ETCH_AUTH_EXCEPTION_TYPE_NAME), class2type);

            XType t3 = types.Get(ETCH_EXCEPTION_MESSAGE_NAME);

            t3.PutValidator(_mf_result, Validator_RuntimeException.Get());
            t3.PutValidator(_mf__messageId, Validator_long.Get(0));
            t3.PutValidator(_mf__inReplyTo, Validator_long.Get(0));
        }
Пример #3
0
        private void testelementvalidator(int n, String descr, Type expectedClass)
        {
            TypeValidator v = (TypeValidator)Validator_long.Get(n).ElementValidator();

            Assert.AreEqual(n - 1, v.GetNDims());
            Assert.AreSame(expectedClass, v.GetExpectedClass());
            Assert.AreEqual(descr, v.ToString());
        }
Пример #4
0
        private void testconstructor(int n, String descr, Type expectedClass)
        {
            TypeValidator v = Validator_long.Get(n);

            Assert.AreEqual(n, v.GetNDims());
            Assert.AreSame(expectedClass, v.GetExpectedClass());
            Assert.AreEqual(descr, v.ToString());
        }
Пример #5
0
        public void Test_long()
        {
            Test(Validator_long.Get(2), 2,

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

            Test(Validator_long.Get(2), 2,

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

            Test(Validator_long.Get(2), 2,

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

            Test(Validator_long.Get(2), 2,

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

            Test(Validator_long.Get(2), 2,

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

            Test(Validator_long.Get(2), 2,

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

            Test(Validator_long.Get(2), 2,

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

            Test(Validator_long.Get(2), 2,

                 new long[][] { new long[] { int.MaxValue, int.MaxValue }, new long[] { int.MaxValue, int.MaxValue } });

            Test(Validator_long.Get(2), 2,

                 new long[][] { new long[] { int.MinValue, int.MinValue }, new long[] { int.MinValue, int.MinValue } });

            Test(Validator_long.Get(2), 2,

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

            Test(Validator_long.Get(2), 2,

                 new long[][] { new long[] { long.MinValue, long.MinValue }, new long[] { long.MinValue, long.MinValue } });
        }
Пример #6
0
        /// <summary></summary>
        /// <param name="nDims">number of dimensions. 0 for a scalar.</param>
        /// <returns>an instance of the validator</returns>
        public static Validator_long Get(int nDims)
        {
            CheckDims(nDims);

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

            Validator_long v = validators[nDims];

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

            return(v);
        }
Пример #7
0
        public void InReplyTo()
        {
            XType mt_foo = new XType("foo");

            mt_foo.PutValidator(DefaultValueFactory._mf__inReplyTo, Validator_long.Get(0));

            Message msg = new Message(mt_foo, vf);

            Assert.IsNull(vf.GetInReplyTo(msg));

            vf.SetInReplyTo(msg, 234L);

            long?msgid = vf.GetInReplyTo(msg);

            Assert.IsNotNull(msgid);
            Assert.AreEqual(234L, msgid);

            vf.SetInReplyTo(msg, null);

            Assert.IsNull(vf.GetInReplyTo(msg));
        }
Пример #8
0
        public void MessageId()
        {
            XType mt_foo = new XType("foo");

            mt_foo.PutValidator(DefaultValueFactory._mf__messageId, Validator_long.Get(0));

            Message msg = new Message(mt_foo, vf);

            Assert.IsNull(vf.GetMessageId(msg));

            vf.SetMessageId(msg, 234L);

            long msgid = (long)vf.GetMessageId(msg);

            Assert.IsNotNull(msgid);
            Assert.AreEqual(234L, msgid);

            vf.SetMessageId(msg, null);

            Assert.IsNull(vf.GetMessageId(msg));
        }
Пример #9
0
 public void constructor3()
 {
     Validator_long.Get(Validator.MAX_NDIMS + 1);
 }
Пример #10
0
 public void constructor2()
 {
     Validator_long.Get(-1);
 }
Пример #11
0
 public void elementvalidator2()
 {
     Validator_long.Get(0).ElementValidator();
 }