develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34014 - trunk/t/pmc

From:
kjs
Date:
December 17, 2008 02:37
Subject:
[svn:parrot] r34014 - trunk/t/pmc
Message ID:
20081217103731.C50C0CBA12@x12.develooper.com
Author: kjs
Date: Wed Dec 17 02:37:28 2008
New Revision: 34014

Modified:
   trunk/t/pmc/iterator.t

Log:
[t] Remove all tests with slicing syntax. This are 22 (this is half of the tests in the file!) tests from t/pmc/iterator.t.
+ the [a,b] variant will be removed
+ the [a..b] variant will be removed
+ the [..b] variant will be removed
+ the [a..] variant will be removed.
IMCC grammar updates follow later.


Modified: trunk/t/pmc/iterator.t
==============================================================================
--- trunk/t/pmc/iterator.t	(original)
+++ trunk/t/pmc/iterator.t	Wed Dec 17 02:37:28 2008
@@ -7,7 +7,7 @@
 use lib qw( . lib ../lib ../../lib );
 
 use Test::More;
-use Parrot::Test tests => 44;
+use Parrot::Test tests => 22;
 
 =head1 NAME
 
@@ -580,556 +580,7 @@
 OUTPUT
 }
 
-pasm_output_is( <<'CODE', <<'OUTPUT', "slice syntax" );
-   new P0, 'ResizablePMCArray'
-   slice P2, P0[2 .. 3, 4, 5 ..6]
-   slice P2, P0[10 ..]
-   slice P2, P0[.. 11]
-   slice P2, P0[I1..3]
-   new P1, 'Hash'
-   slice P2, P1["0","a".."b","c"]
-   print "ok\n"
-   end
-CODE
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<'OUTPUT', "slice creates an iterator" );
-   new P0, 'ResizablePMCArray'
-   slice P2, P0[2 .. 3, 4, 5 ..6]
-   typeof S0, P2
-   print S0
-   print "\n"
-   end
-CODE
-Iterator
-OUTPUT
-
-pasm_output_is( <<'CODE', <<'OUTPUT', "slice iter simple array elements" );
-   .include "iterator.pasm"
-   new P0, 'ResizablePMCArray'
-   push P0, 100
-   push P0, 200
-   push P0, 300
-   push P0, 400
-   push P0, 500
-   push P0, 600
-   slice P2, P0[0, 1, 4]
-   set P2, .ITERATE_FROM_START
-lp:
-   unless P2, ex
-   shift I0, P2
-   print I0
-   print "\n"
-   branch lp
-ex:
-   print "ok\n"
-   end
-CODE
-100
-200
-500
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<'OUTPUT', "slice iter simple array elements - repeat" );
-   .include "iterator.pasm"
-   new P0, 'ResizablePMCArray'
-   push P0, 100
-   push P0, 200
-   push P0, 300
-   push P0, 400
-   push P0, 500
-   slice P2, P0[2, 4]
-   set P2, .ITERATE_FROM_START
-lp:
-   unless P2, ex
-   shift I0, P2
-   print I0
-   print "\n"
-   branch lp
-ex:
-
-   slice P2, P0[2, 4]        # this is the same PF constant
-   set P2, .ITERATE_FROM_START
-lp2:
-   unless P2, ex2
-   shift I0, P2
-   print I0
-   print "\n"
-   branch lp2
-ex2:
-   print "ok\n"
-   end
-CODE
-300
-500
-300
-500
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<OUTPUT, "slice iter string" );
-    .include "iterator.pasm"
-    new P2, 'String'
-    set P2, "parrot"
-    slice P1, P2[0,1,4,5]
-    set P1, .ITERATE_FROM_START
-iter_loop:
-        unless P1, iter_end        # while (entries) ...
-    shift S1, P1
-    print S1
-    branch iter_loop
-iter_end:
-    print "\n"
-    print P2
-    print "\n"
-    end
-CODE
-paot
-parrot
-OUTPUT
-
-pasm_output_is( <<'CODE', <<'OUTPUT', "slice iter start range" );
-   .include "iterator.pasm"
-   new P0, 'ResizablePMCArray'
-   push P0, 100
-   push P0, 200
-   push P0, 300
-   push P0, 400
-   push P0, 500
-   slice P2, P0[..2]
-   set P2, .ITERATE_FROM_START
-lp:
-   unless P2, ex
-   shift I0, P2
-   print I0
-   print "\n"
-   branch lp
-ex:
-   print "ok\n"
-   end
-CODE
-100
-200
-300
-ok
-OUTPUT
 
