<commit_before>#! perl -w

use Parrot::Test tests => 8;
use Test::More;

output_is(<<'CODE', <<OUTPUT, "conv_i1_i");
    set I0, 127
    conv_i1 I0
    print I0
    print "\n"
    inc I0
    conv_i1 I0
    print I0
    print "\n"
    inc I0
    conv_i1 I0
    print I0
    print "\n"
    end
CODE
127
-128
-127
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_u1_i");
    set I0, 127
    conv_u1 I0
    print I0
    print "\n"
    inc I0
    conv_u1 I0
    print I0
    print "\n"
    set I0, 255
    conv_u1 I0
    print I0
    print "\n"
    inc I0
    conv_u1 I0
    print I0
    print "\n"
    end
CODE
127
128
255
0
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_i2_i");
    set I0, 32767
    conv_i2 I0
    print I0
    print "\n"
    inc I0
    conv_i2 I0
    print I0
    print "\n"
    inc I0
    conv_i2 I0
    print I0
    print "\n"
    end
CODE
32767
-32768
-32767
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_u2_i");
    set I0, 32767
    conv_u2 I0
    print I0
    print "\n"
    inc I0
    conv_u2 I0
    print I0
    print "\n"
    set I0, 65535
    conv_u2 I0
    print I0
    print "\n"
    inc I0
    conv_u2 I0
    print I0
    print "\n"
    end
CODE
32767
32768
65535
0
OUTPUT


output_is(<<'CODE', <<OUTPUT, "conv_i1_ofv_i");
    set I0, 127
    conv_i1_ovf I0
    print I0
    print "\n"
    set I0, 128
    conv_i1_ovf I0
    print I0
    print "\n"
    end
CODE
127
Overflow exception for conv_i1_ovf
OUTPUT


output_is(<<'CODE', <<OUTPUT, "conv_u1_ofv_i");
    set I0, 255
    conv_u1_ovf I0
    print I0
    print "\n"
    set I0, 256
    conv_u1_ovf I0
    print I0
    print "\n"
    end
CODE
255
Overflow exception for conv_u1_ovf
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_i2_ofv_i");
    set I0, 32767
    conv_i2_ovf I0
    print I0
    print "\n"
    inc I0
    conv_i2_ovf I0
    print I0
    print "\n"
    end
CODE
32767
Overflow exception for conv_i2_ovf
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_u2_ofv_i");
    set I0, 65535
    conv_u2_ovf I0
    print I0
    print "\n"
    inc I0
    conv_u2_ovf I0
    print I0
    print "\n"
    end
CODE
65535
Overflow exception for conv_u2_ovf
OUTPUT

1;<commit_msg>Test overflow in both directions<commit_after>#! perl -w

use Parrot::Test tests => 12;
use Test::More;

output_is(<<'CODE', <<OUTPUT, "conv_i1_i");
    set I0, 127
    conv_i1 I0
    print I0
    print "\n"
    inc I0
    conv_i1 I0
    print I0
    print "\n"
    inc I0
    conv_i1 I0
    print I0
    print "\n"
    dec I0
    conv_i1 I0
    print I0
    print "\n"
    dec I0
    conv_i1 I0
    print I0
    print "\n"
    end
CODE
127
-128
-127
-128
127
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_u1_i");
    set I0, 127
    conv_u1 I0
    print I0
    print "\n"
    inc I0
    conv_u1 I0
    print I0
    print "\n"
    set I0, 255
    conv_u1 I0
    print I0
    print "\n"
    inc I0
    conv_u1 I0
    print I0
    print "\n"
    dec I0
    conv_u1 I0
    print I0
    print "\n"
    end
CODE
127
128
255
0
255
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_i2_i");
    set I0, 32767
    conv_i2 I0
    print I0
    print "\n"
    inc I0
    conv_i2 I0
    print I0
    print "\n"
    inc I0
    conv_i2 I0
    print I0
    print "\n"
    dec I0
    conv_i2 I0
    print I0
    print "\n"
    dec I0
    conv_i2 I0
    print I0
    print "\n"
    end
CODE
32767
-32768
-32767
-32768
32767
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_u2_i");
    set I0, 32767
    conv_u2 I0
    print I0
    print "\n"
    inc I0
    conv_u2 I0
    print I0
    print "\n"
    set I0, 65535
    conv_u2 I0
    print I0
    print "\n"
    inc I0
    conv_u2 I0
    print I0
    print "\n"
    dec I0
    conv_u2 I0
    print I0
    print "\n"
    end
CODE
32767
32768
65535
0
65535
OUTPUT


output_is(<<'CODE', <<OUTPUT, "conv_i1_ofv_i, positive direction");
    set I0, 127
    conv_i1_ovf I0
    print I0
    print "\n"
    set I0, 128
    conv_i1_ovf I0
    print I0
    print "\n"
    end
CODE
127
Overflow exception for conv_i1_ovf
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_i1_ofv_i, negative direction");
    set I0, -128
    conv_i1_ovf I0
    print I0
    print "\n"
    dec I0
    conv_i1_ovf I0
    print I0
    print "\n"
    end
CODE
-128
Overflow exception for conv_i1_ovf
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_u1_ofv_i, positive direction");
    set I0, 255
    conv_u1_ovf I0
    print I0
    print "\n"
    set I0, 256
    conv_u1_ovf I0
    print I0
    print "\n"
    end
CODE
255
Overflow exception for conv_u1_ovf
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_u1_ofv_i, negative direction");
    set I0, 0
    conv_u1_ovf I0
    print I0
    print "\n"
    dec I0
    conv_u1_ovf I0
    print I0
    print "\n"
    end
CODE
0
Overflow exception for conv_u1_ovf
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_i2_ofv_i, positive direction");
    set I0, 32767
    conv_i2_ovf I0
    print I0
    print "\n"
    inc I0
    conv_i2_ovf I0
    print I0
    print "\n"
    end
CODE
32767
Overflow exception for conv_i2_ovf
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_i2_ofv_i, negative direction");
    set I0, -32768
    conv_i2_ovf I0
    print I0
    print "\n"
    dec I0
    conv_i2_ovf I0
    print I0
    print "\n"
    end
CODE
-32768
Overflow exception for conv_i2_ovf
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_u2_ofv_i, positive direction");
    set I0, 65535
    conv_u2_ovf I0
    print I0
    print "\n"
    inc I0
    conv_u2_ovf I0
    print I0
    print "\n"
    end
CODE
65535
Overflow exception for conv_u2_ovf
OUTPUT

output_is(<<'CODE', <<OUTPUT, "conv_u2_ofv_i, negative direction");
    set I0, 0
    conv_u2_ovf I0
    print I0
    print "\n"
    dec I0
    conv_u2_ovf I0
    print I0
    print "\n"
    end
CODE
0
Overflow exception for conv_u2_ovf
OUTPUT

1;
{'fraction_non_alphanumeric': 0.0895938643890535, 'fraction_numerical': 0.09360292835976991, 'mean_word_length': 2.091594827586207, 'pattern_counts': {'":': 0, '<': 83, '<?xml version=': 0, '>': 5, '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': '3769259', 'n_tokens_mistral': 2679, 'n_tokens_neox': 2482, 'n_words': 745}