コード例 #1
0
        public unsafe void JsonValidatorStandard_Validate_Parts(string parts, bool valid)
        {
            using (var validator = new JsonValidator(JsonValidationType.Standard, Allocator.TempJob))
            {
                foreach (var json in parts.Split('|'))
                {
                    fixed(char *ptr = json)
                    {
                        validator.Validate(new UnsafeBuffer <char>(ptr, json.Length), 0, json.Length);
                    }
                }

                Assert.AreEqual(true, validator.GetResult().IsValid());
            }
        }
        public unsafe void JsonValidatorSimple_Validate_Parts(string parts, bool valid)
        {
            using (var validator = new JsonValidator(JsonValidationType.Simple, Allocator.TempJob))
            {
                foreach (var json in parts.Split('|'))
                {
                    fixed(char *ptr = json)
                    {
                        validator.Validate(new UnsafeBuffer <char>(ptr, json.Length), 0, json.Length);
                    }
                }

                var result = validator.GetResult();
                Debug.Log(result.ToString());
                Assert.AreEqual(true, result.IsValid());
            }
        }