<commit_before>//
//  PrismSpec.swift
//  Focus
//
//  Created by <NAME> on 7/4/15.
//  Copyright © 2015 TypeLift. All rights reserved.
//

import XCTest
import SwiftCheck
import Focus

class PrismSpec : XCTestCase {
    func testPrismLaws() {
		property("modify-identity") <- forAll { (fs : IsoOf<Int, UInt>, tryGet : ArrowOf<UInt, OptionalOf<UInt>>) in
			let prism = Prism<Int, Int, UInt, UInt>(tryGet: { $0.getOptional } • tryGet.getArrow • fs.getTo, inject: fs.getFrom)
			return forAll { (l : Int) in
				let m = prism.tryModify(l, { $0 })
				return m != nil ==> (m == l)
			}
		}
    }
}
<commit_msg>Fix test<commit_after>//
//  PrismSpec.swift
//  Focus
//
//  Created by <NAME> on 7/4/15.
//  Copyright © 2015 TypeLift. All rights reserved.
//

import XCTest
import SwiftCheck
import Focus

class PrismSpec : XCTestCase {
    func testPrismLaws() {
		property("modify-identity") <- forAll { (fs : IsoOf<Int, UInt>) in
			/// Cannot generate this in the forAll because we need this to be memoizing and consistent with the Iso.
			let tryGet = ArrowOf<UInt, OptionalOf<UInt>>({ arc4random() % 4 == 0 ? OptionalOf(.None) : OptionalOf(.Some($0)) })
			let prism = Prism<Int, Int, UInt, UInt>(tryGet: { $0.getOptional } • tryGet.getArrow • fs.getTo, inject: fs.getFrom)
			return forAll { (l : Int) in
				let m = prism.tryModify(l, { $0 })
				return m != nil ==> (m == l)
			}
		}
    }
}

{'fraction_non_alphanumeric': 0.15544412607449856, 'fraction_numerical': 0.017191977077363897, 'mean_word_length': 3.014367816091954, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4007685', 'n_tokens_mistral': 572, 'n_tokens_neox': 510, 'n_words': 150}