void CreateFunctions()
        {
            connection.CreateFunction(
                "JSON",
                2,
                new Function((arguments) =>
                             JsonCollator.Compare(
                                 JsonCollationMode.Unicode,
                                 (string)arguments [0],
                                 (string)arguments [1],
                                 Int32.MaxValue)),
                true);

            connection.CreateFunction(
                "JSON_ASCII",
                2,
                new Function((arguments) =>
                             JsonCollator.Compare(
                                 JsonCollationMode.Ascii,
                                 (string)arguments [0],
                                 (string)arguments [1],
                                 Int32.MaxValue)),
                true);

            connection.CreateFunction(
                "JSON_RAW",
                2,
                new Function((arguments) =>
                             JsonCollator.Compare(
                                 JsonCollationMode.Raw,
                                 (string)arguments [0],
                                 (string)arguments [1],
                                 Int32.MaxValue)),
                true);
        }
예제 #2
0
        private void TestCollateConvertEscape(String input, char decoded)
        {
            //TODO : How to test private methods.
            int  endPos;
            char result = JsonCollator.ConvertEscape(input, 0, out endPos);

            Assert.AreEqual(decoded, result);
            Assert.AreEqual(input.Length - 1, endPos);
        }
예제 #3
0
 private static double ReadNumber(String str, int start, out int endOfNumber)
 {
     return(JsonCollator.Strtod(str, start, out endOfNumber));
 }
예제 #4
0
        private static void TestCollateEquals(JsonCollationMode mode, String input1, String input2, int arrayLimit, int expectedValue)
        {
            int result = JsonCollator.Compare(mode, input1, input2, arrayLimit);

            Assert.AreEqual(expectedValue, result);
        }