From: <and...@us...> - 2008-12-18 13:54:25
|
Revision: 9192 http://plplot.svn.sourceforge.net/plplot/?rev=9192&view=rev Author: andrewross Date: 2008-12-18 13:54:22 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Update C and python versions of example 31 to remove extraneous whitespace and to only call plend at the end of the example, even if one of the get / set tests fails. Modified Paths: -------------- trunk/examples/c/x31c.c trunk/examples/python/xw31.py Modified: trunk/examples/c/x31c.c =================================================================== --- trunk/examples/c/x31c.c 2008-12-18 13:53:22 UTC (rev 9191) +++ trunk/examples/c/x31c.c 2008-12-18 13:54:22 UTC (rev 9192) @@ -78,7 +78,6 @@ printf("compression parameter = %d\n", compression2); if (compression2 != compression1) { fputs("plgcompression test failed\n",stderr); - plend(); status = 1; } @@ -88,7 +87,6 @@ printf("family parameters: fam, num, bmax = %d %d %d\n", fam2, num2, bmax2); if (fam2 != fam1 || num2 != num1 || bmax2 != bmax1) { fputs("plgfam test failed\n",stderr); - plend(); status = 1; } @@ -99,7 +97,6 @@ if (xp2 != xp1 || yp2 != yp1 || xleng2 != xleng1 || yleng2 != yleng1 || xoff2 != xoff1 || yoff2 != yoff1 ) { fputs("plgpage test failed\n",stderr); - plend(); status = 1; } @@ -115,17 +112,15 @@ printf("level parameter = %d\n", level2); if (level2 != 1) { fputs("plglevel test failed.\n",stderr); - plend(); status = 1; } pladv(0); plvpor(0.01, 0.99, 0.02, 0.49); plgvpd(&xmin, &xmax, &ymin, &ymax); - printf("plvpor: xmin, xmax, ymin, ymax = %f %f %f %f \n", xmin, xmax, ymin, ymax); + printf("plvpor: xmin, xmax, ymin, ymax = %f %f %f %f\n", xmin, xmax, ymin, ymax); if (xmin != 0.01 || xmax != 0.99 || ymin != 0.02 || ymax != 0.49) { fputs("plgvpd test failed\n",stderr); - plend(); status = 1; } xmid = 0.5*(xmin+xmax); @@ -133,19 +128,17 @@ plwind(0.2, 0.3, 0.4, 0.5); plgvpw(&xmin, &xmax, &ymin, &ymax); - printf("plwind: xmin, xmax, ymin, ymax = %f %f %f %f \n", xmin, xmax, ymin, ymax); + printf("plwind: xmin, xmax, ymin, ymax = %f %f %f %f\n", xmin, xmax, ymin, ymax); if (xmin != 0.2 || xmax != 0.3 || ymin != 0.4 || ymax != 0.5) { fputs("plgvpw test failed\n",stderr); - plend(); status = 1; } /* Get world coordinates for middle of viewport */ plcalc_world(xmid,ymid,&wx,&wy,&win); - printf("world parameters: wx, wy, win = %f %f %d \n", wx, wy, win); + printf("world parameters: wx, wy, win = %f %f %d\n", wx, wy, win); if (fabs(wx-0.5*(xmin+xmax))>1.0E-5 || fabs(wy-0.5*(ymin+ymax))>1.0E-5) { fputs("plcalc_world test failed\n",stderr); - plend(); status = 1; } @@ -167,85 +160,76 @@ value */ plsxax(3,0); plgxax(&digmax,&digits); - printf("x axis parameters: digmax, digits = %d %d \n", digmax, digits); + printf("x axis parameters: digmax, digits = %d %d\n", digmax, digits); if (digmax != 3) { fputs("plgxax test failed\n",stderr); - plend(); status = 1; } plsyax(4,0); plgyax(&digmax,&digits); - printf("y axis parameters: digmax, digits = %d %d \n", digmax, digits); + printf("y axis parameters: digmax, digits = %d %d\n", digmax, digits); if (digmax != 4) { fputs("plgyax test failed\n",stderr); - plend(); status = 1; } plszax(5,0); plgzax(&digmax,&digits); - printf("z axis parameters: digmax, digits = %d %d \n", digmax, digits); + printf("z axis parameters: digmax, digits = %d %d\n", digmax, digits); if (digmax != 5) { fputs("plgzax test failed\n",stderr); - plend(); status = 1; } plsdidev(0.05, PL_NOTSET, 0.1, 0.2); plgdidev(&mar, &aspect, &jx, &jy); - printf("device-space window parameters: mar, aspect, jx, jy = %f %f %f %f \n" , mar, aspect, jx, jy); + printf("device-space window parameters: mar, aspect, jx, jy = %f %f %f %f\n" , mar, aspect, jx, jy); if (mar != 0.05 || jx != 0.1 || jy != 0.2) { fputs("plgdidev test failed\n",stderr); - plend(); status = 1; } plsdiori(1.0); plgdiori(&ori); - printf("ori parameter = %f \n", ori); + printf("ori parameter = %f\n", ori); if (ori != 1.0) { fputs("plgdiori test failed\n",stderr); - plend(); status = 1; } plsdiplt(0.1, 0.2, 0.9, 0.8); plgdiplt(&xmin, &ymin, &xmax, &ymax); - printf("plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f \n", xmin, ymin, xmax, ymax); + printf("plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n", xmin, ymin, xmax, ymax); if (xmin != 0.1 || xmax != 0.9 || ymin != 0.2 || ymax != 0.8) { fputs("plgdiplt test failed\n",stderr); - plend(); status = 1; } plsdiplz(0.1, 0.1, 0.9, 0.9); plgdiplt(&zxmin, &zymin, &zxmax, &zymax); - printf("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f \n", zxmin, zymin, zxmax, zymax); + printf("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n", zxmin, zymin, zxmax, zymax); if ( fabs(zxmin -(xmin + (xmax-xmin)*0.1)) > 1.0E-5 || fabs(zxmax -(xmin+(xmax-xmin)*0.9)) > 1.0E-5 || fabs(zymin -(ymin+(ymax-ymin)*0.1)) > 1.0E-5 || fabs(zymax -(ymin+(ymax-ymin)*0.9)) > 1.0E-5 ) { fputs("plsdiplz test failed\n",stderr); - plend(); status = 1; } plscolbg(10,20,30); plgcolbg(&r, &g, &b); - printf("background colour parameters: r, g, b = %d %d %d \n", r, g, b); + printf("background colour parameters: r, g, b = %d %d %d\n", r, g, b); if (r != 10 || g != 20 || b != 30) { fputs("plgcolbg test failed\n",stderr); - plend(); status = 1; } plscolbga(20,30,40,0.5); plgcolbga(&r, &g, &b, &a); - printf("background/transparency colour parameters: r, g, b, a = %d %d %d %f \n", r, g, b, a); + printf("background/transparency colour parameters: r, g, b, a = %d %d %d %f\n", r, g, b, a); if (r != 20 || g != 30 || b != 40 || a != 0.5) { fputs("plgcolbga test failed\n",stderr); - plend(); status = 1; } Modified: trunk/examples/python/xw31.py =================================================================== --- trunk/examples/python/xw31.py 2008-12-18 13:53:22 UTC (rev 9191) +++ trunk/examples/python/xw31.py 2008-12-18 13:54:22 UTC (rev 9192) @@ -65,7 +65,6 @@ sys.stdout.write("compression parameter = %d\n" % compression2) if compression2 != compression1: sys.stderr.write("plgcompression test failed\n") - plend() status = 1 # Test if device initialization screwed around with any of the @@ -74,7 +73,6 @@ sys.stdout.write("family parameters: fam, num, bmax = %d %d %d\n" % (fam2, num2, bmax2)) if fam2 != fam1 or num2 != num1 or bmax2 != bmax1: sys.stderr.write("plgfam test failed\n") - plend() status = 1 # Test if device initialization screwed around with any of the @@ -83,7 +81,6 @@ sys.stdout.write("page parameters: xp, yp, xleng, yleng, xoff, yoff = %f %f %d %d %d %d\n" % (xp2, yp2, xleng2, yleng2, xoff2, yoff2)) if xp2 != xp1 or yp2 != yp1 or xleng2 != xleng1 or yleng2 != yleng1 or xoff2 != xoff1 or yoff2 != yoff1: sys.stderr.write("plgpage test failed\n") - plend() status = 1 # Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure @@ -101,34 +98,30 @@ sys.stdout.write("level parameter = %d\n" % level2) if level2 != 1: sys.stderr.write("plglevel test failed.\n") - plend() status = 1 pladv(0) plvpor(0.01, 0.99, 0.02, 0.49) (xmin, xmax, ymin, ymax) = plgvpd() - sys.stdout.write("plvpor: xmin, xmax, ymin, ymax = %f %f %f %f \n" % (xmin, xmax, ymin, ymax)) + sys.stdout.write("plvpor: xmin, xmax, ymin, ymax = %f %f %f %f\n" % (xmin, xmax, ymin, ymax)) if xmin != 0.01 or xmax != 0.99 or ymin != 0.02 or ymax != 0.49: sys.stderr.write("plgvpd test failed\n") - plend() status = 1 xmid = 0.5*(xmin+xmax) ymid = 0.5*(ymin+ymax) plwind(0.2, 0.3, 0.4, 0.5) (xmin, xmax, ymin, ymax) = plgvpw() - sys.stdout.write("plwind: xmin, xmax, ymin, ymax = %f %f %f %f \n" % (xmin, xmax, ymin, ymax)) + sys.stdout.write("plwind: xmin, xmax, ymin, ymax = %f %f %f %f\n" % (xmin, xmax, ymin, ymax)) if xmin != 0.2 or xmax != 0.3 or ymin != 0.4 or ymax != 0.5: sys.stderr.write("plgvpw test failed\n") - plend() status = 1 # Get world coordinates for middle of viewport (wx, wy, win) = plcalc_world(xmid,ymid) - sys.stdout.write("world parameters: wx, wy, win = %f %f %d \n" % (wx, wy, win)) + sys.stdout.write("world parameters: wx, wy, win = %f %f %d\n" % (wx, wy, win)) if abs(wx-0.5*(xmin+xmax)) > 1.0E-5 or abs(wy-0.5*(ymin+ymax)) > 1.0E-5: sys.stderr.write("plcalc_world test failed\n") - plend() status = 1 # Retrieve and print the name of the output file (if any) @@ -144,74 +137,65 @@ # therefore it does not make sense to test the returned value. plsxax(3,0) (digmax, digits) = plgxax() - sys.stdout.write("x axis parameters: digmax, digits = %d %d \n" % (digmax, digits)) + sys.stdout.write("x axis parameters: digmax, digits = %d %d\n" % (digmax, digits)) if digmax != 3: sys.stderr.write("plgxax test failed\n") - plend() status = 1 plsyax(4,0) (digmax, digits) = plgyax() - sys.stdout.write("y axis parameters: digmax, digits = %d %d \n" % (digmax, digits)) + sys.stdout.write("y axis parameters: digmax, digits = %d %d\n" % (digmax, digits)) if digmax != 4: sys.stderr.write("plgyax test failed\n") - plend() status = 1 plszax(5,0) (digmax, digits) = plgzax() - sys.stdout.write("z axis parameters: digmax, digits = %d %d \n" % (digmax, digits)) + sys.stdout.write("z axis parameters: digmax, digits = %d %d\n" % (digmax, digits)) if digmax != 5: sys.stderr.write("plgzax test failed\n") - plend() status = 1 plsdidev(0.05, PL_NOTSET, 0.1, 0.2) (mar, aspect, jx, jy) = plgdidev() - sys.stdout.write("device-space window parameters: mar, aspect, jx, jy = %f %f %f %f \n" % (mar, aspect, jx, jy)) + sys.stdout.write("device-space window parameters: mar, aspect, jx, jy = %f %f %f %f\n" % (mar, aspect, jx, jy)) if mar != 0.05 or jx != 0.1 or jy != 0.2: sys.stderr.write("plgdidev test failed\n") - plend() status = 1 plsdiori(1.0) ori = plgdiori() - sys.stdout.write("ori parameter = %f \n" % ori) + sys.stdout.write("ori parameter = %f\n" % ori) if ori != 1.0 : sys.stderr.write("plgdiori test failed\n") - plend() status = 1 plsdiplt(0.1, 0.2, 0.9, 0.8) (xmin, ymin, xmax, ymax) = plgdiplt() - sys.stdout.write("plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f \n" % (xmin, ymin, xmax, ymax)) + sys.stdout.write("plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n" % (xmin, ymin, xmax, ymax)) if xmin != 0.1 or xmax != 0.9 or ymin != 0.2 or ymax != 0.8: sys.stderr.write("plgdiplt test failed\n") - plend() status = 1 plsdiplz(0.1, 0.1, 0.9, 0.9) (zxmin, zymin, zxmax, zymax) = plgdiplt() - sys.stdout.write("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f \n" % (zxmin, zymin, zxmax, zymax)) + sys.stdout.write("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n" % (zxmin, zymin, zxmax, zymax)) if abs(zxmin -(xmin + (xmax-xmin)*0.1)) > 1.0E-5 or abs(zxmax -(xmin+(xmax-xmin)*0.9)) > 1.0E-5 or abs(zymin -(ymin+(ymax-ymin)*0.1)) > 1.0E-5 or abs(zymax -(ymin+(ymax-ymin)*0.9)) > 1.0E-5 : sys.stderr.write("plsdiplz test failed\n") - plend() status = 1 plscolbg(10,20,30) (r, g, b) = plgcolbg() - sys.stdout.write("background colour parameters: r, g, b = %d %d %d \n" % (r, g, b)) + sys.stdout.write("background colour parameters: r, g, b = %d %d %d\n" % (r, g, b)) if r != 10 or g != 20 or b != 30: sys.stderr.write("plgcolbg test failed\n") - plend() status = 1 plscolbga(20, 30, 40, 0.5) (r, g, b, a) = plgcolbga() - sys.stdout.write("background/transparency colour parameters: r, g, b, a = %d %d %d %f \n" % (r, g, b, a)) + sys.stdout.write("background/transparency colour parameters: r, g, b, a = %d %d %d %f\n" % (r, g, b, a)) if r != 20 or g != 30 or b != 40 or a != 0.5: sys.stderr.write("plgcolbga test failed\n") - plend() status = 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |