<commit_before>import UIKit
import XCTest
@testable import CenteredCollectionView

class Tests: XCTestCase {

	var collectionView: CenteredCollectionView!
	let expectedItemDimension: CGFloat = 80
	let expectedLineSpacing: CGFloat = 20
	let expectedFrameDimension: CGFloat = 300

	override func setUp() {
		super.setUp()
		// This method is called before the invocation of each test method in the class.
		collectionView = CenteredCollectionView(frame: CGRect(x: 0, y: 0, width: expectedFrameDimension, height: expectedFrameDimension))
		collectionView.itemSize = CGSize(width: expectedItemDimension, height: expectedItemDimension)
		collectionView.minimumLineSpacing = expectedLineSpacing
	}

	override func tearDown() {
		// Put teardown code here. This method is called after the invocation of each test method in the class.
		collectionView = nil
		super.tearDown()
	}

	func testDefaultValuesNoFrame() {
		let expectedItemDimension: CGFloat = 50
		let expectedLineSpacing: CGFloat = 10
		collectionView = CenteredCollectionView()
		collectionView.flowLayout.invalidateLayout()
		// public
		XCTAssertEqual(collectionView.scrollDirection, .vertical)
		XCTAssertEqual(collectionView.itemSize, CGSize(width: expectedItemDimension, height: expectedItemDimension))
		XCTAssertEqual(collectionView.minimumLineSpacing, expectedLineSpacing)
		XCTAssertEqual(collectionView.currentCenteredPage, 0)
		XCTAssertEqual(collectionView.contentOffset.y, 0)
		XCTAssertEqual(collectionView.contentOffset.x, 0)
		// internal
		XCTAssertEqual(collectionView.pageWidth, expectedItemDimension + expectedLineSpacing)
		XCTAssertEqual(collectionView.currentContentOffset, 0)
		XCTAssertTrue(collectionView.delegateInterceptor == nil)
	}

	func testDefaultValuesWithFrame() {
		// public
		collectionView.flowLayout.invalidateLayout()
		XCTAssertEqual(collectionView.scrollDirection, .vertical)
		XCTAssertEqual(collectionView.itemSize, CGSize(width: expectedItemDimension, height: expectedItemDimension))
		XCTAssertEqual(collectionView.minimumLineSpacing, expectedLineSpacing)
		XCTAssertEqual(collectionView.currentCenteredPage, 0)
		XCTAssertEqual(collectionView.contentOffset.y, -(expectedFrameDimension - expectedItemDimension) / 2)
		XCTAssertEqual(collectionView.contentOffset.x, 0)
		// internal
		XCTAssertEqual(collectionView.pageWidth, expectedItemDimension + expectedLineSpacing)
		XCTAssertEqual(collectionView.currentContentOffset, 0)
		XCTAssertTrue(collectionView.delegateInterceptor == nil)
	}

	//	func testPerformanceExample() {
	//		// This is an example of a performance test case.
	//		self.measure {
	//			// Put the code you want to measure the time of here.
	//		}
	//	}

}<commit_msg>updated test to reflect new API: * scrollToEdgeEnabled<commit_after>import UIKit
import XCTest
@testable import CenteredCollectionView

class Tests: XCTestCase {

	var collectionView: CenteredCollectionView!
	let expectedItemDimension: CGFloat = 80
	let expectedLineSpacing: CGFloat = 20
	let expectedFrameDimension: CGFloat = 300

	override func setUp() {
		super.setUp()
		// This method is called before the invocation of each test method in the class.
		collectionView = CenteredCollectionView(frame: CGRect(x: 0, y: 0, width: expectedFrameDimension, height: expectedFrameDimension))
		collectionView.itemSize = CGSize(width: expectedItemDimension, height: expectedItemDimension)
		collectionView.minimumLineSpacing = expectedLineSpacing
	}

	override func tearDown() {
		// Put teardown code here. This method is called after the invocation of each test method in the class.
		collectionView = nil
		super.tearDown()
	}

	func testDefaultValuesNoFrame() {
		let expectedItemDimension: CGFloat = 50
		let expectedLineSpacing: CGFloat = 10
		collectionView = CenteredCollectionView()
		collectionView.flowLayout.invalidateLayout()
		// public
		XCTAssertEqual(collectionView.scrollDirection, .horizontal)
		XCTAssertEqual(collectionView.scrollToEdgeEnabled, false)
		XCTAssertEqual(collectionView.itemSize, CGSize(width: expectedItemDimension, height: expectedItemDimension))
		XCTAssertEqual(collectionView.minimumLineSpacing, expectedLineSpacing)
		XCTAssertEqual(collectionView.currentCenteredPage, 0)
		XCTAssertEqual(collectionView.contentOffset.y, 0)
		XCTAssertEqual(collectionView.contentOffset.x, 25)
		// internal
		XCTAssertEqual(collectionView.pageWidth, expectedItemDimension + expectedLineSpacing)
		XCTAssertEqual(collectionView.currentContentOffset, 0)
		XCTAssertTrue(collectionView.delegateInterceptor == nil)
	}

	func testDefaultValuesWithFrame() {
		// public
		collectionView.flowLayout.invalidateLayout()
		XCTAssertEqual(collectionView.scrollDirection, .horizontal)
		XCTAssertEqual(collectionView.scrollToEdgeEnabled, false)
		XCTAssertEqual(collectionView.itemSize, CGSize(width: expectedItemDimension, height: expectedItemDimension))
		XCTAssertEqual(collectionView.minimumLineSpacing, expectedLineSpacing)
		XCTAssertEqual(collectionView.currentCenteredPage, 0)
		XCTAssertEqual(collectionView.contentOffset.y, 0)
		XCTAssertEqual(collectionView.contentOffset.x, -(expectedFrameDimension - expectedItemDimension) / 2)
		// internal
		XCTAssertEqual(collectionView.pageWidth, expectedItemDimension + expectedLineSpacing)
		XCTAssertEqual(collectionView.currentContentOffset, 0)
		XCTAssertTrue(collectionView.delegateInterceptor == nil)
	}

	//	func testPerformanceExample() {
	//		// This is an example of a performance test case.
	//		self.measure {
	//			// Put the code you want to measure the time of here.
	//		}
	//	}

}
{'fraction_non_alphanumeric': 0.07822638788752703, 'fraction_numerical': 0.007750540735400144, 'mean_word_length': 6.0240506329113925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2610840', 'n_tokens_mistral': 1711, 'n_tokens_neox': 1588, 'n_words': 356}