<commit_before>INIT {
    pir::load_bytecode("rosella/test.pbc");
    pir::load_bytecode("rosella/prototype.pbc");
}

Rosella::Test::test(PrototypeItemTest);

class PrototypeItemTest {
    method test_BUILD() {
        my $pmc := Rosella::construct(Rosella::Prototype::Entry, 1);
    }

    method test_create() {
        my $proto := "This is a string";
        my $item := Rosella::construct(Rosella::Prototype::Entry, $proto);
        my $other := $item.create();
        $!assert.equal($proto, $other);
        $!assert.not_same($proto, $other);
    }

    method test_construct() {
        my $proto := "This is a string";
        my &const := sub($self) { $self.replace("This", "That"); };
        my $item := Rosella::construct(Rosella::Prototype::Entry, $proto, &const);
        my $other := $item.create();
        $item.construct($other);
        $!assert.equal($other, "That is a string");
        $!assert.not_equal($other, $proto);
    }

    method test_construct_args() {
        my $proto := "This is a string";
        my &const := sub($self, $a, $b) { $self.replace($a, $b); };
        my $item := Rosella::construct(Rosella::Prototype::Entry, $proto, &const);
        my $other := $item.create();
        $item.construct($other, ["string", "test"]);
        $!assert.equal($other, "This is a test");
        $!assert.not_equal($other, $proto);
    }
}

<commit_msg>Fix broken Prototype test<commit_after>INIT {
    pir::load_bytecode("rosella/test.pbc");
    pir::load_bytecode("rosella/prototype.pbc");
}

Rosella::Test::test(PrototypeItemTest);

class PrototypeItemTest {
    method test_BUILD() {
        my $pmc := Rosella::construct(Rosella::Prototype::Manager::Entry, 1);
    }

    method test_create() {
        my $proto := "This is a string";
        my $item := Rosella::construct(Rosella::Prototype::Manager::Entry, $proto);
        my $other := $item.create();
        $!assert.equal($proto, $other);
        $!assert.not_same($proto, $other);
    }

    method test_construct() {
        my $proto := "This is a string";
        my &const := sub($self) { $self.replace("This", "That"); };
        my $item := Rosella::construct(Rosella::Prototype::Manager::Entry, $proto, &const);
        my $other := $item.create();
        $item.construct($other);
        $!assert.equal($other, "That is a string");
        $!assert.not_equal($other, $proto);
    }

    method test_construct_args() {
        my $proto := "This is a string";
        my &const := sub($self, $a, $b) { $self.replace($a, $b); };
        my $item := Rosella::construct(Rosella::Prototype::Manager::Entry, $proto, &const);
        my $other := $item.create();
        $item.construct($other, ["string", "test"]);
        $!assert.equal($other, "This is a test");
        $!assert.not_equal($other, $proto);
    }
}


{'fraction_non_alphanumeric': 0.19105113636363635, 'fraction_numerical': 0.0007102272727272727, 'mean_word_length': 3.070809248554913, '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': '5680021', 'n_tokens_mistral': 913, 'n_tokens_neox': 903, 'n_words': 189}