<commit_before>// #if !os(macOS) && !os(watchOS)

import XCTest
@testable import Diff

func IP(_ row: Int, _ section: Int) -> IndexPath {
    return IndexPath(row: row, section: section)
}

class BatchUpdateTests: XCTestCase {

    let cellExpectations = [
        ([1, 2, 3, 4], [1, 2, 3, 4], ([], [], [])),
        ([1, 2, 3, 4], [4, 2, 3, 1], ([], [], [(IP(0, 0), IP(3, 0)), (IP(3, 0), IP(0, 0))])),
        ([1, 2, 3, 4], [2, 3, 1], ([IP(3, 0)], [], [(IP(0, 0), IP(2, 0))])),
        ([1, 2, 3, 4], [5, 2, 3, 4], ([IP(0, 0)], [IP(0, 0)], [])),
        ([1, 2, 3, 4], [4, 1, 3, 5], ([IP(1, 0)], [IP(3, 0)], [(IP(2, 0), IP(0, 0))])),
        ([1, 2, 3, 4], [4, 2, 3, 4], ([IP(0, 0)], [IP(0, 0)], [])),
        ([1, 2, 3, 4], [1, 2, 4, 4], ([IP(2, 0)], [IP(3, 0)], [])),
        ([1, 2, 3, 4], [5, 6, 7, 8], ([IP(0, 0), IP(1, 0), IP(2, 0), IP(3, 0)], [IP(0, 0), IP(1, 0), IP(2, 0), IP(3, 0)], [])),
        ([1, 2, 3, 4], [5, 6, 7, 1], ([IP(1, 0), IP(2, 0), IP(3, 0)], [IP(0, 0), IP(1, 0), IP(2, 0)], [])),
    ]

    func testCells() {
        _testCells()
    }

    func testCellsWithTransform() {
        _testCellsWithTransform()
    }

    func _testCells() {
        for expectation in cellExpectations {
            let batch = BatchUpdate(diff: expectation.0.extendedDiff(expectation.1))
            XCTAssertEqual(batch.deletions, expectation.2.0)
            XCTAssertEqual(batch.insertions, expectation.2.1)
            XCTAssertEqual(batch.moves, expectation.2.2)
        }
    }

    func _testCellsWithTransform() {
        let transform: (IndexPath) -> IndexPath = { IP($0.row + 1, $0.section + 2) }

        for expectation in cellExpectations {
            let batch = BatchUpdate(diff: expectation.0.extendedDiff(expectation.1), indexPathTransform: transform)
            XCTAssertEqual(batch.deletions, expectation.2.0.map(transform))
            XCTAssertEqual(batch.insertions, expectation.2.1.map(transform))
            XCTAssertEqual(batch.moves, expectation.2.2.map { (transform($0.0), transform($0.1)) })
        }
    }
//
//    // MARK: Performance Tests
//    func testCellsPerformance() {
//        self.measure {
//            self._testCells()
//        }
//    }
//
//    func testCellsWithTransformPerformance() {
//        self.measure {
//            self._testCellsWithTransform()
//        }
//    }
}

// #endif
<commit_msg>uncomment platform check macros<commit_after>#if !os(macOS) && !os(watchOS)

import XCTest
@testable import Diff

func IP(_ row: Int, _ section: Int) -> IndexPath {
    return IndexPath(row: row, section: section)
}

class BatchUpdateTests: XCTestCase {

    let cellExpectations = [
        ([1, 2, 3, 4], [1, 2, 3, 4], ([], [], [])),
        ([1, 2, 3, 4], [4, 2, 3, 1], ([], [], [(IP(0, 0), IP(3, 0)), (IP(3, 0), IP(0, 0))])),
        ([1, 2, 3, 4], [2, 3, 1], ([IP(3, 0)], [], [(IP(0, 0), IP(2, 0))])),
        ([1, 2, 3, 4], [5, 2, 3, 4], ([IP(0, 0)], [IP(0, 0)], [])),
        ([1, 2, 3, 4], [4, 1, 3, 5], ([IP(1, 0)], [IP(3, 0)], [(IP(2, 0), IP(0, 0))])),
        ([1, 2, 3, 4], [4, 2, 3, 4], ([IP(0, 0)], [IP(0, 0)], [])),
        ([1, 2, 3, 4], [1, 2, 4, 4], ([IP(2, 0)], [IP(3, 0)], [])),
        ([1, 2, 3, 4], [5, 6, 7, 8], ([IP(0, 0), IP(1, 0), IP(2, 0), IP(3, 0)], [IP(0, 0), IP(1, 0), IP(2, 0), IP(3, 0)], [])),
        ([1, 2, 3, 4], [5, 6, 7, 1], ([IP(1, 0), IP(2, 0), IP(3, 0)], [IP(0, 0), IP(1, 0), IP(2, 0)], [])),
    ]

    func testCells() {
        _testCells()
    }

    func testCellsWithTransform() {
        _testCellsWithTransform()
    }

    func _testCells() {
        for expectation in cellExpectations {
            let batch = BatchUpdate(diff: expectation.0.extendedDiff(expectation.1))
            XCTAssertEqual(batch.deletions, expectation.2.0)
            XCTAssertEqual(batch.insertions, expectation.2.1)
            XCTAssertEqual(batch.moves, expectation.2.2)
        }
    }

    func _testCellsWithTransform() {
        let transform: (IndexPath) -> IndexPath = { IP($0.row + 1, $0.section + 2) }

        for expectation in cellExpectations {
            let batch = BatchUpdate(diff: expectation.0.extendedDiff(expectation.1), indexPathTransform: transform)
            XCTAssertEqual(batch.deletions, expectation.2.0.map(transform))
            XCTAssertEqual(batch.insertions, expectation.2.1.map(transform))
            XCTAssertEqual(batch.moves, expectation.2.2.map { (transform($0.0), transform($0.1)) })
        }
    }

    //
    //    // MARK: Performance Tests
    //    func testCellsPerformance() {
    //        self.measure {
    //            self._testCells()
    //        }
    //    }
    //
    //    func testCellsWithTransformPerformance() {
    //        self.measure {
    //            self._testCellsWithTransform()
    //        }
    //    }
}

#endif

{'fraction_non_alphanumeric': 0.22606882168925965, 'fraction_numerical': 0.06548488008342022, 'mean_word_length': 2.3098688750862664, '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': '4205587', 'n_tokens_mistral': 2074, 'n_tokens_neox': 1803, 'n_words': 444}