/// <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)); }
/// <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)); }
/// <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(); }
/// <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)); }
/// <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)); }