<commit_before>//
//  Medium_077_Combinations_Test.swift
//  Solutions
//
//  Created by <NAME> on 8/6/15.
//  Copyright © 2015 diwu. All rights reserved.
//

import XCTest

class Medium_077_Combinations_Test: XCTestCase, SolutionsTestCase {
    func test_001() {
        let input: [Int] = [4, 2]
        let expected: [[Int]] = [
            [2,4],
            [3,4],
            [2,3],
            [1,2],
            [1,3],
            [1,4],
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_002() {
        let input: [Int] = [1, 1]
        let expected: [[Int]] = [
            [1]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_003() {
        let input: [Int] = [2, 1]
        let expected: [[Int]] = [
            [1],
            [2]
        ]
        asyncHelper(input: input, expected: expected)
    }
    private func asyncHelper(input: [Int], expected: [[Int]]) {
        weak var expectation: XCTestExpectation? = self.expectation(description:timeOutName())
        serialQueue().async(execute: { () -> Void in
            let result = Medium_077_Combinations.combine(n: input[0], k: input[1])<commit_msg>4 more test cases for 077.<commit_after>//
//  Medium_077_Combinations_Test.swift
//  Solutions
//
//  Created by <NAME> on 8/6/15.
//  Copyright © 2015 diwu. All rights reserved.
//

import XCTest

class Medium_077_Combinations_Test: XCTestCase, SolutionsTestCase {
    func test_001() {
        let input: [Int] = [4, 2]
        let expected: [[Int]] = [
            [2,4],
            [3,4],
            [2,3],
            [1,2],
            [1,3],
            [1,4],
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_002() {
        let input: [Int] = [1, 1]
        let expected: [[Int]] = [
            [1]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_003() {
        let input: [Int] = [2, 1]
        let expected: [[Int]] = [
            [1],
            [2]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_004() {
        let input: [Int] = [4, 1]
        let expected: [[Int]] = [
            [1],
            [2],
            [3],
            [4]
            ]
        asyncHelper(input: input, expected: expected)
    }
    func test_005() {
        let input: [Int] = [4, 3]
        let expected: [[Int]] = [
            [1, 2, 3],
            [1, 2, 4],
            [1, 3, 4],
            [2, 3, 4]
            ]
        asyncHelper(input: input, expected: expected)
    }
    func test_006() {
        let input: [Int] = [4, 4]
        let expected: [[Int]] = [
            [1, 2, 3, 4]
            ]
        asyncHelper(input: input, expected: expected)
    }
    func test_007() {
        let input: [Int] = [5, 2]
        let expected: [[Int]] = [
            [1,2],
            [1,3],
            [1,4],
            [1,5],
            [2,3],
            [2,4],
            [2,5],
            [3,4],
            [3,5],
            [4,5]
            ]
        asyncHelper(input: input, expected: expected)
    }
    private func asyncHelper(input: [Int], expected: [[Int]]) {
        weak var expectation: XCTestExpectation? = self.expectation(description:timeOutName())
        serialQueue().async(execute: { () -> Void in
            let result = Medium_077_Combinations.combine(n: input[0], k: input[1])
{'fraction_non_alphanumeric': 0.1516213847502191, 'fraction_numerical': 0.04732690622261174, 'mean_word_length': 1.545724907063197, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7589908', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1111, 'n_words': 274}