<commit_before>// Unity detection
#if UNITY_2 || UNITY_3 || UNITY_4 || UNITY_5 || UNITY_2017 || UNITY_2018 || UNITY_2019
#define UNITY
#if UNITY_2017 || UNITY_2018 || UNITY_2019
#define COMP_SERVICES
using System.Runtime.CompilerServices;
#endif

#if UNITY_EDITOR
using UnityEditor;
#endif
// Use UnityEngine's provided utilities.
using UnityEngine;


#else
// Hook into some other useful diagnostic stuff
#define COMP_SERVICES
using System.Runtime.CompilerServices;
using System.Diagnostics;
#endif


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Collections.Concurrent;
using static JsonTests.TestFramework;

#if UNITY
namespace JsonTests {

	[ExecuteInEditMode] public class Tests : MonoBehaviour {

#if UNITY_EDITOR
		[Tooltip("This Behaviour Runs tests when attached to a GameObject")]
		public string JsonTestObject = "Last Updated 2.3.0";

		public bool go = false;
		public bool goOnRecompile = true;
		private bool wasCompiling = false;
		public void Update() {
			bool isCompiling =
				EditorApplication.isCompiling;
			
			if (go || (goOnRecompile && wasCompiling && !isCompiling)) {
				go = false;

				Test(typeof(Json_Tests));

				Test(typeof(XJS_Tests));
				Test(typeof(XJS_Interp_Tests));

			}
			wasCompiling = isCompiling;
		}

		private static void Test(Type type) {
			Debug.Log($"Testing {type}");
			Debug.Log(RunTests(type.GetTestMethods()));
		}
#endif

	}

#endif

#if DEBUG
	/// <summary> Class containing a small suite of tests to ensure all functionality is good. </summary>
	public static class TestFramework {
		public static string successColor = "#00AA00";
		public static string failureColor = "#BB0000";

		/// <summary> Helper method to get test methods within a given type </summary>
		/// <param name="type"> Type to search for test methods in </param>
		/// <returns> List of all MethodInfo in given type that are static methods with names starting with Test and no parameters. </returns>
		public static List<MethodInfo> GetTestMethods(this Type type) {
			var allMethods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			var nestedTypes = type.GetNestedTypes(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			List<MethodInfo> tests = new List<MethodInfo>();

			foreach (var method in allMethods) {
				if (method.Name.StartsWith("Test") && method.GetParameters().Count() == 0) { tests.Add(method); }
			}<commit_msg>Improves readability of testing output<commit_after>// Unity detection
#if UNITY_2 || UNITY_3 || UNITY_4 || UNITY_5 || UNITY_2017 || UNITY_2018 || UNITY_2019
#define UNITY
#if UNITY_2017 || UNITY_2018 || UNITY_2019
#define COMP_SERVICES
using System.Runtime.CompilerServices;
#endif

#if UNITY_EDITOR
using UnityEditor;
#endif
// Use UnityEngine's provided utilities.
using UnityEngine;


#else
// Hook into some other useful diagnostic stuff
#define COMP_SERVICES
using System.Runtime.CompilerServices;
using System.Diagnostics;
#endif


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Collections.Concurrent;
using static JsonTests.TestFramework;

#if UNITY
namespace JsonTests {

	[ExecuteInEditMode] public class Tests : MonoBehaviour {

#if UNITY_EDITOR
		[Tooltip("This Behaviour Runs tests when attached to a GameObject")]
		public string JsonTestObject = "Last Updated 2.3.0";

		public bool go = false;
		public bool goOnRecompile = true;
		private bool wasCompiling = false;
		public void Update() {
			bool isCompiling =
				EditorApplication.isCompiling;
			
			if (go || (goOnRecompile && wasCompiling && !isCompiling)) {
				go = false;

				Test(typeof(Json_Tests));

				Test(typeof(XJS_Tests));
				Test(typeof(XJS_Interp_Tests));

			}
			wasCompiling = isCompiling;
		}

		private static void Test(Type type) {
			Debug.Log($"Testing {type}");
			Debug.Log($"{type} {RunTests(type.GetTestMethods())}");
		}
#endif

	}

#endif

#if DEBUG
	/// <summary> Class containing a small suite of tests to ensure all functionality is good. </summary>
	public static class TestFramework {
		public static string successColor = "#00AA00";
		public static string failureColor = "#BB0000";

		/// <summary> Helper method to get test methods within a given type </summary>
		/// <param name="type"> Type to search for test methods in </param>
		/// <returns> List of all MethodInfo in given type that are static methods with names starting with Test and no parameters. </returns>
		public static List<MethodInfo> GetTestMethods(this Type type) {
			var allMethods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			var nestedTypes = type.GetNestedTypes(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			List<MethodInfo> tests = new List<MethodInfo>();

			foreach (var method in allMethods) {
				if (method.Name.StartsWith("Test") && method.GetParameters().Count() == 0) { tests.Add(method); }
			}
{'fraction_non_alphanumeric': 0.10482139371462033, 'fraction_numerical': 0.015615850087839157, 'mean_word_length': 4.545454545454546, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6007273', 'n_tokens_mistral': 1699, 'n_tokens_neox': 1495, 'n_words': 477}