<commit_before>#! parrot-nqp
our @ARGS;
MAIN();

sub MAIN () {
    Q:PIR {
        .local pmc c
        load_language 'parrot'
        c = compreg 'parrot'
        c.'import'('Test::More')

        .local pmc pla
        pla = loadlib './linalg_group'
        if pla goto pla_library_loaded
        say "Cannot load linalg_group"
        exit 1
      pla_library_loaded:
    };

    plan(7);

    create_complexmatrix2d();
    op_does_matrix();
    vtable_get_number_keyed();
    vtable_get_integer_keyed();
    vtable_get_string_keyed();
    vtable_get_pmc_keyed();
    vtable_set_pmc_keyed();
    vtable_set_string_keyed();
    vtable_get_string();
    vtable_get_attr_string();
    vtable_clone();
    vtable_is_equal();
    method_resize();
    method_fill();
    method_transpose();
    method_mem_transpose();
    method_conjugate();
    method_iterate_function_inplace();
}

sub create_complexmatrix2d() {
    Q:PIR {
        push_eh can_not_create
        $P0 = new ['ComplexMatrix2D']
        $I0 = isnull $P0
        $I0 = not $I0
        'ok'($I0, "Can create a new ComplexMatrix2D")
        .return()
      can_not_create:
        'ok'(0, "Could not create a ComplexMatrix2D")
        .return()
    }
}

sub op_does_matrix() {
    Q:PIR {
        $P0 = new ['ComplexMatrix2D']
        $I0 = does $P0, 'matrix'
        ok($I0, "ComplexMatrix2D does matrix")
        $I0 = does $P0, 'gobbledegak'
        $I0 = not $I0
        ok($I0, "...and only does matrix")
    }
}

sub vtable_get_number_keyed() {}
sub vtable_get_integer_keyed() {}
sub vtable_get_string_keyed() {}
sub vtable_get_pmc_keyed() {}
sub vtable_set_pmc_keyed() {}
sub vtable_set_string_keyed() {}
sub vtable_get_string() {}<commit_msg>add tests for ComplexMatrix2D<commit_after>#! parrot-nqp
our @ARGS;
MAIN();

sub MAIN () {
    Q:PIR {
        .local pmc c
        load_language 'parrot'
        c = compreg 'parrot'
        c.'import'('Test::More')

        .local pmc pla
        pla = loadlib './linalg_group'
        if pla goto pla_library_loaded
        say "Cannot load linalg_group"
        exit 1
      pla_library_loaded:
    };

    plan(10);

    create_complexmatrix2d();
    op_does_matrix();
    vtable_get_number_keyed();
    vtable_get_integer_keyed();
    vtable_get_string_keyed();
    vtable_get_pmc_keyed();
    vtable_set_pmc_keyed();
    vtable_set_string_keyed();
    vtable_get_string();
    vtable_get_attr_string();
    vtable_clone();
    vtable_is_equal();
    method_resize();
    method_fill();
    method_transpose();
    method_mem_transpose();
    method_conjugate();
    method_iterate_function_inplace();
}

sub create_complexmatrix2d() {
    Q:PIR {
        push_eh can_not_create
        $P0 = new ['ComplexMatrix2D']
        $I0 = isnull $P0
        $I0 = not $I0
        'ok'($I0, "Can create a new ComplexMatrix2D")
        .return()
      can_not_create:
        'ok'(0, "Could not create a ComplexMatrix2D")
        .return()
    }
}

sub op_does_matrix() {
    Q:PIR {
        $P0 = new ['ComplexMatrix2D']
        $I0 = does $P0, 'matrix'
        ok($I0, "ComplexMatrix2D does matrix")
        $I0 = does $P0, 'gobbledegak'
        $I0 = not $I0
        ok($I0, "...and only does matrix")
    }
}

sub vtable_get_number_keyed() {}
sub vtable_get_integer_keyed() {}
sub vtable_get_string_keyed() {}

sub vtable_get_pmc_keyed() {
    Q:PIR {
        $P0 = new ['ComplexMatrix2D']
        $P1 = new ['Complex']
        $P1 = "1+1i"
        $P0[0;0] = $P1
        $P2 = $P0[0;0]
        is($P1, $P2, "get_pmc_keyed works")
    }        
}

sub vtable_set_pmc_keyed() {
    Q:PIR {
        $P0 = new ['ComplexMatrix2D']
        $P1 = new ['Complex']
        $P1 = "1+1i"
        $P0[0;0] = $P1
        ok(1, "set_pmc_keyed didn't throw a fit")
    }        
}

sub vtable_set_string_keyed() {
    Q:PIR {
        $P0 = new ['ComplexMatrix2D']
        $P1 = new ['Complex']
        $P1 = "1+1i"
        $P0[0;0] = "1+1i"
        $P2 = $P0[0;0]
        is($P1, $P2, "set_string_keyed works")
    } 
}
sub vtable_get_string() {}
{'fraction_non_alphanumeric': 0.13303659742828883, 'fraction_numerical': 0.02373887240356083, 'mean_word_length': 2.4106239460370995, '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': '4477110', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1549, 'n_words': 300}