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

import XCTest

/// The main interface for the SwiftCheck testing mechanism. To test a program property one 
/// subscripts into this variable with a description of the property being tested like so:
///
///     property["Integer Equality is Reflexive"] = forAll { (i : Int8) in
///	        return i == i
///     }
///
/// SwiftCheck will report all failures through the XCTest mechanism like a normal testing assert,
/// but with minimal failing case reported as well.
public var property : AssertiveQuickCheck = AssertiveQuickCheck()

public struct AssertiveQuickCheck {
	public subscript(s : String) -> Testable {
		get {
			fatalError("Assertive proposition '\(s)' has an undefined test case")
		}
		set(test) {
			let r = quickCheckWithResult(stdArgs(name: s), test)
			switch r {
			case let .Failure(numTests, numShrinks, usedSeed, usedSize, reason, labels, output):
				XCTFail(reason)
			case let .NoExpectedFailure(numTests, labels, output):
				XCTFail("Expected property to fail but it didn't.")
			default:
				return
			}
		}
	}
}

/// The interface for properties to be run through SwiftCheck without an XCTest assert.  The
/// property will still generate console output during testing.
public var reportProperty : ReportiveQuickCheck = ReportiveQuickCheck()

public struct ReportiveQuickCheck {
	public subscript(s : String) -> Testable {
		get {
			fatalError("Proposition '\(s)' has an undefined test case")
		}
		set(test) {
			quickCheck(test, name: s)
		}
	}
}<commit_msg>ExistentialFailure now fails in Xcode too<commit_after>//
//  Check.swift
//  SwiftCheck
//
//  Created by <NAME> on 1/19/15.
//  Copyright (c) 2015 TypeLift. All rights reserved.
//

import XCTest

/// The main interface for the SwiftCheck testing mechanism. To test a program property one 
/// subscripts into this variable with a description of the property being tested like so:
///
///     property["Integer Equality is Reflexive"] = forAll { (i : Int8) in
///	        return i == i
///     }
///
/// SwiftCheck will report all failures through the XCTest mechanism like a normal testing assert,
/// but with minimal failing case reported as well.
public var property : AssertiveQuickCheck = AssertiveQuickCheck()

public struct AssertiveQuickCheck {
	public subscript(s : String) -> Testable {
		get {
			fatalError("Assertive proposition '\(s)' has an undefined test case")
		}
		set(test) {
			let r = quickCheckWithResult(stdArgs(name: s), test)
			switch r {
			case let .Failure(_, _, _, _, reason, _, _):
				XCTFail(reason)
			case let .ExistentialFailure(_, _, _, reason, _, _, _):
				XCTFail(reason)
			case let .NoExpectedFailure(numTests, labels, output):
				XCTFail("Expected property to fail but it didn't.")
			default:
				return
			}
		}
	}
}

/// The interface for properties to be run through SwiftCheck without an XCTest assert.  The
/// property will still generate console output during testing.
public var reportProperty : ReportiveQuickCheck = ReportiveQuickCheck()

public struct ReportiveQuickCheck {
	public subscript(s : String) -> Testable {
		get {
			fatalError("Proposition '\(s)' has an undefined test case")
		}
		set(test) {
			quickCheck(test, name: s)
		}
	}
}
{'fraction_non_alphanumeric': 0.10655492367554624, 'fraction_numerical': 0.00598623166716552, 'mean_word_length': 3.317829457364341, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6680708', 'n_tokens_mistral': 1072, 'n_tokens_neox': 963, 'n_words': 359}