<commit_before>//
//  ModifierSpec.swift
//  SwiftCheck
//
//  Created by <NAME> on 1/29/15.
//  Copyright (c) 2015 TypeLift. All rights reserved.
//

import XCTest
import SwiftCheck

class ModifierSpec : XCTestCase {
	func testModifiers() {
		property["All blind variables print '(*)'"] = forAll { (x : Blind<Int>) in
			return x.description == "(*)"
		}
		
		property["Static propositions never shrink"] = forAll { (x : Static<Int>) in
			return Static<Int>.shrink(x).isEmpty
		}

		property["Positive propositions only generate positive numbers"] = forAll { (x : Positive<Int>) in
			return x.getPositive > 0
		}
		
		property["NonZero propositions never generate zero"] = forAll { (x : NonZero<Int>) in
			return x.getNonZero != 0
		}
		
		property["NonNegative propositions only generate non negative numbers"] = forAll { (x : NonNegative<Int>) in
			return x.getNonNegative >= 0
		}

		property["ArrayOf modifiers nest"] = forAll { (xxxs : ArrayOf<ArrayOf<Int8>>) in
			return true
		}

		property["The reverse of the reverse of an array is that array"] = forAll { (xs : ArrayOf<Int>) in
			return
				(xs.getArray.reverse().reverse() == xs.getArray) <?> "Left identity"
				^&&^
				(xs.getArray == xs.getArray.reverse().reverse()) <?> "Right identity"
		}
	}
}<commit_msg>Test ArrowOf<commit_after>//
//  ModifierSpec.swift
//  SwiftCheck
//
//  Created by <NAME> on 1/29/15.
//  Copyright (c) 2015 TypeLift. All rights reserved.
//

import XCTest
import SwiftCheck

class ModifierSpec : XCTestCase {
	func testModifiers() {
		property["All blind variables print '(*)'"] = forAll { (x : Blind<Int>) in
			return x.description == "(*)"
		}
		
		property["Static propositions never shrink"] = forAll { (x : Static<Int>) in
			return Static<Int>.shrink(x).isEmpty
		}

		property["Positive propositions only generate positive numbers"] = forAll { (x : Positive<Int>) in
			return x.getPositive > 0
		}
		
		property["NonZero propositions never generate zero"] = forAll { (x : NonZero<Int>) in
			return x.getNonZero != 0
		}
		
		property["NonNegative propositions only generate non negative numbers"] = forAll { (x : NonNegative<Int>) in
			return x.getNonNegative >= 0
		}

		property["ArrayOf modifiers nest"] = forAll { (xxxs : ArrayOf<ArrayOf<Int8>>) in
			return true
		}

		property["The reverse of the reverse of an array is that array"] = forAll { (xs : ArrayOf<Int>) in
			return
				(xs.getArray.reverse().reverse() == xs.getArray) <?> "Left identity"
				^&&^
				(xs.getArray == xs.getArray.reverse().reverse()) <?> "Right identity"
		}

		property["map behaves"] = forAll { (xs : ArrayOf<Int>, f : ArrowOf<Int, Int>) in
			return xs.getArray.map(f.getArrow) == xs.getArray.map(f.getArrow)
		}

		property["filter behaves"] = forAll { (xs : ArrayOf<Int>, pred : ArrowOf<Int, Bool>) in
			let f = pred.getArrow
			return (xs.getArray.filter(f).reduce(true, combine: { $0.0 && f($0.1) }) as Bool)
		}
	}
}
{'fraction_non_alphanumeric': 0.1502909962341664, 'fraction_numerical': 0.010270455323519343, 'mean_word_length': 3.572769953051643, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 35, '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': '5544153', 'n_tokens_mistral': 1120, 'n_tokens_neox': 942, 'n_words': 264}