# New Ticket Created by "Paul Cochrane" # Please include the string: [perl #40364] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40364 >
Hi, This patch changes the line endings of the files listed below from dos to unix. Regards, Paul files affected by this patch: t/dynpmc/sparse_perlarray.t t/perl/Parrot_Test.t t/dynoplibs/dan.t t/dynoplibs/myops.t t/codingstd/code_coda.t
Index: t/dynpmc/sparse_perlarray.t =================================================================== --- t/dynpmc/sparse_perlarray.t (revision 14660) +++ t/dynpmc/sparse_perlarray.t (working copy) @@ -1,211 +1,211 @@ -#! perl -# Copyright (C) 2001-2006, The Perl Foundation. -# $Id$ - -use strict; -use warnings; -use lib qw( . lib ../lib ../../lib ); - -use Test::More; -use Parrot::Test tests => 4; - -=head1 NAME - -t/dynpmc/sparse_perlarray.t - testing sparse arrays using the PerlArray PMC - -=head1 SYNOPSIS - - % prove t/dynpmc/sparse_perlarray.t - -=head1 DESCRIPTION - -Tests various PMCs using the C<PerlArray> PMC for sparse array access. -Once we have sparse array access in a core PMC, we can move these tests. - -=cut - - -my $SPEEDUP = $ENV{RUNNING_MAKE_TEST} ? "gc_debug 0\n" : ""; -pasm_output_is($SPEEDUP . <<'CODE', <<'OUTPUT', "IntList: direct access"); - loadlib P20, 'perl_group' - new P0, .IntList - set S0, "" - set S1, "abcdefghijklmnopqrst" - set I10, 100000 - set I0, 0 -lp: - set P0[I0], I0 - inc I0 - mod I9, I0, 100 - ne I9, 0, lp1 - # force GC => 142 DOD + 142 collects / 10^5 accesses - loadlib P20, 'perl_group' - find_type I21, 'PerlArray' - new P1,I21 - set P1[I0], I0 - concat S0, S1, S1 - set S2, S0 - set S0, S1 - set S2, "" -lp1: - le I0, I10, lp - - set I0, 0 -lp2: - set I1, P0[I0] - ne I0, I1, err - inc I0 - le I0, I10, lp2 - print "ok\n" - end -err: - print "err: wanted " - print I0 - print " got " - print I1 - print "\n" - end -CODE -ok -OUTPUT - -pasm_output_is($SPEEDUP . <<'CODE', <<'OUTPUT', "IntList: shift/unshift"); - loadlib P20, 'perl_group' - new P0, .IntList - set I10, 100000 - set S0, "" - set S1, "abcdefghijklmnopqrst" - set I0, 0 -lp: - unshift P0, I0 - inc I0 - mod I9, I0, 100 - ne I9, 0, lp1 - # force GC => 124 DOD + 124 collects / 10^5 accesses - # need .PerlArray here - it auto extends - intlist doesnt - loadlib P20, 'perl_group' - find_type I21, 'PerlArray' - new P1,I21 - set P1[I0], I0 - concat S0, S1, S1 - set S2, S0 - set S0, S1 - set S2, "" -lp1: - ne I0, I10, lp -lp2: - dec I0 - shift I1, P0 - ne I0, I1, err - ne I0, 0, lp2 - print "ok 1\n" - set I1, P0 - set I0, 0 - ne I0, 0, err - print "ok 2\n" - end -err: - print "err: wanted " - print I0 - print " got " - print I1 - print "\n" - end -CODE -ok 1 -ok 2 -OUTPUT - - -pasm_output_is($SPEEDUP . <<'CODE', <<'OUTPUT', "ResizableBooleanArray: direct access"); - loadlib P20, 'perl_group' - new P0, .ResizableBooleanArray - set S0, "" - set S1, "abcdefghijklmnopqrst" - set I10, 100000 - set I0, 0 -lp: - mod I2, I0, 2 - set P0[I0], I2 - inc I0 - mod I9, I0, 100 - ne I9, 0, lp1 - # force GC => 142 DOD + 142 collects / 10^5 accesses - loadlib P20, 'perl_group' - find_type I21, 'PerlArray' - new P1,I21 - set P1[I0], I0 - concat S0, S1, S1 - set S2, S0 - set S0, S1 - set S2, "" -lp1: - le I0, I10, lp - - set I0, 0 -lp2: - mod I2, I0, 2 - set I1, P0[I0] - ne I2, I1, err - inc I0 - le I0, I10, lp2 - print "ok\n" - end -err: - print "err: wanted " - print I0 - print " got " - print I1 - print "\n" - end -CODE -ok -OUTPUT - - -pasm_output_is($SPEEDUP . <<'CODE', <<'OUTPUT', "ResizableStringArray: direct access"); - new P0, .ResizableStringArray - set S0, "" - set S1, "abcdefghijklmnopqrst" - set I10, 100000 - set I0, 0 -lp: - mod I2, I0, 2 - set S30, I2 - set P0[I0], S30 - inc I0 - mod I9, I0, 100 - ne I9, 0, lp1 - # force GC => 142 DOD + 142 collects / 10^5 accesses - loadlib P20, 'perl_group' - find_type I21, 'PerlArray' - new P1,I21 - set P1[I0], I0 - concat S0, S1, S1 - set S2, S0 - set S0, S1 - set S2, "" -lp1: - le I0, I10, lp - - set I0, 0 -lp2: - mod I2, I0, 2 - set S29, P0[I0] - set I16, S29 - ne I2, I16, err - inc I0 - le I0, I10, lp2 - print "ok\n" - end -err: - print "err: wanted " - print I0 - print " got " - print S29 - print "\n" - end -CODE -ok -OUTPUT - +#! perl +# Copyright (C) 2001-2006, The Perl Foundation. +# $Id$ + +use strict; +use warnings; +use lib qw( . lib ../lib ../../lib ); + +use Test::More; +use Parrot::Test tests => 4; + +=head1 NAME + +t/dynpmc/sparse_perlarray.t - testing sparse arrays using the PerlArray PMC + +=head1 SYNOPSIS + + % prove t/dynpmc/sparse_perlarray.t + +=head1 DESCRIPTION + +Tests various PMCs using the C<PerlArray> PMC for sparse array access. +Once we have sparse array access in a core PMC, we can move these tests. + +=cut + + +my $SPEEDUP = $ENV{RUNNING_MAKE_TEST} ? "gc_debug 0\n" : ""; +pasm_output_is($SPEEDUP . <<'CODE', <<'OUTPUT', "IntList: direct access"); + loadlib P20, 'perl_group' + new P0, .IntList + set S0, "" + set S1, "abcdefghijklmnopqrst" + set I10, 100000 + set I0, 0 +lp: + set P0[I0], I0 + inc I0 + mod I9, I0, 100 + ne I9, 0, lp1 + # force GC => 142 DOD + 142 collects / 10^5 accesses + loadlib P20, 'perl_group' + find_type I21, 'PerlArray' + new P1,I21 + set P1[I0], I0 + concat S0, S1, S1 + set S2, S0 + set S0, S1 + set S2, "" +lp1: + le I0, I10, lp + + set I0, 0 +lp2: + set I1, P0[I0] + ne I0, I1, err + inc I0 + le I0, I10, lp2 + print "ok\n" + end +err: + print "err: wanted " + print I0 + print " got " + print I1 + print "\n" + end +CODE +ok +OUTPUT + +pasm_output_is($SPEEDUP . <<'CODE', <<'OUTPUT', "IntList: shift/unshift"); + loadlib P20, 'perl_group' + new P0, .IntList + set I10, 100000 + set S0, "" + set S1, "abcdefghijklmnopqrst" + set I0, 0 +lp: + unshift P0, I0 + inc I0 + mod I9, I0, 100 + ne I9, 0, lp1 + # force GC => 124 DOD + 124 collects / 10^5 accesses + # need .PerlArray here - it auto extends - intlist doesnt + loadlib P20, 'perl_group' + find_type I21, 'PerlArray' + new P1,I21 + set P1[I0], I0 + concat S0, S1, S1 + set S2, S0 + set S0, S1 + set S2, "" +lp1: + ne I0, I10, lp +lp2: + dec I0 + shift I1, P0 + ne I0, I1, err + ne I0, 0, lp2 + print "ok 1\n" + set I1, P0 + set I0, 0 + ne I0, 0, err + print "ok 2\n" + end +err: + print "err: wanted " + print I0 + print " got " + print I1 + print "\n" + end +CODE +ok 1 +ok 2 +OUTPUT + + +pasm_output_is($SPEEDUP . <<'CODE', <<'OUTPUT', "ResizableBooleanArray: direct access"); + loadlib P20, 'perl_group' + new P0, .ResizableBooleanArray + set S0, "" + set S1, "abcdefghijklmnopqrst" + set I10, 100000 + set I0, 0 +lp: + mod I2, I0, 2 + set P0[I0], I2 + inc I0 + mod I9, I0, 100 + ne I9, 0, lp1 + # force GC => 142 DOD + 142 collects / 10^5 accesses + loadlib P20, 'perl_group' + find_type I21, 'PerlArray' + new P1,I21 + set P1[I0], I0 + concat S0, S1, S1 + set S2, S0 + set S0, S1 + set S2, "" +lp1: + le I0, I10, lp + + set I0, 0 +lp2: + mod I2, I0, 2 + set I1, P0[I0] + ne I2, I1, err + inc I0 + le I0, I10, lp2 + print "ok\n" + end +err: + print "err: wanted " + print I0 + print " got " + print I1 + print "\n" + end +CODE +ok +OUTPUT + + +pasm_output_is($SPEEDUP . <<'CODE', <<'OUTPUT', "ResizableStringArray: direct access"); + new P0, .ResizableStringArray + set S0, "" + set S1, "abcdefghijklmnopqrst" + set I10, 100000 + set I0, 0 +lp: + mod I2, I0, 2 + set S30, I2 + set P0[I0], S30 + inc I0 + mod I9, I0, 100 + ne I9, 0, lp1 + # force GC => 142 DOD + 142 collects / 10^5 accesses + loadlib P20, 'perl_group' + find_type I21, 'PerlArray' + new P1,I21 + set P1[I0], I0 + concat S0, S1, S1 + set S2, S0 + set S0, S1 + set S2, "" +lp1: + le I0, I10, lp + + set I0, 0 +lp2: + mod I2, I0, 2 + set S29, P0[I0] + set I16, S29 + ne I2, I16, err + inc I0 + le I0, I10, lp2 + print "ok\n" + end +err: + print "err: wanted " + print I0 + print " got " + print S29 + print "\n" + end +CODE +ok +OUTPUT + Index: t/perl/Parrot_Test.t =================================================================== --- t/perl/Parrot_Test.t (revision 14660) +++ t/perl/Parrot_Test.t (working copy) @@ -1,279 +1,279 @@ -#! perl -# Copyright (C) 2001-2006, The Perl Foundation. -# $Id$ - -use strict; -use warnings; -use lib qw( . lib ../lib ../../lib ); - -BEGIN { - eval "use Test::Builder::Tester;"; - if ($@) { - print "1..0 # Skip Test::Builder::Tester not installed\n"; - exit 0; - } -} -use Test::More; - - -=head1 NAME - -t/perl/Parrot_Test.t - Parrot::Test unit tests - -=head1 SYNOPSIS - - % prove t/perl/Parrot_Test.t - -=head1 DESCRIPTION - -These tests cover the basic functionality of C<Parrot::Test>. - -=cut - - -BEGIN -{ - my $pre_env = exists $ENV{PARROT_TEST} ? $ENV{PARROT_TEST} : undef; - use_ok('Parrot::Test') or die; - - # XXX Shouldn't this be in an END block - my $post_env = exists $ENV{PARROT_TEST} ? $ENV{PARROT_TEST} : undef; - if ( defined $pre_env ) { - is( $post_env, $pre_env, 'PARROT_TEST env unchanged' ); - } else { - is( $post_env, 1, 'PARROT_TEST env set' ); - } -} - - -can_ok('Parrot::Test', $_) for qw/ - language_output_is language_output_like language_output_isnt - example_output_is - pasm_output_is pasm_output_like pasm_output_isnt - past_output_is past_output_like past_output_isnt - pir_output_is pir_output_like pir_output_isnt - pir_2_pasm_is pir_2_pasm_like pir_2_pasm_isnt - pbc_output_is pbc_output_like pbc_output_isnt - c_output_is c_output_like c_output_isnt - plan - skip - slurp_file - run_command -/; - - -## TODO run_command - - -## per_test -is( Parrot::Test::per_test(), undef, 'per_test() no args' ); -is( Parrot::Test::per_test(undef, 0), undef, 'per_test() invalid first arg' ); -is( Parrot::Test::per_test(0, undef), undef, 'per_test() invalid second arg' ); -is( Parrot::Test::per_test(undef, undef), undef, 'per_test() two invalid args' ); - - -### TODO write_code_to_file, plan, skip, slurp_file, _generate_functions, example_output_is - - -## test functions generated by Parrot::Test -my( $desc, $err, $line ); - -## PASM -$desc = 'pasm_output_is: success'; -test_out "ok 1 - $desc"; -pasm_output_is <<'CODE', <<'OUTPUT', $desc; - print "ok\n" - end -CODE -ok -OUTPUT -test_test $desc; - -$desc = 'pasm_output_is: failure'; -$line = line_num(+11); -test_out "not ok 1 - $desc"; -$err = <<ERR; -# Failed test ($0 at line $line) -# got: 'ok -# ' -# expected: 'not ok -# ' -ERR -chomp $err; -test_err $err; -pasm_output_is <<'CODE', <<"OUTPUT", $desc; - print "ok\n" - end -CODE -not ok -OUTPUT -test_test $desc; - - -$desc = 'pasm_output_isnt: success'; -test_out "ok 1 - $desc"; -pasm_output_isnt <<'CODE', <<"OUTPUT", $desc; - print "ok\n" - end -CODE -not ok -OUTPUT -test_test $desc; - -$desc = 'pasm_output_isnt: failure'; -$line = line_num(+12); -test_out "not ok 1 - $desc"; -$err = <<ERR; -# Failed test ($0 at line $line) -# 'ok -# ' -# ne -# 'ok -# ' -ERR -chomp $err; -test_err $err; -pasm_output_isnt <<'CODE', <<'OUTPUT', $desc; - print "ok\n" - end -CODE -ok -OUTPUT -test_test $desc; - - -$desc = 'pasm_output_like: success'; -test_out "ok 1 - $desc"; -pasm_output_like <<'CODE', <<'OUTPUT', $desc; - print "ok\n" - end -CODE -/ok/ -OUTPUT -test_test $desc; - -$desc = 'pasm_output_like: failure'; -$line = line_num(+11); -test_out "not ok 1 - $desc"; -$err = <<ERR; -# Failed test ($0 at line $line) -# 'ok -# ' -# doesn't match '/not ok/ -# ' -ERR -chomp $err; -test_err $err; -pasm_output_like <<'CODE', <<"OUTPUT", $desc; - print "ok\n" - end -CODE -/not ok/ -OUTPUT -test_test $desc; - - -## PIR -$desc = 'pir_output_is: success'; -test_out "ok 1 - $desc"; -pir_output_is <<'CODE', <<'OUTPUT', $desc; -.sub 'test' :main - print "ok\n" -.end -CODE -ok -OUTPUT -test_test $desc; - -$desc = 'pir_output_is: failure'; -$line = line_num(+11); -test_out "not ok 1 - $desc"; -$err = <<ERR; -# Failed test ($0 at line $line) -# got: 'ok -# ' -# expected: 'not ok -# ' -ERR -chomp $err; -test_err $err; -pir_output_is <<'CODE', <<"OUTPUT", $desc; -.sub 'test' :main - print "ok\n" -.end -CODE -not ok -OUTPUT -test_test $desc; - - -$desc = 'pir_output_isnt: success'; -test_out "ok 1 - $desc"; -pir_output_isnt <<'CODE', <<"OUTPUT", $desc; -.sub 'test' :main - print "ok\n" -.end -CODE -not ok -OUTPUT -test_test $desc; - -$desc = 'pir_output_isnt: failure'; -$line = line_num(+12); -test_out "not ok 1 - $desc"; -$err = <<ERR; -# Failed test ($0 at line $line) -# 'ok -# ' -# ne -# 'ok -# ' -ERR -chomp $err; -test_err $err; -pir_output_isnt <<'CODE', <<'OUTPUT', $desc; -.sub 'test' :main - print "ok\n" -.end -CODE -ok -OUTPUT -test_test $desc; - - -$desc = 'pir_output_like: success'; -test_out "ok 1 - $desc"; -pir_output_like <<'CODE', <<'OUTPUT', $desc; -.sub 'test' :main - print "ok\n" -.end -CODE -/ok/ -OUTPUT -test_test $desc; - -$desc = 'pir_output_like: failure'; -$line = line_num(+11); -test_out "not ok 1 - $desc"; -$err = <<ERR; -# Failed test ($0 at line $line) -# 'ok -# ' -# doesn't match '/not ok/ -# ' -ERR -chomp $err; -test_err $err; -pir_output_like <<'CODE', <<"OUTPUT", $desc; -.sub 'test' :main - print "ok\n" -.end -CODE -/not ok/ -OUTPUT -test_test $desc; - - -## vim: expandtab sw=4 -## remember to change the number of tests :-) -BEGIN { plan tests => 42; } +#! perl +# Copyright (C) 2001-2006, The Perl Foundation. +# $Id$ + +use strict; +use warnings; +use lib qw( . lib ../lib ../../lib ); + +BEGIN { + eval "use Test::Builder::Tester;"; + if ($@) { + print "1..0 # Skip Test::Builder::Tester not installed\n"; + exit 0; + } +} +use Test::More; + + +=head1 NAME + +t/perl/Parrot_Test.t - Parrot::Test unit tests + +=head1 SYNOPSIS + + % prove t/perl/Parrot_Test.t + +=head1 DESCRIPTION + +These tests cover the basic functionality of C<Parrot::Test>. + +=cut + + +BEGIN +{ + my $pre_env = exists $ENV{PARROT_TEST} ? $ENV{PARROT_TEST} : undef; + use_ok('Parrot::Test') or die; + + # XXX Shouldn't this be in an END block + my $post_env = exists $ENV{PARROT_TEST} ? $ENV{PARROT_TEST} : undef; + if ( defined $pre_env ) { + is( $post_env, $pre_env, 'PARROT_TEST env unchanged' ); + } else { + is( $post_env, 1, 'PARROT_TEST env set' ); + } +} + + +can_ok('Parrot::Test', $_) for qw/ + language_output_is language_output_like language_output_isnt + example_output_is + pasm_output_is pasm_output_like pasm_output_isnt + past_output_is past_output_like past_output_isnt + pir_output_is pir_output_like pir_output_isnt + pir_2_pasm_is pir_2_pasm_like pir_2_pasm_isnt + pbc_output_is pbc_output_like pbc_output_isnt + c_output_is c_output_like c_output_isnt + plan + skip + slurp_file + run_command +/; + + +## TODO run_command + + +## per_test +is( Parrot::Test::per_test(), undef, 'per_test() no args' ); +is( Parrot::Test::per_test(undef, 0), undef, 'per_test() invalid first arg' ); +is( Parrot::Test::per_test(0, undef), undef, 'per_test() invalid second arg' ); +is( Parrot::Test::per_test(undef, undef), undef, 'per_test() two invalid args' ); + + +### TODO write_code_to_file, plan, skip, slurp_file, _generate_functions, example_output_is + + +## test functions generated by Parrot::Test +my( $desc, $err, $line ); + +## PASM +$desc = 'pasm_output_is: success'; +test_out "ok 1 - $desc"; +pasm_output_is <<'CODE', <<'OUTPUT', $desc; + print "ok\n" + end +CODE +ok +OUTPUT +test_test $desc; + +$desc = 'pasm_output_is: failure'; +$line = line_num(+11); +test_out "not ok 1 - $desc"; +$err = <<ERR; +# Failed test ($0 at line $line) +# got: 'ok +# ' +# expected: 'not ok +# ' +ERR +chomp $err; +test_err $err; +pasm_output_is <<'CODE', <<"OUTPUT", $desc; + print "ok\n" + end +CODE +not ok +OUTPUT +test_test $desc; + + +$desc = 'pasm_output_isnt: success'; +test_out "ok 1 - $desc"; +pasm_output_isnt <<'CODE', <<"OUTPUT", $desc; + print "ok\n" + end +CODE +not ok +OUTPUT +test_test $desc; + +$desc = 'pasm_output_isnt: failure'; +$line = line_num(+12); +test_out "not ok 1 - $desc"; +$err = <<ERR; +# Failed test ($0 at line $line) +# 'ok +# ' +# ne +# 'ok +# ' +ERR +chomp $err; +test_err $err; +pasm_output_isnt <<'CODE', <<'OUTPUT', $desc; + print "ok\n" + end +CODE +ok +OUTPUT +test_test $desc; + + +$desc = 'pasm_output_like: success'; +test_out "ok 1 - $desc"; +pasm_output_like <<'CODE', <<'OUTPUT', $desc; + print "ok\n" + end +CODE +/ok/ +OUTPUT +test_test $desc; + +$desc = 'pasm_output_like: failure'; +$line = line_num(+11); +test_out "not ok 1 - $desc"; +$err = <<ERR; +# Failed test ($0 at line $line) +# 'ok +# ' +# doesn't match '/not ok/ +# ' +ERR +chomp $err; +test_err $err; +pasm_output_like <<'CODE', <<"OUTPUT", $desc; + print "ok\n" + end +CODE +/not ok/ +OUTPUT +test_test $desc; + + +## PIR +$desc = 'pir_output_is: success'; +test_out "ok 1 - $desc"; +pir_output_is <<'CODE', <<'OUTPUT', $desc; +.sub 'test' :main + print "ok\n" +.end +CODE +ok +OUTPUT +test_test $desc; + +$desc = 'pir_output_is: failure'; +$line = line_num(+11); +test_out "not ok 1 - $desc"; +$err = <<ERR; +# Failed test ($0 at line $line) +# got: 'ok +# ' +# expected: 'not ok +# ' +ERR +chomp $err; +test_err $err; +pir_output_is <<'CODE', <<"OUTPUT", $desc; +.sub 'test' :main + print "ok\n" +.end +CODE +not ok +OUTPUT +test_test $desc; + + +$desc = 'pir_output_isnt: success'; +test_out "ok 1 - $desc"; +pir_output_isnt <<'CODE', <<"OUTPUT", $desc; +.sub 'test' :main + print "ok\n" +.end +CODE +not ok +OUTPUT +test_test $desc; + +$desc = 'pir_output_isnt: failure'; +$line = line_num(+12); +test_out "not ok 1 - $desc"; +$err = <<ERR; +# Failed test ($0 at line $line) +# 'ok +# ' +# ne +# 'ok +# ' +ERR +chomp $err; +test_err $err; +pir_output_isnt <<'CODE', <<'OUTPUT', $desc; +.sub 'test' :main + print "ok\n" +.end +CODE +ok +OUTPUT +test_test $desc; + + +$desc = 'pir_output_like: success'; +test_out "ok 1 - $desc"; +pir_output_like <<'CODE', <<'OUTPUT', $desc; +.sub 'test' :main + print "ok\n" +.end +CODE +/ok/ +OUTPUT +test_test $desc; + +$desc = 'pir_output_like: failure'; +$line = line_num(+11); +test_out "not ok 1 - $desc"; +$err = <<ERR; +# Failed test ($0 at line $line) +# 'ok +# ' +# doesn't match '/not ok/ +# ' +ERR +chomp $err; +test_err $err; +pir_output_like <<'CODE', <<"OUTPUT", $desc; +.sub 'test' :main + print "ok\n" +.end +CODE +/not ok/ +OUTPUT +test_test $desc; + + +## vim: expandtab sw=4 +## remember to change the number of tests :-) +BEGIN { plan tests => 42; } Index: t/dynoplibs/dan.t =================================================================== --- t/dynoplibs/dan.t (revision 14660) +++ t/dynoplibs/dan.t (working copy) @@ -1,97 +1,97 @@ -#! perl -# Copyright (C) 2006, The Perl Foundation. -# $Id$ - -use strict; -use warnings; -use lib qw( . lib ../lib ../../lib ); -use Test::More; -use Parrot::Test tests => 6; -use Parrot::Config; - - -=head1 NAME - -t/dynoplibs/dan.t - Test for the ops in src/dynoplibs/dan.ops - -=head1 SYNOPSIS - - % prove t/dynoplibs/dan.t - -=head1 DESCRIPTION - -Tests the sample dynamic op library "dan". - -=cut - - -pir_output_is(<< 'CODE', << 'OUTPUT', "mul_i_ic_nc"); -.loadlib "dan_ops" -.sub main :main - mul $I1, 10, 2.5 - print $I1 - print "\n" -.end -CODE -25 -OUTPUT - -pir_output_is(<< 'CODE', << 'OUTPUT', "mul_i_i_nc"); -.loadlib "dan_ops" -.sub main :main - $I2 = 10 - mul $I1, $I2, 4.2 - print $I1 - print "\n" -.end -CODE -42 -OUTPUT - -pir_output_is(<< 'CODE', << 'OUTPUT', "mul_i_ic_n"); -.loadlib "dan_ops" -.sub main :main - $N3 = 4.2 - mul $I1, 10, $N3 - print $I1 - print "\n" -.end -CODE -42 -OUTPUT - -pir_output_is(<< 'CODE', << 'OUTPUT', "mul_i_i_n"); -.loadlib "dan_ops" -.sub main :main - $I2 = 10 - $N3 = 4.2 - mul $I1, $I2, $N3 - print $I1 - print "\n" -.end -CODE -42 -OUTPUT - -pir_output_is(<< 'CODE', << 'OUTPUT', "mul pir syntax"); -.loadlib "dan_ops" -.sub main :main - $I2 = 10 - $N3 = 4.2 - $I1 = mul $I2, $N3 - print $I1 - print "\n" -.end -CODE -42 -OUTPUT - -pasm_output_is(<< 'CODE', << 'OUTPUT', "mul pasm syntax"); -.loadlib "dan_ops" - mul I0, 3, 3.9 - print I0 - print "\n" - end -CODE -11 -OUTPUT +#! perl +# Copyright (C) 2006, The Perl Foundation. +# $Id$ + +use strict; +use warnings; +use lib qw( . lib ../lib ../../lib ); +use Test::More; +use Parrot::Test tests => 6; +use Parrot::Config; + + +=head1 NAME + +t/dynoplibs/dan.t - Test for the ops in src/dynoplibs/dan.ops + +=head1 SYNOPSIS + + % prove t/dynoplibs/dan.t + +=head1 DESCRIPTION + +Tests the sample dynamic op library "dan". + +=cut + + +pir_output_is(<< 'CODE', << 'OUTPUT', "mul_i_ic_nc"); +.loadlib "dan_ops" +.sub main :main + mul $I1, 10, 2.5 + print $I1 + print "\n" +.end +CODE +25 +OUTPUT + +pir_output_is(<< 'CODE', << 'OUTPUT', "mul_i_i_nc"); +.loadlib "dan_ops" +.sub main :main + $I2 = 10 + mul $I1, $I2, 4.2 + print $I1 + print "\n" +.end +CODE +42 +OUTPUT + +pir_output_is(<< 'CODE', << 'OUTPUT', "mul_i_ic_n"); +.loadlib "dan_ops" +.sub main :main + $N3 = 4.2 + mul $I1, 10, $N3 + print $I1 + print "\n" +.end +CODE +42 +OUTPUT + +pir_output_is(<< 'CODE', << 'OUTPUT', "mul_i_i_n"); +.loadlib "dan_ops" +.sub main :main + $I2 = 10 + $N3 = 4.2 + mul $I1, $I2, $N3 + print $I1 + print "\n" +.end +CODE +42 +OUTPUT + +pir_output_is(<< 'CODE', << 'OUTPUT', "mul pir syntax"); +.loadlib "dan_ops" +.sub main :main + $I2 = 10 + $N3 = 4.2 + $I1 = mul $I2, $N3 + print $I1 + print "\n" +.end +CODE +42 +OUTPUT + +pasm_output_is(<< 'CODE', << 'OUTPUT', "mul pasm syntax"); +.loadlib "dan_ops" + mul I0, 3, 3.9 + print I0 + print "\n" + end +CODE +11 +OUTPUT Index: t/dynoplibs/myops.t =================================================================== --- t/dynoplibs/myops.t (revision 14660) +++ t/dynoplibs/myops.t (working copy) @@ -1,181 +1,181 @@ -#! perl -# Copyright (C) 2006, The Perl Foundation. -# $Id$ - -use strict; -use warnings; -use lib qw( . lib ../lib ../../lib ); -use Test::More; -use Parrot::Test tests => 7; -use Parrot::Config; - - -=head1 NAME - -t/dynoplibs/myops.t - Test for the ops in src/dynoplibs/myops.ops - -=head1 SYNOPSIS - - % prove t/dynoplibs/myops.t - -=head1 DESCRIPTION - -Tests the sample dynamic op library "myops". - -=cut - -my $is_ms_win32 = $^O =~ m!MSWin32!; -my $is_mingw = $is_ms_win32 && grep { $PConfig{cc} eq $_ } qw(gcc gcc.exe); - -pir_output_is(<< 'CODE', << 'OUTPUT', "fortytwo"); -.loadlib "myops_ops" -.sub main :main - $I0 = fortytwo - print $I0 - print "\n" -.end -CODE -42 -OUTPUT - -pir_output_is(<< 'CODE', << 'OUTPUT', "what_do_you_get_if_you_multiply_six_by_nine"); -.loadlib "myops_ops" -.sub main :main - $S0 = what_do_you_get_if_you_multiply_six_by_nine - print $S0 - print "\n" -.end -CODE -fortytwo -OUTPUT - -pir_output_like(<< 'CODE', << 'OUTPUT', "hcf"); -.loadlib "myops_ops" -.sub main :main - print "neither here\n" - hcf - print "nor there\n" -.end -CODE -/neither here -(?!nor there)/ -OUTPUT - -{ - my $quine = <<'END_PASM'; -.loadlib "myops_ops" -q -END_PASM - pasm_output_is( $quine, $quine, 'a short cheating quine'); -} - -pir_output_is(<< 'CODE', << 'OUTPUT', "one alarm"); -.loadlib "myops_ops" - -.sub main :main - find_global P0, "_alarm" - alarm 2.0, P0 - set I0, 1 -loop: - sleep 1 - print I0 - print "\n" - inc I0 - # check_events - le I0, 3, loop - print "done.\n" -.end - -.sub _alarm - print "alarm\n" -.end -CODE -1 -alarm -2 -3 -done. -OUTPUT - -SKIP: { - skip "three alarms, infinite loop under mingw32", 1 if $is_mingw; - - pir_output_is(<< 'CODE', << 'OUTPUT', "three alarm"); - -.loadlib "myops_ops" -.sub main :main - find_global P0, "_alarm3" - alarm 3.3, 0.4, P0 - find_global P0, "_alarm2" - alarm 2.2, P0 - find_global P0, "_alarm1" - alarm 1.5, 2.0, P0 - set I0, 1 -loop: - sleep 1 - print I0 - print "\n" - inc I0 - # check_events - le I0, 5, loop - print "done.\n" -.end - -.sub _alarm1 - print "alarm1\n" -.end - -.sub _alarm2 - print "alarm2\n" -.end - -.sub _alarm3 - print "alarm3\n" -.end - -CODE -1 -alarm1 -2 -alarm2 -3 -alarm3 -alarm1 -alarm3 -4 -alarm3 -alarm3 -alarm3 -5 -done. -OUTPUT -} - -# bxand boolean op -pasm_output_is(<<'CODE', <<'OUTPUT', 'bxand - A AND B, but not BOTH'); -.loadlib "myops_ops" - - bxand I0, 0, 0 - bsr test - bxand I0, 0, 1 - bsr test - bxand I0, 1, 0 - bsr test - bxand I0, 1, 1 - bsr test - - branch end - test: - eq I0, 1, T - print "F\n" - ret - T:print "T\n" - ret - end: - end -CODE -F -F -F -F -OUTPUT +#! perl +# Copyright (C) 2006, The Perl Foundation. +# $Id$ + +use strict; +use warnings; +use lib qw( . lib ../lib ../../lib ); +use Test::More; +use Parrot::Test tests => 7; +use Parrot::Config; + + +=head1 NAME + +t/dynoplibs/myops.t - Test for the ops in src/dynoplibs/myops.ops + +=head1 SYNOPSIS + + % prove t/dynoplibs/myops.t + +=head1 DESCRIPTION + +Tests the sample dynamic op library "myops". + +=cut + +my $is_ms_win32 = $^O =~ m!MSWin32!; +my $is_mingw = $is_ms_win32 && grep { $PConfig{cc} eq $_ } qw(gcc gcc.exe); + +pir_output_is(<< 'CODE', << 'OUTPUT', "fortytwo"); +.loadlib "myops_ops" +.sub main :main + $I0 = fortytwo + print $I0 + print "\n" +.end +CODE +42 +OUTPUT + +pir_output_is(<< 'CODE', << 'OUTPUT', "what_do_you_get_if_you_multiply_six_by_nine"); +.loadlib "myops_ops" +.sub main :main + $S0 = what_do_you_get_if_you_multiply_six_by_nine + print $S0 + print "\n" +.end +CODE +fortytwo +OUTPUT + +pir_output_like(<< 'CODE', << 'OUTPUT', "hcf"); +.loadlib "myops_ops" +.sub main :main + print "neither here\n" + hcf + print "nor there\n" +.end +CODE +/neither here +(?!nor there)/ +OUTPUT + +{ + my $quine = <<'END_PASM'; +.loadlib "myops_ops" +q +END_PASM + pasm_output_is( $quine, $quine, 'a short cheating quine'); +} + +pir_output_is(<< 'CODE', << 'OUTPUT', "one alarm"); +.loadlib "myops_ops" + +.sub main :main + find_global P0, "_alarm" + alarm 2.0, P0 + set I0, 1 +loop: + sleep 1 + print I0 + print "\n" + inc I0 + # check_events + le I0, 3, loop + print "done.\n" +.end + +.sub _alarm + print "alarm\n" +.end +CODE +1 +alarm +2 +3 +done. +OUTPUT + +SKIP: { + skip "three alarms, infinite loop under mingw32", 1 if $is_mingw; + + pir_output_is(<< 'CODE', << 'OUTPUT', "three alarm"); + +.loadlib "myops_ops" +.sub main :main + find_global P0, "_alarm3" + alarm 3.3, 0.4, P0 + find_global P0, "_alarm2" + alarm 2.2, P0 + find_global P0, "_alarm1" + alarm 1.5, 2.0, P0 + set I0, 1 +loop: + sleep 1 + print I0 + print "\n" + inc I0 + # check_events + le I0, 5, loop + print "done.\n" +.end + +.sub _alarm1 + print "alarm1\n" +.end + +.sub _alarm2 + print "alarm2\n" +.end + +.sub _alarm3 + print "alarm3\n" +.end + +CODE +1 +alarm1 +2 +alarm2 +3 +alarm3 +alarm1 +alarm3 +4 +alarm3 +alarm3 +alarm3 +5 +done. +OUTPUT +} + +# bxand boolean op +pasm_output_is(<<'CODE', <<'OUTPUT', 'bxand - A AND B, but not BOTH'); +.loadlib "myops_ops" + + bxand I0, 0, 0 + bsr test + bxand I0, 0, 1 + bsr test + bxand I0, 1, 0 + bsr test + bxand I0, 1, 1 + bsr test + + branch end + test: + eq I0, 1, T + print "F\n" + ret + T:print "T\n" + ret + end: + end +CODE +F +F +F +F +OUTPUT Index: t/codingstd/code_coda.t =================================================================== --- t/codingstd/code_coda.t (revision 14660) +++ t/codingstd/code_coda.t (working copy) @@ -1,82 +1,82 @@ -#! perl -# Copyright (C) 2006, The Perl Foundation. -# $Id$ - -use strict; -use warnings; - -use lib qw( . lib ../lib ../../lib ); -use Test::More tests => 1; -use Parrot::Distribution; - - -=head1 NAME - -t/codingstd/code_coda.t - checks for editor hint coda in source - -=head1 SYNOPSIS - - # test all files - % prove t/codingstd/code_coda.t - - # test specific files - % perl t/codingstd/code_coda.t src/foo.c include/parrot/bar.h - -=head1 DESCRIPTION - -Checks that all source files have the proper editor hints coda, -as specified in PDD07. - -=head1 SEE ALSO - -L<docs/pdds/pdd07_codingstd.pod> - -=cut - - -my $DIST = Parrot::Distribution->new; -my @files = @ARGV ? @ARGV : source_files(); -my @comments; - -foreach my $file ( @files ) { - my $buf; - my $path = $file->path; - open(my $fh, '<', $path) - or die "Cannot open '$path' for reading: $!\n"; - { - local $/; - $buf = <$fh>; - } - push @comments => "$path\n" - unless $buf =~ m{\Q -/* - * Local variables: - * c-file-style: "parrot" - * End: - * vim: expandtab shiftwidth=4: - */\E - \n* \z - }x; -} - -ok(!scalar(@comments), 'C code coda') - or diag("C code coda missing in ".scalar @comments." files:[EMAIL PROTECTED]"); - - -exit; - - -sub source_files { - return ( - map($_->files_of_type('C code'), $DIST->c_source_file_directories), - map($_->files_of_type('C header'), $DIST->c_header_file_directories), - ); -} - -sub perl_files { - return ( - map($_->files_of_type('Perl code'), $DIST->perl_file_directories), - ); -} - -## vim: expandtab sw=4 +#! perl +# Copyright (C) 2006, The Perl Foundation. +# $Id$ + +use strict; +use warnings; + +use lib qw( . lib ../lib ../../lib ); +use Test::More tests => 1; +use Parrot::Distribution; + + +=head1 NAME + +t/codingstd/code_coda.t - checks for editor hint coda in source + +=head1 SYNOPSIS + + # test all files + % prove t/codingstd/code_coda.t + + # test specific files + % perl t/codingstd/code_coda.t src/foo.c include/parrot/bar.h + +=head1 DESCRIPTION + +Checks that all source files have the proper editor hints coda, +as specified in PDD07. + +=head1 SEE ALSO + +L<docs/pdds/pdd07_codingstd.pod> + +=cut + + +my $DIST = Parrot::Distribution->new; +my @files = @ARGV ? @ARGV : source_files(); +my @comments; + +foreach my $file ( @files ) { + my $buf; + my $path = $file->path; + open(my $fh, '<', $path) + or die "Cannot open '$path' for reading: $!\n"; + { + local $/; + $buf = <$fh>; + } + push @comments => "$path\n" + unless $buf =~ m{\Q +/* + * Local variables: + * c-file-style: "parrot" + * End: + * vim: expandtab shiftwidth=4: + */\E + \n* \z + }x; +} + +ok(!scalar(@comments), 'C code coda') + or diag("C code coda missing in ".scalar @comments." files:[EMAIL PROTECTED]"); + + +exit; + + +sub source_files { + return ( + map($_->files_of_type('C code'), $DIST->c_source_file_directories), + map($_->files_of_type('C header'), $DIST->c_header_file_directories), + ); +} + +sub perl_files { + return ( + map($_->files_of_type('Perl code'), $DIST->perl_file_directories), + ); +} + +## vim: expandtab sw=4