<commit_before>//
//  RESTAPIComponentTests.swift
//  RESTAPI iOSTests
//
//  Created by <NAME> on 2018. 11. 06..
//  Copyright © 2018. gujci. All rights reserved.
//

import XCTest
import SwiftyJSON
@testable import RESTAPI

class RESTAPIComponentTests: XCTestCase {

    func testComplexQuery() {
        let testDict = ["level1_0": "key1", "level1_1": ["array1", "array2"]] as [String : Any]
        let desiredQueryString = ["test[level1_0]=key1", "test[level1_1][]=array1", "test[level1_1][]=array2"].sorted()
        let query = testDict.queryString(forKey: "test").map { it in "\(it.name)=\(it.value ?? "")"}.sorted()
        XCTAssertEqual(desiredQueryString, query)
    }
    
    func testDeepComplexQuery() {
        let testDict = ["level_0": ["level1_0": "key1", "level1_1": ["array1", "array2"]]] as [String : Any]
        let desiredQueryString = ["test[level_0][level1_0]=key1", "test[level_0][level1_1][]=array1", "test[level_0][level1_1][]=array2"]
        let query = testDict.queryString(forKey: "test").map { it in "\(it.name)=\(it.value ?? "")"}.sorted()
        XCTAssertEqual(desiredQueryString, query)
    }
}<commit_msg>- missing fix added :)<commit_after>//
//  RESTAPIComponentTests.swift
//  RESTAPI iOSTests
//
//  Created by <NAME> on 2018. 11. 06..
//  Copyright © 2018. gujci. All rights reserved.
//

import XCTest
import SwiftyJSON
@testable import RESTAPI

class RESTAPIComponentTests: XCTestCase {

    func testComplexQuery() {
        let testDict = ["level1_0": "key1", "level1_1": ["array1", "array2"]] as [String : Any]
        let desiredQueryString = ["test[level1_0]=key1", "test[level1_1][]=array1", "test[level1_1][]=array2"].sorted()
        let query = testDict.queryString(forKey: "test").map { it in "\(it.name)=\(it.value ?? "")"}.sorted()
        XCTAssertEqual(desiredQueryString, query)
    }
    
    func testDeepComplexQuery() {
        let testDict = ["level_0": ["level1_0": "key1", "level1_1": ["array1", "array2"]]] as [String : Any]
        let desiredQueryString = ["test[level_0][level1_0]=key1", "test[level_0][level1_1][]=array1", "test[level_0][level1_1][]=array2"].sorted()
        let query = testDict.queryString(forKey: "test").map { it in "\(it.name)=\(it.value ?? "")"}.sorted()
        XCTAssertEqual(desiredQueryString, query)
    }
}
{'fraction_non_alphanumeric': 0.18268398268398267, 'fraction_numerical': 0.04155844155844156, 'mean_word_length': 3.8448637316561847, 'pattern_counts': {'":': 10, '<': 5, '<?xml version=': 0, '>': 5, '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': '5701172', 'n_tokens_mistral': 854, 'n_tokens_neox': 821, 'n_words': 170}