Permalink
Browse files

CC: add tests 107* for possible edge cases of loop unrolling

  • Loading branch information...
1 parent d8f3d09 commit 988937ad7f5b277adb751cd97dcb71768078d97b @wbraswell wbraswell committed Nov 27, 2012
Showing with 20 additions and 3 deletions.
  1. +20 −3 t/testc.sh
View
@@ -472,12 +472,29 @@ result[104]='12'
#tests[105]='$int::dummy=0;$double::dummy=0;my int $r;my $i:int=2;our double $d=3.0; $r=$i*$i; $r*=$d; print $r;'
tests[105]='%int::;%double::;my int $r;my $i_i=2;our double $d=3.0; $r=$i*$i; $r*=$d; print $r;'
result[105]='12'
+# loop unrolling, normal cases
tests[106]='my @a=(0..20);for my $i (1..10){$a[$i]++;};print @a;'
-result[106]='023456789101111121314151617181920';
+result[106]='023456789101111121314151617181920'
tests[1061]='my @a=(0..20);BEGIN{my $s=q(sub test{);for my $i (1..10){$s.=qq(\$a[$i]++;)};$s.=q(});eval $s;} test(); print @a;'
-result[1061]='023456789101111121314151617181920';
+result[1061]='023456789101111121314151617181920'
tests[1062]='my @a=(0..20);for (my $i=1;$i<10;$i++){$a[$i]++};print @a;'
-result[1062]='023456789101111121314151617181920';
+result[1062]='023456789101111121314151617181920'
+# loop unrolling, possible edge cases
+tests[107]='my @a=(0..310);for my $i (1..300){$a[$i]++;};print @a;'
+result[107]='023456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301301302303304305306307308309310';
+tests[1071]='my @a=(0..20);for my $i (1..10){$a[$i]++; last if ($i == 5);};print @a;'
+result[1071]='02345667891011121314151617181920'
+tests[1072]='my @a=(0..20);for my $i (1..10){next if ($i > 5); $a[$i]++;};print @a;'
+result[1072]='02345667891011121314151617181920'
+tests[1073]='my @a=(0..20);for my $i (1..10){eval("\$a[$i]++;")};print @a;'
+result[1073]='023456789101111121314151617181920'
+tests[1074]='my @a=(0..20);for my $i (1..10){$a[$i]++; goto MYLABEL if ($i == 5);}; MYLABEL: $i++; print @a;'
+result[1074]='02345667891011121314151617181920'
+# TODO test 1075, make it relink
+tests[1075]='my $x=0; my @a=(0,0,0,0,0,0); for my $_ (0..5){if ($x%2){$a[$_]++}; print $x,$_; $x++;};print @a;'
+result[1075]='001122334455010101'
+tests[1079]='my @a=(0..10); my $j = 15; for my $i (0..10){$a[$i] += $j; $j++; print $i, $j;};print @a;'
+result[1079]='01611721831942052162272382492510261517192123252729313335'
# issue35
tests[110]='sub new{}sub test{{my $x=1;my $y=$x+1;}my $x=2;if($x!=3){4;}}'

0 comments on commit 988937a

Please sign in to comment.