<commit_before>//
//  NestedJSONTests.swift
//  SwiftyJSON
//
//  Created by <NAME> on 9/27/16.
//
//

import XCTest
import SwiftyJSON

class NestedJSONTests: XCTestCase {
    let family: JSON = [
        "names" : [
            "<NAME>",
            "<NAME>"
        ],
        "motto" : "Hey, I don't know about you, but I'm feeling twenty-two! So, release the KrakenDev!"
    ]
    
    func testTopLevelNestedJSON() {
        let nestedJSON: JSON = [
            "family" : family
        ]
        XCTAssertNotNil(try? nestedJSON.rawData())
    }
    
    func testDeeplyNestedJSON() {
        let nestedFamily: JSON = [
            "count": 1,
            "families": [
                [
                    "isACoolFamily" : true,
                    "family" : [
                        "hello" : family
                    ]
                ]
            ]
        ]
        XCTAssertNotNil(try? nestedFamily.rawData())
    }
    
    func testArrayJSON() {
        let arr: [JSON] = ["a", 1, ["b", 2]]
        let json = JSON(arr)
        XCTAssertEqual(json[0].string, "a")
        XCTAssertEqual(json[2,1].int, 2)
    }
    
    func testDictionaryJSON() {
        let json: JSON = ["a": JSON("1"), "b": JSON([1, 2, "3"]), "c": JSON(["aa": "11", "bb": 22])]
        XCTAssertEqual(json["a"].string, "1")
        XCTAssertEqual(json["b"].array!, [1, 2, "3"])
        XCTAssertEqual(json["c"]["aa"].string, "11")
    }
    
    func testNextedJSON() {
        let inner = JSON.init([
            "some_field": "1" + "2",
            ])
        let json = JSON.init([
            "outer_field": "1" + "2",
            "inner_json": inner
            ])
        XCTAssertEqual(json["inner_json"], ["some_field": "12"])
        
        let foo = "foo"
        let json2 = JSON.init([<commit_msg>Fix a spelling mistake and simplify initialize methods invoking<commit_after>//
//  NestedJSONTests.swift
//  SwiftyJSON
//
//  Created by <NAME> on 9/27/16.
//
//

import XCTest
import SwiftyJSON

class NestedJSONTests: XCTestCase {
    let family: JSON = [
        "names" : [
            "<NAME>",
            "<NAME>"
        ],
        "motto" : "Hey, I don't know about you, but I'm feeling twenty-two! So, release the KrakenDev!"
    ]
    
    func testTopLevelNestedJSON() {
        let nestedJSON: JSON = [
            "family" : family
        ]
        XCTAssertNotNil(try? nestedJSON.rawData())
    }
    
    func testDeeplyNestedJSON() {
        let nestedFamily: JSON = [
            "count": 1,
            "families": [
                [
                    "isACoolFamily" : true,
                    "family" : [
                        "hello" : family
                    ]
                ]
            ]
        ]
        XCTAssertNotNil(try? nestedFamily.rawData())
    }
    
    func testArrayJSON() {
        let arr: [JSON] = ["a", 1, ["b", 2]]
        let json = JSON(arr)
        XCTAssertEqual(json[0].string, "a")
        XCTAssertEqual(json[2,1].int, 2)
    }
    
    func testDictionaryJSON() {
        let json: JSON = ["a": JSON("1"), "b": JSON([1, 2, "3"]), "c": JSON(["aa": "11", "bb": 22])]
        XCTAssertEqual(json["a"].string, "1")
        XCTAssertEqual(json["b"].array!, [1, 2, "3"])
        XCTAssertEqual(json["c"]["aa"].string, "11")
    }
    
    func testNestedJSON() {
        let inner = JSON([
            "some_field": "1" + "2",
            ])
        let json = JSON([
            "outer_field": "1" + "2",
            "inner_json": inner
            ])
        XCTAssertEqual(json["inner_json"], ["some_field": "12"])
        
        let foo = "foo"
        let json2 = JSON([
{'fraction_non_alphanumeric': 0.157374347706674, 'fraction_numerical': 0.01812688821752266, 'mean_word_length': 1.5539971949509117, 'pattern_counts': {'":': 22, '<': 9, '<?xml version=': 0, '>': 9, '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': '7380700', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1166, 'n_words': 257}