<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Xunit;
using HastyAPI;
using System.Collections;

namespace Tests {
	public class DynaJSONFacts {

		[Fact]
		public void Parse_Returns_Not_Null() {
			var json = DynaJSON.Parse("{ test: 1 }");
			Assert.NotNull(json);
		}

		[Fact]
		public void Simple_Number_Correct() {
			var json = DynaJSON.Parse("{ test: 1 }");

			Assert.Equal(1, json.test);
		}

		[Fact]
		public void Simple_Multiple_Values_Correct() {
			var json = Shared.GetJSON("simple");

			Assert.Equal("one", json.simple);
			Assert.Equal(42, json.number);
		}

		[Fact]
		public void Simple_List_Correct() {
			var json = Shared.GetJSON("simple_list");

			Assert.IsAssignableFrom<IList>(json.list);

			Assert.Equal(2, json.list.Count);
		}

		[Fact]
		public void Simple_Nested_Correct() {
			var json = Shared.GetJSON("simple_nested");

			Assert.Equal("one", json.@base.example);
			Assert.True(json.@base.sub.this_one_nested);
		}

		[Fact]
		public void Hypens_In_Names_Converted_To_Underscores() {
			var json = Shared.GetJSON("with_hyphens");

			Assert.Equal("1", json.message_count);
		}

		[Fact]
		public void Array_Of_Objects() {
			var json = DynaJSON.Parse("[ { item: 1 }, { item: 2 } ]");

			Assert.Equal(2, json.Count);
		}

		[Fact]
		public void Empty_String() {
			var json = DynaJSON.Parse("");

			Assert.Equal("", json);
		}
	}
}<commit_msg>JSON: more test cases for arrays at root<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Xunit;
using HastyAPI;
using System.Collections;

namespace Tests {
	public class DynaJSONFacts {

		[Fact]
		public void Parse_Returns_Not_Null() {
			var json = DynaJSON.Parse("{ test: 1 }");
			Assert.NotNull(json);
		}

		[Fact]
		public void Simple_Number_Correct() {
			var json = DynaJSON.Parse("{ test: 1 }");

			Assert.Equal(1, json.test);
		}

		[Fact]
		public void Simple_Multiple_Values_Correct() {
			var json = Shared.GetJSON("simple");

			Assert.Equal("one", json.simple);
			Assert.Equal(42, json.number);
		}

		[Fact]
		public void Simple_List_Correct() {
			var json = Shared.GetJSON("simple_list");

			Assert.IsAssignableFrom<IList>(json.list);

			Assert.Equal(2, json.list.Count);
		}

		[Fact]
		public void Simple_Nested_Correct() {
			var json = Shared.GetJSON("simple_nested");

			Assert.Equal("one", json.@base.example);
			Assert.True(json.@base.sub.this_one_nested);
		}

		[Fact]
		public void Hypens_In_Names_Converted_To_Underscores() {
			var json = Shared.GetJSON("with_hyphens");

			Assert.Equal("1", json.message_count);
		}

		[Fact]
		public void Array_Of_Objects() {
			var json = DynaJSON.Parse("[ { item: 1 }, { item: 2 } ]");

			Assert.Equal(2, json.Count);
			Assert.Equal(1, json[0].item);
			Assert.Equal(2, json[1].item);
		}

		[Fact]
		public void Empty_String() {
			var json = DynaJSON.Parse("");

			Assert.Equal("", json);
		}
	}
}
{'fraction_non_alphanumeric': 0.15034848987719882, 'fraction_numerical': 0.007965482907401261, 'mean_word_length': 3.8456591639871385, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '2934180', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1055, 'n_words': 219}