<commit_before>//
//  Medium_073_Set_Matrix_Zeroes_Test.swift
//  Solutions
//
//  Created by <NAME> on 7/30/15.
//  Copyright © 2015 diwu. All rights reserved.
//

import XCTest

class Medium_073_Set_Matrix_Zeroes_Test: XCTestCase, SolutionsTestCase {
    func test_001() {
        let input: [[Int]] = [
            [1, 1, 1, 1],
            [1, 0, 1, 1],
            [1, 1, 1, 1]
        ]
        let expected: [[Int]] = [
            [1, 0, 1, 1],
            [0, 0, 0, 0],
            [1, 0, 1, 1]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_002() {
        let input: [[Int]] = [
            [1, 1, 1, 1],
            [1, 0, 1, 1],
            [1, 1, 1, 0]
        ]
        let expected: [[Int]] = [
            [1, 0, 1, 0],
            [0, 0, 0, 0],
            [0, 0, 0, 0]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_003() {
        let input: [[Int]] = [
            [1, 1, 1, 1],
            [1, 0, 1, 1],
            [1, 0, 1, 1],
            [1, 1, 1, 1],
            [1, 1, 1, 1]
        ]
        let expected: [[Int]] = [
            [1, 0, 1, 1],
            [0, 0, 0, 0],
            [0, 0, 0, 0],
            [1, 0, 1, 1],
            [1, 0, 1, 1]
        ]
        asyncHelper(input: input, expected: expected)
    }
    private func asyncHelper(input ipt: [[Int]], expected: [[Int]]) {
        var input = ipt
        weak var expectation: XCTestExpectation? = self.expectation(description:timeOutName())
        serialQueue().async(execute: { () -> Void in
            Medium_073_Set_Matrix_Zeroes.setZeros(&input)
            let result = input
            assertHelper(compareTwoDimensionIntArray(arr0: result, arr1: expected), problemName:self.problemName(), input: input, resultValue: result, expectedValue: expected)
            if let unwrapped = expectation {
                unwrapped.fulfill()
            }
        })
        waitForExpectations(timeout:timeOut()) { (error: Error?) -> Void in
            if error != nil {
                assertHelper(false, problemName:self.problemName(), input: input, resultValue:self.timeOutName(), expectedValue: expected)
            }
        }<commit_msg>4 more test cases for 073.<commit_after>//
//  Medium_073_Set_Matrix_Zeroes_Test.swift
//  Solutions
//
//  Created by <NAME> on 7/30/15.
//  Copyright © 2015 diwu. All rights reserved.
//

import XCTest

class Medium_073_Set_Matrix_Zeroes_Test: XCTestCase, SolutionsTestCase {
    func test_001() {
        let input: [[Int]] = [
            [1, 1, 1, 1],
            [1, 0, 1, 1],
            [1, 1, 1, 1]
        ]
        let expected: [[Int]] = [
            [1, 0, 1, 1],
            [0, 0, 0, 0],
            [1, 0, 1, 1]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_002() {
        let input: [[Int]] = [
            [1, 1, 1, 1],
            [1, 0, 1, 1],
            [1, 1, 1, 0]
        ]
        let expected: [[Int]] = [
            [1, 0, 1, 0],
            [0, 0, 0, 0],
            [0, 0, 0, 0]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_003() {
        let input: [[Int]] = [
            [1, 1, 1, 1],
            [1, 0, 1, 1],
            [1, 0, 1, 1],
            [1, 1, 1, 1],
            [1, 1, 1, 1]
        ]
        let expected: [[Int]] = [
            [1, 0, 1, 1],
            [0, 0, 0, 0],
            [0, 0, 0, 0],
            [1, 0, 1, 1],
            [1, 0, 1, 1]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_004() {
        let input: [[Int]] = [
            [1]
        ]
        let expected: [[Int]] = [
            [1]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_005() {
        let input: [[Int]] = [
            [0]
        ]
        let expected: [[Int]] = [
            [0]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_006() {
        let input: [[Int]] = [
            [0],
            [1]
        ]
        let expected: [[Int]] = [
            [0],
            [0]
        ]
        asyncHelper(input: input, expected: expected)
    }
    func test_007() {
        let input: [[Int]] = [
            [1, 0],
        ]
        let expected: [[Int]] = [
            [0, 0],
        ]
        asyncHelper(input: input, expected: expected)
    }
    private func asyncHelper(input ipt: [[Int]], expected: [[Int]]) {
        var input = ipt
        weak var expectation: XCTestExpectation? = self.expectation(description:timeOutName())
        serialQueue().async(execute: { () -> Void in
            Medium_073_Set_Matrix_Zeroes.setZeros(&input)
            let result = input
            assertHelper(compareTwoDimensionIntArray(arr0: result, arr1: expected), problemName:self.problemName(), input: input, resultValue: result, expectedValue: expected)
            if let unwrapped = expectation {
                unwrapped.fulfill()
            }
        })
        waitForExpectations(timeout:timeOut()) { (error: Error?) -> Void in
            if error != nil {
                assertHelper(false, problemName:self.problemName(), input: input, resultValue:self.timeOutName(), expectedValue: expected)
            }
        }
{'fraction_non_alphanumeric': 0.14837976122797045, 'fraction_numerical': 0.049649422020087174, 'mean_word_length': 1.4861045690061234, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7488917', 'n_tokens_mistral': 1883, 'n_tokens_neox': 1681, 'n_words': 461}