-pasm_output_is( <<'CODE', <<'OUTPUT', "slice iter end range" );
-   .include "iterator.pasm"
-   new P0, 'ResizablePMCArray'
-   push P0, 100
-   push P0, 200
-   push P0, 300
-   push P0, 400
-   push P0, 500
-   slice P2, P0[2 ..]
-   set P2, .ITERATE_FROM_START
-lp:
-   unless P2, ex
-   shift I0, P2
-   print I0
-   print "\n"
-   branch lp
-ex:
-   print "ok\n"
-   end
-CODE
-300
-400
-500
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<'OUTPUT', "slice iter start range, value" );
-   .include "iterator.pasm"
-   new P0, 'ResizablePMCArray'
-   push P0, 100
-   push P0, 200
-   push P0, 300
-   push P0, 400
-   push P0, 500
-   push P0, 600
-   slice P2, P0[..2, 4]
-   set P2, .ITERATE_FROM_START
-lp:
-   unless P2, ex
-   shift I0, P2
-   print I0
-   print "\n"
-   branch lp
-ex:
-   print "ok\n"
-   end
-CODE
-100
-200
-300
-500
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<'OUTPUT', "slice iter range, value" );
-   .include "iterator.pasm"
-   new P0, 'ResizablePMCArray'
-   push P0, 100
-   push P0, 200
-   push P0, 300
-   push P0, 400
-   push P0, 500
-   push P0, 600
-   push P0, 700
-   slice P2, P0[1 ..3,6]
-   set P2, .ITERATE_FROM_START
-lp:
-   unless P2, ex
-   shift I0, P2
-   print I0
-   print "\n"
-   branch lp
-ex:
-   print "ok\n"
-   end
-CODE
-200
-300
-400
-700
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<'OUTPUT', "slice iter range, range" );
-   .include "iterator.pasm"
-   new P0, 'ResizablePMCArray'
-   push P0, 100
-   push P0, 200
-   push P0, 300
-   push P0, 400
-   push P0, 500
-   push P0, 600
-   push P0, 700
-   push P0, 800
-   slice P2, P0[1 ..3, 5 ..]
-   set P2, .ITERATE_FROM_START
-lp:
-   unless P2, ex
-   shift I0, P2
-   print I0
-   print "\n"
-   branch lp
-ex:
-   print "ok\n"
-   end
-CODE
-200
-300
-400
-600
-700
-800
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<OUTPUT, "slice iter string range" );
-    .include "iterator.pasm"
-    new P2, 'String'
-    set P2, "parrot rocks"
-    slice P1, P2[1 ..3 ,5, 8 ..9]
-    set P1, .ITERATE_FROM_START
-iter_loop:
-        unless P1, iter_end
-    shift S1, P1
-    print S1
-    branch iter_loop
-iter_end:
-    print "\n"
-    print P2
-    print "\n"
-    end
-CODE
-arrtoc
-parrot rocks
-OUTPUT
-
-pasm_output_is( <<'CODE', <<OUTPUT, "slice iter string range 2" );
-    .include "iterator.pasm"
-    new P2, 'String'
-    set P2, "parrot rocks"
-    slice P1, P2[ ..3 ,5, 8 ..]
-    set P1, .ITERATE_FROM_START
-iter_loop:
-        unless P1, iter_end
-    shift S1, P1
-    print S1
-    branch iter_loop
-iter_end:
-    print "\n"
-    print P2
-    print "\n"
-    end
-CODE
-parrtocks
-parrot rocks
-OUTPUT
-
-pasm_output_is( <<'CODE', <<OUTPUT, "slice iter string variable range" );
-    .include "iterator.pasm"
-    new P2, 'String'
-    set P2, "parrot rocks"
-    set I0, 1
-    set I1, 3
-    set I2, 8
-    set I3, 9
-    slice P1, P2[I0 ..I1 ,5, I2 ..I3]
-    set P1, .ITERATE_FROM_START
-iter_loop:
-        unless P1, iter_end
-    shift S1, P1
-    print S1
-    branch iter_loop
-iter_end:
-    print "\n"
-    print P2
-    print "\n"
-    end
-CODE
-arrtoc
-parrot rocks
-OUTPUT
-
-pasm_output_is( <<'CODE', <<OUTPUT, "slice iter hash values" );
-    .include "iterator.pasm"
-    new P2, 'Hash'
-    set P2["a"], 100
-    set P2["b"], 200
-    set P2["c"], 300
-    set P2["d"], 400
-    slice P1, P2["b", "c"]
-    set P1, .ITERATE_FROM_START
-iter_loop:
-        unless P1, iter_end
-    shift S1, P1
-    print S1
-    print "\n"
-    branch iter_loop
-iter_end:
-    print "ok\n"
-    end
-CODE
-200
-300
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<OUTPUT, "slice iter hash values 2" );
-    .include "iterator.pasm"
-    new P2, 'Hash'
-    set P2["a"], 100
-    set P2["b"], 200
-    set P2["c"], 300
-    set P2["d"], 400
-    set P2["e"], 500
-    slice P1, P2["b", "c", "a", "a", "e"]
-    set P1, .ITERATE_FROM_START
-iter_loop:
-        unless P1, iter_end
-    shift S1, P1
-    print S1
-    print "\n"
-    branch iter_loop
-iter_end:
-    print "ok\n"
-    end
-CODE
-200
-300
-100
-100
-500
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<OUTPUT, "slice iter range" );
-    .include "iterator.pasm"
-    new P2, 'Hash'
-    set P2["a"], 10
-    set P2["b"], 20
-    set P2["c"], 30
-    set P2["d"], 40
-    set P2["e"], 50
-    slice P1, P2["a".. "c"]
-    set P1, .ITERATE_FROM_START
-iter_loop:
-        unless P1, iter_end
-    shift S1, P1
-    print S1
-    print "\n"
-    branch iter_loop
-iter_end:
-    print "ok\n"
-    end
-CODE
-10
-20
-30
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<OUTPUT, "slice iter range 2" );
-    .include "iterator.pasm"
-    new P2, 'Hash'
-    set P2["a"], 10
-    set P2["b"], 20
-    set P2["c"], 30
-    set P2["d"], 40
-    set P2["e"], 50
-    set P2["A"], 11
-    set P2["B"], 21
-    set P2["C"], 31
-    set P2["D"], 41
-    set P2["E"], 51
-    slice P1, P2["a".. "c", 'C' .. 'E']
-    set P1, .ITERATE_FROM_START
-iter_loop:
-        unless P1, iter_end
-    shift S1, P1
-    print S1
-    print "\n"
-    branch iter_loop
-iter_end:
-    print "ok\n"
-    end
-CODE
-10
-20
-30
-31
-41
-51
-ok
-OUTPUT
-
-pasm_output_is( <<'CODE', <<OUTPUT, "slice iter range - vars" );
-    .include "iterator.pasm"
-    new P2, 'Hash'
-    set P2["a"], 10
-    set P2["b"], 20
-    set P2["c"], 30
-    set P2["d"], 40
-    set P2["e"], 50
-    set P2["A"], 11
-    set P2["B"], 21
-    set P2["C"], 31
-    set P2["D"], 41
-    set P2["E"], 51
-    set S0, 'a'
-    set S1, 'c'
-    set S2, 'C'
-    set S3, 'E'
-    slice P1, P2[S0 .. S1, S2 .. S3, 'A']
-    set P1, .ITERATE_FROM_START
-iter_loop:
-        unless P1, iter_end
-    shift S10, P1
-    print S10
-    print "\n"
-    branch iter_loop
-iter_end:
-    print "ok\n"
-    end
-CODE
-10
-20
-30
-31
-41
-51
-11
-ok
-OUTPUT
-
-pir_output_is( <<'CODE', <<'OUTPUT', "xrange iterator" );
-
-.sub main
-    .include "iterator.pasm"
-        # xrange(10, 14)
-    new $P2, 'Slice' [10 .. 14]
-    new $P1, 'Iterator',  $P2
-
-    set $P1, .ITERATE_FROM_START
-#    I0 = P1."len"()
-iter_loop:
-        unless $P1, iter_end
-    shift $I1, $P1
-    print $I1
-    print "\n"
-    branch iter_loop
-iter_end:
-    print "ok\n"
-    end
-.end
-CODE
-10
-11
-12
-13
-ok
-OUTPUT
-
-pir_output_is( <<'CODE', <<'OUTPUT', "xrange iterator ..n" );
-
-.sub main
-    .include "iterator.pasm"
-        # xrange(4)
-    new $P2, 'Slice' [ .. 4]
-    new $P1, 'Iterator',  $P2
-
-    set $P1, .ITERATE_FROM_START
-#    I0 = P1."len"()
-iter_loop:
-        unless $P1, iter_end
-    shift $I1, $P1
-    print $I1
-    print "\n"
-    branch iter_loop
-iter_end:
-    print "ok\n"
-    end
-.end
-CODE
-0
-1
-2
-3
-ok
-OUTPUT
-
-pir_output_is( <<'CODE', <<'OUTPUT', "slice, get strings from array" );
-
-.sub main :main
-    .include "iterator.pasm"
-    .local pmc ar
-    ar = new 'ResizablePMCArray'
-    push ar, "a"
-    push ar, "b"
-    push ar, "c"
-    push ar, "d"
-    push ar, "e"
-    .local pmc iter
-    iter = slice ar[1 ..]
-    iter = .ITERATE_FROM_START
-iter_loop:
-    unless iter, iter_end        # while (entries) ...
-    $S0 = shift iter
-    print $S0
-    goto iter_loop
-iter_end:
-    print "ok\n"
-.end
-CODE
-bcdeok
-OUTPUT
 
 pasm_output_is( <<'CODE', <<'OUTPUT', "iter vtable" );
    .include "iterator.pasm"
@@ -1221,31 +672,7 @@
 ok 2
 OUTPUT
 
-pir_output_is( <<'CODE', <<'OUTPUT', 'xrange iterator, get_iter' );
 
-.sub main
-    .include "iterator.pasm"
-        # xrange(10, 14)
-    new $P2, 'Slice' [10 .. 14]
-    $P1 = iter  $P2
-#    I0 = P1."len"()
-iter_loop:
-        unless $P1, iter_end
-    shift $I1, $P1
-    print $I1
-    print "\n"
-    branch iter_loop
-iter_end:
-    print "ok\n"
-    end
-.end
-CODE
-10
-11
-12
-13
-ok
-OUTPUT
 
 TODO: {
     local $TODO = "adding keys during iteration";



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About