<commit_before>//
//  Satisfy.swift
//  OMM
//
//  Created by <NAME> on 06/10/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Nimble

func satisfy<T>(closure: @escaping (T) -> Void) -> MatcherFunc<T> {
    return MatcherFunc { actualExpression, failureMessage in
        failureMessage.postfixMessage = "satisfy closure"
        guard let actualValue = try actualExpression.evaluate() else {
            return false
        }
        return gatherFailingExpectations { closure(actualValue) }.isEmpty
    }
}<commit_msg>Use predicate instead of mather for tests<commit_after>//
//  Satisfy.swift
//  OMM
//
//  Created by <NAME> on 06/10/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Nimble

func satisfy<T>(closure: @escaping (T) -> Void) -> Predicate<T> {
    return Predicate.simple("satisfy closure") { actualExpression in
        guard let actualValue = try actualExpression.evaluate() else {
            return .fail
        }
        let failures = gatherFailingExpectations { closure(actualValue) }
        return failures.isEmpty ? .matches : .fail
    }
}
{'fraction_non_alphanumeric': 0.11807447774750227, 'fraction_numerical': 0.018165304268846504, 'mean_word_length': 2.697986577181208, 'pattern_counts': {'":': 0, '<': 11, '<?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': '1339705', 'n_tokens_mistral': 350, 'n_tokens_neox': 321, 'n_words': 93}