<commit_before>// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

class TestURLResponse : XCTestCase {
    static var allTests: [(String, (TestURLResponse) -> () throws -> Void)] {
        return [
            ("test_URL", test_URL),
            ("test_MIMEType_1", test_MIMEType_1),
            ("test_MIMEType_2", test_MIMEType_2),
            ("test_MIMEType_notAvailable", test_MIMEType_notAvailable),
            ("test_ExpectedContentLength_positive", test_ExpectedContentLength_positive),
            ("test_ExpectedContentLength_negative", test_ExpectedContentLength_negative),
            ("test_TextEncodingName_positive", test_TextEncodingName_positive),
            ("test_TextEncodingName_negative", test_TextEncodingName_negative),
            ("test_suggestedFilename_1", test_suggestedFilename_1),
            ("test_suggestedFilename_2", test_suggestedFilename_2),
            ("test_suggestedFilename_3", test_suggestedFilename_3),
            ("test_copywithzone", test_copyWithZone),
            ("test_NSCoding", test_NSCoding),
        ]
    }
    
    let testURL = URL(string: "test")!
    
    func test_URL() {
        let url = URL(string: "a/test/path")!
        let res = URLResponse(url: url, mimeType: "txt", expectedContentLength: 0, textEncodingName: nil)
        XCTAssertEqual(res.url, url, "should be the expected url")
    }
    
    func test_MIMEType_1() {
        let mimetype = "text/plain"
        let res = URLResponse(url: testURL, mimeType: mimetype, expectedContentLength: 0, textEncodingName: nil)
        XCTAssertEqual(res.mimeType, mimetype, "should be the passed in mimetype")
    }
    
    func test_MIMEType_2() {
        let mimetype = "APPlication/wordperFECT"
        let res = URLResponse(url: testURL, mimeType: mimetype, expectedContentLength: 0, textEncodingName: nil)
        XCTAssertEqual(res.mimeType, mimetype, "should be the other mimetype")
    }
    
    func test_MIMEType_notAvailable() {
        let mimetype: String? = nil
        let res = URLResponse(url: testURL, mimeType: mimetype, expectedContentLength: 0, textEncodingName: nil)
        XCTAssertEqual(res.mimeType, mimetype, "should be the other mimetype")
    }
    
    func test_ExpectedContentLength_positive() {
        let contentLength = 100
        let res1 = URLResponse(url: testURL, mimeType: "text/plain", expectedContentLength: contentLength, textEncodingName: nil)
        XCTAssertEqual(res1.expectedContentLength, Int64(contentLength), "should be positive Int64 content length")
    }
    
    func test_ExpectedContentLength_negative() {
        let contentLength = -1
        let res2 = URLResponse(url: testURL, mimeType: nil, expectedContentLength: contentLength, textEncodingName: nil)
        XCTAssertEqual(res2.expectedContentLength, Int64(contentLength), "should be invalid (-1) Int64 content length")
    }<commit_msg>Add URLResponse.test_ExpectedContentLength_zero() back in<commit_after>// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

class TestURLResponse : XCTestCase {
    static var allTests: [(String, (TestURLResponse) -> () throws -> Void)] {
        return [
            ("test_URL", test_URL),
            ("test_MIMEType_1", test_MIMEType_1),
            ("test_MIMEType_2", test_MIMEType_2),
            ("test_MIMEType_notAvailable", test_MIMEType_notAvailable),
            ("test_ExpectedContentLength_positive", test_ExpectedContentLength_positive),
            ("test_ExpectedContentLength_zero", test_ExpectedContentLength_zero),
            ("test_ExpectedContentLength_negative", test_ExpectedContentLength_negative),
            ("test_TextEncodingName_positive", test_TextEncodingName_positive),
            ("test_TextEncodingName_negative", test_TextEncodingName_negative),
            ("test_suggestedFilename_1", test_suggestedFilename_1),
            ("test_suggestedFilename_2", test_suggestedFilename_2),
            ("test_suggestedFilename_3", test_suggestedFilename_3),
            ("test_copywithzone", test_copyWithZone),
            ("test_NSCoding", test_NSCoding),
        ]
    }
    
    let testURL = URL(string: "test")!
    
    func test_URL() {
        let url = URL(string: "a/test/path")!
        let res = URLResponse(url: url, mimeType: "txt", expectedContentLength: 0, textEncodingName: nil)
        XCTAssertEqual(res.url, url, "should be the expected url")
    }
    
    func test_MIMEType_1() {
        let mimetype = "text/plain"
        let res = URLResponse(url: testURL, mimeType: mimetype, expectedContentLength: 0, textEncodingName: nil)
        XCTAssertEqual(res.mimeType, mimetype, "should be the passed in mimetype")
    }
    
    func test_MIMEType_2() {
        let mimetype = "APPlication/wordperFECT"
        let res = URLResponse(url: testURL, mimeType: mimetype, expectedContentLength: 0, textEncodingName: nil)
        XCTAssertEqual(res.mimeType, mimetype, "should be the other mimetype")
    }
    
    func test_MIMEType_notAvailable() {
        let mimetype: String? = nil
        let res = URLResponse(url: testURL, mimeType: mimetype, expectedContentLength: 0, textEncodingName: nil)
        XCTAssertEqual(res.mimeType, mimetype, "should be the other mimetype")
    }
    
    func test_ExpectedContentLength_positive() {
        let contentLength = 100
        let res = URLResponse(url: testURL, mimeType: "text/plain", expectedContentLength: contentLength, textEncodingName: nil)
        XCTAssertEqual(res.expectedContentLength, Int64(contentLength), "should be positive Int64 content length")
    }
    
    func test_ExpectedContentLength_zero() {
        let contentLength = 0
        let res = URLResponse(url: testURL, mimeType: nil, expectedContentLength: contentLength, textEncodingName: nil)
        XCTAssertEqual(res.expectedContentLength, Int64(contentLength), "should be zero Int64 content length")
    }
    
    func test_ExpectedContentLength_negative() {
        let contentLength = -1
        let res = URLResponse(url: testURL, mimeType: nil, expectedContentLength: contentLength, textEncodingName: nil)
        XCTAssertEqual(res.expectedContentLength, Int64(contentLength), "should be invalid (-1) Int64 content length")
    }
{'fraction_non_alphanumeric': 0.0940674223465332, 'fraction_numerical': 0.012807301634035036, 'mean_word_length': 3.4405228758169937, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4106185', 'n_tokens_mistral': 2028, 'n_tokens_neox': 1933, 'n_words': 478}