<commit_before><commit_msg>Add PropertyProverTester<commit_after>

from t_core.messages import Packet
from t_core.iterator import Iterator
from t_core.matcher import Matcher
from t_core.rewriter import Rewriter


class PropertyProverTester:

    def set_artifacts(self, transformation, ruleTraceCheckers, matchRulePatterns, ruleCombinators):
        self.transformation = transformation
        self.rules = {}
        for layer in transformation:
            for rule in layer:
                self.rules[rule.name] = rule

        self.ruleTraceCheckers = ruleTraceCheckers
        self.matchRulePatterns = matchRulePatterns
        self.ruleCombinators = ruleCombinators

    def test_matchers(self):

        for rule_name in self.rules.keys():
            print("Testing matcher for " + rule_name)

            p = Packet()
            p.graph = self.rules[rule_name]

            matcher = self.matchRulePatterns[rule_name][0]

            matcher.packet_in(p)

            if not matcher.is_success:
                print("The matcher for " + rule_name + " did not match the rule")
            #    raise Exception("The matcher for " + rule_name + " did not match the rule")
{'fraction_non_alphanumeric': 0.07281964436917866, 'fraction_numerical': 0.000846740050804403, 'mean_word_length': 2.592705167173252, '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': '5288575', 'n_tokens_mistral': 335, 'n_tokens_neox': 320, 'n_words': 84}