From f5768c09019b303e82b7b7905b137b0e1df3823c Mon Sep 17 00:00:00 2001 From: murphy Date: Sun, 15 Oct 2006 15:10:04 +0000 Subject: Moved scanner tests into test/scanners. --- test/c/empty.in.c | 0 test/c/empty.out.raydebug | 0 test/c/error.in.c | 1 - test/c/error.out.raydebug | 1 - test/c/error2.in.c | 1 - test/c/error2.out.raydebug | 1 - test/c/open-string.in.c | 1 - test/c/open-string.out.raydebug | 1 - test/c/strange.in.c | 90 ----------------------------------------- test/c/strange.out.raydebug | 90 ----------------------------------------- test/c/suite.rb | 2 - 11 files changed, 188 deletions(-) delete mode 100644 test/c/empty.in.c delete mode 100644 test/c/empty.out.raydebug delete mode 100644 test/c/error.in.c delete mode 100644 test/c/error.out.raydebug delete mode 100644 test/c/error2.in.c delete mode 100644 test/c/error2.out.raydebug delete mode 100644 test/c/open-string.in.c delete mode 100644 test/c/open-string.out.raydebug delete mode 100644 test/c/strange.in.c delete mode 100644 test/c/strange.out.raydebug delete mode 100644 test/c/suite.rb (limited to 'test/c') diff --git a/test/c/empty.in.c b/test/c/empty.in.c deleted file mode 100644 index e69de29..0000000 diff --git a/test/c/empty.out.raydebug b/test/c/empty.out.raydebug deleted file mode 100644 index e69de29..0000000 diff --git a/test/c/error.in.c b/test/c/error.in.c deleted file mode 100644 index 9cad53e..0000000 --- a/test/c/error.in.c +++ /dev/null @@ -1 +0,0 @@ -\\ diff --git a/test/c/error.out.raydebug b/test/c/error.out.raydebug deleted file mode 100644 index a52becb..0000000 --- a/test/c/error.out.raydebug +++ /dev/null @@ -1 +0,0 @@ -error(\\)\ diff --git a/test/c/error2.in.c b/test/c/error2.in.c deleted file mode 100644 index 1910281..0000000 --- a/test/c/error2.in.c +++ /dev/null @@ -1 +0,0 @@ -foo \ No newline at end of file diff --git a/test/c/error2.out.raydebug b/test/c/error2.out.raydebug deleted file mode 100644 index ccd2125..0000000 --- a/test/c/error2.out.raydebug +++ /dev/null @@ -1 +0,0 @@ -ident(foo) \ No newline at end of file diff --git a/test/c/open-string.in.c b/test/c/open-string.in.c deleted file mode 100644 index 9d68933..0000000 --- a/test/c/open-string.in.c +++ /dev/null @@ -1 +0,0 @@ -" \ No newline at end of file diff --git a/test/c/open-string.out.raydebug b/test/c/open-string.out.raydebug deleted file mode 100644 index a6afd22..0000000 --- a/test/c/open-string.out.raydebug +++ /dev/null @@ -1 +0,0 @@ -string \ No newline at end of file diff --git a/test/c/strange.in.c b/test/c/strange.in.c deleted file mode 100644 index 42f339d..0000000 --- a/test/c/strange.in.c +++ /dev/null @@ -1,90 +0,0 @@ -#include "ruby.h" /* - /sLaSh * - oBfUsCaTeD RuBy * - cOpYrIgHt 2005 * -bY SiMoN StRaNdGaArD * - #{X=320;Y=200;Z=20} */ - -#define GUN1 42: -#define GUN2 43: -#define bo do -#define when(gun) /**/ -#define DATA "p 'Hello embedded world'" -#define DIRTY(argc,argv)\ -argc,argv,char=eval(\ -"#{DATA.read}\n[3,2,1]"\ -);sun=O.new\ -if(0) - -int -sun[]={12,9,16,9,2,1,7,1,3,9,27,4, 13,2,11,5,4,1,25, -5,0,1,14,9,15,4,26,9,23,2,17,6,31, 6,10,8,22,9,21,1, -24,8,20,8,18,9,29,5,9,5,1,1,28,8,8,1,30, 9,6,8, 5,1, -19,9,36,19,43, 9,34,11,50,19,48,18,49,9, 35,8,42,18, -51,8,44,11,32, 11,47,9,37,1,39,9,38,19, 45,8,40,12, -41,9,46,12,33,1,57,1,85,5,88,28,83,4,87, 6,62,28,89, -9,80,28,60,21,52,21,72,29,54,21,75,8,70,29,58,28,65, -9,91,8,74,29,79,2,77,1,53,1,81,5, 69,2,64,21, 86,29, -67,9,59,1,61,5,73,6,76,28,56,21,68,29,78,29,63,5,66, -28,90,29, 71,4,55,9,84,28,82,29,101,5, 103,9, 98,35, -97,1,94,35,93,1,100,35,92,31,99,5,96,39,95,5,102,35}; - -void run(int gun=0) { // [gun]=[:GUN1,:GUN2] - printf("run() %i\n", gun); - switch(gun) { - case GUN1 when(2) - printf("when2\n"); - break; // end - case GUN2 when(3) - printf("when3\n"); - break; // end - } -} - -int main(int argc, char** argv) { - printf("hello world. number of arguments=%i\n", argc); - int fun=5; - bo { - fun -= 1; //.id - gun = fun - run(fun); - } while(fun>0); - ruby_init(); - rb_eval_string(DATA); - return 0; -} - -# if 0 // nobody reads un-defined code -def goto*s;$s=[];Y.times{s=[];X.times{s<<[0]*3};$s<< s}end;A=0.5 -include Math;def u g,h,i,j,k,l;f,*m=((j-h).abs>(k-i).abs)?[proc{ -|n,o| g[o] [n ]=l },[h ,i ],[j,k]]:[proc{ -|p,q| g[ p][ q] =l} ,[ i,h ], [k,j]];b,a=m.sort -c,d=a [1 ]-b [1 ],a [0 ]-b [0 ];d.times{|e|f. -call( e+b[ 0] ,c* e/d+b [1])};end;V=0;def bo&u -$u||= V; ;$u += 1+V ;; return u.call if$u>1;q=128.0 -;x=(V .. 255 ). map {| y|f1,z =sin(y.to_f*PI/q), -sin(( y. to_f + 200 )*PI/( q));[(f1*30.0+110.0). -to_i,((f1+z)*10.0+40.0).to_i,(z*20.0+120.0).to_i]};Y.times{|i|X. -times{|j|i1=((i*0.3+150)*(j*1.1+50)/50.0).to_i;i2=((i*0.8+510)*( -j*0.9+1060)/51.0).to_i;$s[i][j]=x[(i1*i2)%255].clone}};$a=(0..25). -inject([]){|a,i|a<<(V..3).inject([]){|r,j|r<<$c[i*4+j]}};u.call;end -I=LocalJumpError;def run*a,&b;return if a.size==V;if a[V]==666;$b=b -elsif$b;$b.call;end;end;def main s,&u;$m=V;u.call rescue I;end -def rb_eval_string(*a);end # you promised not to look here -def ruby_init;q=2.0;l=((X**q)*A+(Y**q)*A)**A;V.upto(Y-4){|s|V. -upto(X-4){|q|d=((q-X/A)**q+(s-Y/A)**q)**A;e=(cos(d*PI/(l/q))/q -+A)*3.0+1.0;v=2;f=v/e;a,p,b=$s[s],$s[s+1],$s[s+v];r=a[q][V]*e+ -p[q][V]+a[q+1][V]+b[q][V]+a[q+v][V]+b[q+v/v][V]+p[q+v][V]+b[q+ -v][V]*f;g=[a[q][V],b[q][V],a[q+v][V],b[q+v][V]];h=(g.max-g.min -)*f;$s[s][q][V]=[[(r/(e+f+6.0)+A+(h*0.4)).to_i,255].min,V].max -}};File.open("res.ppm","w+"){|f|f.write(# secret.greetings :-) -"P3\n# res.ppm\n#{X} #{Y}\n255\n"+$s.map{|a|a.map{|b|b.join' ' -}.join(' ')+"\n"}.join)};end;def switch i,&b;b.call;return unless -defined?($m);b=(X*0.01).to_i;d=1.0/40.0;e=0.09;c=(Y*0.01).to_i -a=$a.map{|(f,g,h,j)|[f*d,g*e,h*d,j*e]};a.each{|(k,l,m,n)|u($s,(k*X -).to_i+b+i,(l*Y).to_i+c+i,(m*X).to_i+b+i,(n*Y).to_i+c+i,[Z]*3)} -a.each{|(o,q,r,s)|u($s,(o*(X-Z)).to_i+i,(q*(Y-Z)).to_i+i,(r*(X- -Z)).to_i+i,(s*(Y-Z)).to_i+i,[(1<<8)-1]*3)};end;Q=Object;class -Regexp;def []=(v,is);is.each{|s|Q.send(:remove_const,s)if Q. -const_defined? s;Q.const_set(s,v)};end;end;def int*ptr;666 -end;class O;def []=(a,b=nil);$c=a;end;end;alias:void:goto -#endif // pretend as if you havn't seen anything diff --git a/test/c/strange.out.raydebug b/test/c/strange.out.raydebug deleted file mode 100644 index 8979a50..0000000 --- a/test/c/strange.out.raydebug +++ /dev/null @@ -1,90 +0,0 @@ -preprocessor(#include) include("ruby.h") comment(/* - /sLaSh * - oBfUsCaTeD RuBy * - cOpYrIgHt 2005 * -bY SiMoN StRaNdGaArD * - #{X=320;Y=200;Z=20} */) - -preprocessor(#define) ident(GUN1) integer(42)operator(:) -preprocessor(#define) ident(GUN2) integer(43)operator(:) -preprocessor(#define) ident(bo) reserved(do) -preprocessor(#define) ident(when)operator(()ident(gun)operator(\)) comment(/**/) -preprocessor(#define) ident(DATA) string -preprocessor(#define) ident(DIRTY)operator(()ident(argc)operator(,)ident(argv)operator(\))\ -ident(argc)operator(,)ident(argv)operator(,)pre_type(char)operator(=)ident(eval)operator(()\ -string\ -operator(\);)ident(sun)operator(=)ident(O)operator(.)ident(new)\ -reserved(if)operator(()integer(0)operator(\)) - -pre_type(int) -ident(sun)operator([]={)integer(12)operator(,)integer(9)operator(,)integer(16)operator(,)integer(9)operator(,)integer(2)operator(,)integer(1)operator(,)integer(7)operator(,)integer(1)operator(,)integer(3)operator(,)integer(9)operator(,)integer(27)operator(,)integer(4)operator(,) integer(13)operator(,)integer(2)operator(,)integer(11)operator(,)integer(5)operator(,)integer(4)operator(,)integer(1)operator(,)integer(25)operator(,) -integer(5)operator(,)integer(0)operator(,)integer(1)operator(,)integer(14)operator(,)integer(9)operator(,)integer(15)operator(,)integer(4)operator(,)integer(26)operator(,)integer(9)operator(,)integer(23)operator(,)integer(2)operator(,)integer(17)operator(,)integer(6)operator(,)integer(31)operator(,) integer(6)operator(,)integer(10)operator(,)integer(8)operator(,)integer(22)operator(,)integer(9)operator(,)integer(21)operator(,)integer(1)operator(,) -integer(24)operator(,)integer(8)operator(,)integer(20)operator(,)integer(8)operator(,)integer(18)operator(,)integer(9)operator(,)integer(29)operator(,)integer(5)operator(,)integer(9)operator(,)integer(5)operator(,)integer(1)operator(,)integer(1)operator(,)integer(28)operator(,)integer(8)operator(,)integer(8)operator(,)integer(1)operator(,)integer(30)operator(,) integer(9)operator(,)integer(6)operator(,)integer(8)operator(,) integer(5)operator(,)integer(1)operator(,) -integer(19)operator(,)integer(9)operator(,)integer(36)operator(,)integer(19)operator(,)integer(43)operator(,) integer(9)operator(,)integer(34)operator(,)integer(11)operator(,)integer(50)operator(,)integer(19)operator(,)integer(48)operator(,)integer(18)operator(,)integer(49)operator(,)integer(9)operator(,) integer(35)operator(,)integer(8)operator(,)integer(42)operator(,)integer(18)operator(,) -integer(51)operator(,)integer(8)operator(,)integer(44)operator(,)integer(11)operator(,)integer(32)operator(,) integer(11)operator(,)integer(47)operator(,)integer(9)operator(,)integer(37)operator(,)integer(1)operator(,)integer(39)operator(,)integer(9)operator(,)integer(38)operator(,)integer(19)operator(,) integer(45)operator(,)integer(8)operator(,)integer(40)operator(,)integer(12)operator(,) -integer(41)operator(,)integer(9)operator(,)integer(46)operator(,)integer(12)operator(,)integer(33)operator(,)integer(1)operator(,)integer(57)operator(,)integer(1)operator(,)integer(85)operator(,)integer(5)operator(,)integer(88)operator(,)integer(28)operator(,)integer(83)operator(,)integer(4)operator(,)integer(87)operator(,) integer(6)operator(,)integer(62)operator(,)integer(28)operator(,)integer(89)operator(,) -integer(9)operator(,)integer(80)operator(,)integer(28)operator(,)integer(60)operator(,)integer(21)operator(,)integer(52)operator(,)integer(21)operator(,)integer(72)operator(,)integer(29)operator(,)integer(54)operator(,)integer(21)operator(,)integer(75)operator(,)integer(8)operator(,)integer(70)operator(,)integer(29)operator(,)integer(58)operator(,)integer(28)operator(,)integer(65)operator(,) -integer(9)operator(,)integer(91)operator(,)integer(8)operator(,)integer(74)operator(,)integer(29)operator(,)integer(79)operator(,)integer(2)operator(,)integer(77)operator(,)integer(1)operator(,)integer(53)operator(,)integer(1)operator(,)integer(81)operator(,)integer(5)operator(,) integer(69)operator(,)integer(2)operator(,)integer(64)operator(,)integer(21)operator(,) integer(86)operator(,)integer(29)operator(,) -integer(67)operator(,)integer(9)operator(,)integer(59)operator(,)integer(1)operator(,)integer(61)operator(,)integer(5)operator(,)integer(73)operator(,)integer(6)operator(,)integer(76)operator(,)integer(28)operator(,)integer(56)operator(,)integer(21)operator(,)integer(68)operator(,)integer(29)operator(,)integer(78)operator(,)integer(29)operator(,)integer(63)operator(,)integer(5)operator(,)integer(66)operator(,) -integer(28)operator(,)integer(90)operator(,)integer(29)operator(,) integer(71)operator(,)integer(4)operator(,)integer(55)operator(,)integer(9)operator(,)integer(84)operator(,)integer(28)operator(,)integer(82)operator(,)integer(29)operator(,)integer(101)operator(,)integer(5)operator(,) integer(103)operator(,)integer(9)operator(,) integer(98)operator(,)integer(35)operator(,) -integer(97)operator(,)integer(1)operator(,)integer(94)operator(,)integer(35)operator(,)integer(93)operator(,)integer(1)operator(,)integer(100)operator(,)integer(35)operator(,)integer(92)operator(,)integer(31)operator(,)integer(99)operator(,)integer(5)operator(,)integer(96)operator(,)integer(39)operator(,)integer(95)operator(,)integer(5)operator(,)integer(102)operator(,)integer(35)operator(};) - -pre_type(void) ident(run)operator(()pre_type(int) ident(gun)operator(=)integer(0)operator(\)) operator({) comment(// [gun]=[:GUN1,:GUN2]) - ident(printf)operator(()stringoperator(,) ident(gun)operator(\);) - reserved(switch)operator(()ident(gun)operator(\)) operator({) - reserved(case) ident(GUN1) ident(when)operator(()integer(2)operator(\)) - ident(printf)operator(()stringoperator(\);) - reserved(break)operator(;) comment(// end) - reserved(case) ident(GUN2) ident(when)operator(()integer(3)operator(\)) - ident(printf)operator(()stringoperator(\);) - reserved(break)operator(;) comment(// end) - operator(}) -operator(}) - -pre_type(int) ident(main)operator(()pre_type(int) ident(argc)operator(,) pre_type(char)operator(**) ident(argv)operator(\)) operator({) - ident(printf)operator(()stringoperator(,) ident(argc)operator(\);) - pre_type(int) ident(fun)operator(=)integer(5)operator(;) - ident(bo) operator({) - ident(fun) operator(-=) integer(1)operator(;) comment(//.id - gun = fun) - ident(run)operator(()ident(fun)operator(\);) - operator(}) reserved(while)operator(()ident(fun)operator(>)integer(0)operator(\);) - ident(ruby_init)operator((\);) - ident(rb_eval_string)operator(()ident(DATA)operator(\);) - reserved(return) integer(0)operator(;) -operator(}) - -comment(# if 0 // nobody reads un-defined code -def goto*s;$s=[];Y.times{s=[];X.times{s<<[0]*3};$s<< s}end;A=0.5 -include Math;def u g,h,i,j,k,l;f,*m=((j-h\).abs>(k-i\).abs\)?[proc{ -|n,o| g[o] [n ]=l },[h ,i ],[j,k]]:[proc{ -|p,q| g[ p][ q] =l} ,[ i,h ], [k,j]];b,a=m.sort -c,d=a [1 ]-b [1 ],a [0 ]-b [0 ];d.times{|e|f. -call( e+b[ 0] ,c* e/d+b [1]\)};end;V=0;def bo&u -$u||= V; ;$u += 1+V ;; return u.call if$u>1;q=128.0 -;x=(V .. 255 \). map {| y|f1,z =sin(y.to_f*PI/q\), -sin(( y. to_f + 200 \)*PI/( q\)\);[(f1*30.0+110.0\). -to_i,((f1+z\)*10.0+40.0\).to_i,(z*20.0+120.0\).to_i]};Y.times{|i|X. -times{|j|i1=((i*0.3+150\)*(j*1.1+50\)/50.0\).to_i;i2=((i*0.8+510\)*( -j*0.9+1060\)/51.0\).to_i;$s[i][j]=x[(i1*i2\)%255].clone}};$a=(0..25\). -inject([]\){|a,i|a<<(V..3\).inject([]\){|r,j|r<<$c[i*4+j]}};u.call;end -I=LocalJumpError;def run*a,&b;return if a.size==V;if a[V]==666;$b=b -elsif$b;$b.call;end;end;def main s,&u;$m=V;u.call rescue I;end -def rb_eval_string(*a\);end # you promised not to look here -def ruby_init;q=2.0;l=((X**q\)*A+(Y**q\)*A\)**A;V.upto(Y-4\){|s|V. -upto(X-4\){|q|d=((q-X/A\)**q+(s-Y/A\)**q\)**A;e=(cos(d*PI/(l/q\)\)/q -+A\)*3.0+1.0;v=2;f=v/e;a,p,b=$s[s],$s[s+1],$s[s+v];r=a[q][V]*e+ -p[q][V]+a[q+1][V]+b[q][V]+a[q+v][V]+b[q+v/v][V]+p[q+v][V]+b[q+ -v][V]*f;g=[a[q][V],b[q][V],a[q+v][V],b[q+v][V]];h=(g.max-g.min -\)*f;$s[s][q][V]=[[(r/(e+f+6.0\)+A+(h*0.4\)\).to_i,255].min,V].max -}};File.open("res.ppm","w+"\){|f|f.write(# secret.greetings :-\) -"P3\\n# res.ppm\\n#{X} #{Y}\\n255\\n"+$s.map{|a|a.map{|b|b.join' ' -}.join(' '\)+"\\n"}.join\)};end;def switch i,&b;b.call;return unless -defined?($m\);b=(X*0.01\).to_i;d=1.0/40.0;e=0.09;c=(Y*0.01\).to_i -a=$a.map{|(f,g,h,j\)|[f*d,g*e,h*d,j*e]};a.each{|(k,l,m,n\)|u($s,(k*X -\).to_i+b+i,(l*Y\).to_i+c+i,(m*X\).to_i+b+i,(n*Y\).to_i+c+i,[Z]*3\)} -a.each{|(o,q,r,s\)|u($s,(o*(X-Z\)\).to_i+i,(q*(Y-Z\)\).to_i+i,(r*(X- -Z\)\).to_i+i,(s*(Y-Z\)\).to_i+i,[(1<<8\)-1]*3\)};end;Q=Object;class -Regexp;def []=(v,is\);is.each{|s|Q.send(:remove_const,s\)if Q. -const_defined? s;Q.const_set(s,v\)};end;end;def int*ptr;666 -end;class O;def []=(a,b=nil\);$c=a;end;end;alias:void:goto -#endif // pretend as if you havn't seen anything) diff --git a/test/c/suite.rb b/test/c/suite.rb deleted file mode 100644 index fc94ad3..0000000 --- a/test/c/suite.rb +++ /dev/null @@ -1,2 +0,0 @@ -class C < CodeRay::TestCase -end -- cgit v1.2.1