コード例 #1
0
            /// <summary>
            /// Execute a single test iteration.
            /// </summary>
            /// <param name="watch">The stopwatch timing the iteration.</param>
            /// <returns>A value indicating whether or not the test is valid.</returns>
            public bool Execute(Stopwatch watch)
            {
                JsonBuilder writer = JsonDna.PerpareWriter();

                JsonDna.RecursiveObject(writer, 3, 3);
                return(JsonDna.ConfirmWriter(writer, Constants.ComplexJson, watch));
            }
コード例 #2
0
            /// <summary>
            /// Execute a single test iteration.
            /// </summary>
            /// <param name="watch">The stopwatch timing the iteration.</param>
            /// <returns>A value indicating whether or not the test is valid.</returns>
            public bool Execute(Stopwatch watch)
            {
                JsonBuilder writer = JsonDna.PerpareWriter();

                writer.WriteValue(Constants.TextValue);
                return(JsonDna.ConfirmWriter(writer, Constants.TextJson, watch));
            }
コード例 #3
0
        /// <summary>
        /// Recursively build a complex object.
        /// </summary>
        /// <param name="writer">The writer to use.</param>
        /// <param name="width">The length of the recursive array.</param>
        /// <param name="depth">The depth of the recursive object.</param>
        private static void RecursiveObject(JsonBuilder writer, int width, int depth)
        {
            writer.OpenObject();
            writer.OpenProperty(Constants.LogicalProperty);
            writer.WriteValue(Constants.LogicalValue);
            writer.CloseToken();
            writer.OpenProperty(Constants.IntegralProperty);
            writer.WriteValue(Constants.IntegralValue);
            writer.CloseToken();
            writer.OpenProperty(Constants.FloatProperty);
            writer.WriteValue(Constants.FloatValue);
            writer.CloseToken();
            writer.OpenProperty(Constants.TextProperty);
            writer.WriteValue(Constants.TextValue);
            writer.CloseToken();
            if (depth > 0)
            {
                writer.OpenProperty(Constants.ArrayProperty);
                writer.OpenArray();
                for (int i = 0; i < width; i++)
                {
                    int shallow = depth - 1;
                    JsonDna.RecursiveObject(writer, width, shallow);
                }

                writer.CloseToken();
                writer.CloseToken();
            }

            writer.CloseToken();
        }
コード例 #4
0
            /// <summary>
            /// Execute a single test iteration.
            /// </summary>
            /// <param name="watch">The stopwatch timing the iteration.</param>
            /// <returns>A value indicating whether or not the test is valid.</returns>
            public bool Execute(Stopwatch watch)
            {
                JsonBuilder writer = JsonDna.PerpareWriter();

                writer.OpenArray();
                writer.WriteValue(Constants.LogicalValue);
                writer.WriteValue(Constants.IntegralValue);
                writer.WriteValue(Constants.FloatValue);
                writer.WriteValue(Constants.TextValue);
                writer.CloseToken();
                return(JsonDna.ConfirmWriter(writer, Constants.ArrayJson, watch));
            }
コード例 #5
0
            /// <summary>
            /// Execute a single test iteration.
            /// </summary>
            /// <param name="watch">The stopwatch timing the iteration.</param>
            /// <returns>A value indicating whether or not the test is valid.</returns>
            public bool Execute(Stopwatch watch)
            {
                JsonParser reader = JsonDna.PrepareReader(Constants.ComplexJson);

                return(JsonDna.ConfirmReader(reader, watch));
            }