From: <and...@us...> - 2008-12-18 12:52:52
|
Revision: 9190 http://plplot.svn.sourceforge.net/plplot/?rev=9190&view=rev Author: andrewross Date: 2008-12-18 12:52:48 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Some minor tweaks to example 31 so that the example will not exit until the end, even if an error occurs. This ensures that all the get / set tests are run so multiple problems can be identified. Also ensure something (not the file name) is printed out for the plgfnam test so the user can quickly see that it is included. Modified Paths: -------------- trunk/bindings/octave/demos/x31c.m trunk/examples/c/x31c.c trunk/examples/python/xw31.py Modified: trunk/bindings/octave/demos/x31c.m =================================================================== --- trunk/bindings/octave/demos/x31c.m 2008-12-18 12:18:32 UTC (rev 9189) +++ trunk/bindings/octave/demos/x31c.m 2008-12-18 12:52:48 UTC (rev 9190) @@ -79,6 +79,8 @@ ## Test if device initialization screwed around with the preset ## compression parameter. compression2 = plgcompression(); + fprintf(strm,"Output various PLplot parameters\n"); + fprintf(strm,"compression parameter = %d\n", compression2); if (compression2 != compression1) fputs(stderr, "plgcompression test failed\n"); plend(); @@ -148,6 +150,7 @@ ## Get world coordinates for middle of viewport [wx,wy,win] = plcalc_world(xmid,ymid); + fprintf(strm,"world parameters: wx, wy, win = %f %f %d \n", wx, wy, win); if (abs(wx-0.5*(xmin+xmax))>1.0E-5 || abs(wy-0.5*(ymin+ymax))>1.0E-5) fputs(stderr,"plcalc_world test failed\n"); plend(); @@ -159,9 +162,9 @@ ## we want stdout to be identical for compare test. fnam = plgfnam(); if (fnam(1) == "\0") + fputs(strm,"No output file name is set\n"); + else fputs(strm,"Output file name read\n"); - else - fputs(strm,"No output file name is set\n"); endif fprintf(stderr,"Output file name is %s\n",fnam); @@ -208,7 +211,7 @@ plsdiori(1.0); ori = plgdiori(); - printf("ori parameter = %f \n", ori); + fprintf(strm,"ori parameter = %f \n", ori); if (ori != 1.0) fputs(stderr,"plgdiori test failed\n"); plend(); Modified: trunk/examples/c/x31c.c =================================================================== --- trunk/examples/c/x31c.c 2008-12-18 12:18:32 UTC (rev 9189) +++ trunk/examples/c/x31c.c 2008-12-18 12:52:48 UTC (rev 9190) @@ -40,10 +40,13 @@ PLINT g1[] = {255, 0}; PLINT b1[] = {0, 0}; PLFLT a1[] = {1.0, 1.0}; + int status; char fnam[80]; /* Parse and process command line arguments */ + status = 0; + (void) plparseopts(&argc, argv, PL_PARSE_FULL); /* Test setting / getting compression parameter across plinit. */ @@ -76,7 +79,7 @@ if (compression2 != compression1) { fputs("plgcompression test failed\n",stderr); plend(); - exit(1); + status = 1; } /* Test if device initialization screwed around with any of the @@ -86,7 +89,7 @@ if (fam2 != fam1 || num2 != num1 || bmax2 != bmax1) { fputs("plgfam test failed\n",stderr); plend(); - exit(1); + status = 1; } /* Test if device initialization screwed around with any of the @@ -97,7 +100,7 @@ xoff2 != xoff1 || yoff2 != yoff1 ) { fputs("plgpage test failed\n",stderr); plend(); - exit(1); + status = 1; } @@ -113,7 +116,7 @@ if (level2 != 1) { fputs("plglevel test failed.\n",stderr); plend(); - exit(1); + status = 1; } pladv(0); @@ -123,7 +126,7 @@ if (xmin != 0.01 || xmax != 0.99 || ymin != 0.02 || ymax != 0.49) { fputs("plgvpd test failed\n",stderr); plend(); - exit(1); + status = 1; } xmid = 0.5*(xmin+xmax); ymid = 0.5*(ymin+ymax); @@ -134,7 +137,7 @@ if (xmin != 0.2 || xmax != 0.3 || ymin != 0.4 || ymax != 0.5) { fputs("plgvpw test failed\n",stderr); plend(); - exit(1); + status = 1; } /* Get world coordinates for middle of viewport */ @@ -143,13 +146,19 @@ 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(); - exit(1); + status = 1; } /* Retrieve and print the name of the output file (if any). * This goes to stderr not stdout since it will vary between tests and * we want stdout to be identical for compare test. */ plgfnam(fnam); + if (fnam[0] == '\0') { + printf("No output file name is set\n"); + } + else { + printf("Output file name read\n"); + } fprintf(stderr,"Output file name is %s\n",fnam); /* Set and get the number of digits used to display axis labels */ @@ -162,7 +171,7 @@ if (digmax != 3) { fputs("plgxax test failed\n",stderr); plend(); - exit(1); + status = 1; } plsyax(4,0); @@ -171,7 +180,7 @@ if (digmax != 4) { fputs("plgyax test failed\n",stderr); plend(); - exit(1); + status = 1; } plszax(5,0); @@ -180,7 +189,7 @@ if (digmax != 5) { fputs("plgzax test failed\n",stderr); plend(); - exit(1); + status = 1; } plsdidev(0.05, PL_NOTSET, 0.1, 0.2); @@ -189,7 +198,7 @@ if (mar != 0.05 || jx != 0.1 || jy != 0.2) { fputs("plgdidev test failed\n",stderr); plend(); - exit(1); + status = 1; } plsdiori(1.0); @@ -198,7 +207,7 @@ if (ori != 1.0) { fputs("plgdiori test failed\n",stderr); plend(); - exit(1); + status = 1; } plsdiplt(0.1, 0.2, 0.9, 0.8); @@ -207,7 +216,7 @@ if (xmin != 0.1 || xmax != 0.9 || ymin != 0.2 || ymax != 0.8) { fputs("plgdiplt test failed\n",stderr); plend(); - exit(1); + status = 1; } plsdiplz(0.1, 0.1, 0.9, 0.9); @@ -219,7 +228,7 @@ fabs(zymax -(ymin+(ymax-ymin)*0.9)) > 1.0E-5 ) { fputs("plsdiplz test failed\n",stderr); plend(); - exit(1); + status = 1; } plscolbg(10,20,30); @@ -228,7 +237,7 @@ if (r != 10 || g != 20 || b != 30) { fputs("plgcolbg test failed\n",stderr); plend(); - exit(1); + status = 1; } plscolbga(20,30,40,0.5); @@ -237,9 +246,10 @@ if (r != 20 || g != 30 || b != 40 || a != 0.5) { fputs("plgcolbga test failed\n",stderr); plend(); - exit(1); + status = 1; } plend(); - exit(0); + + exit(status); } Modified: trunk/examples/python/xw31.py =================================================================== --- trunk/examples/python/xw31.py 2008-12-18 12:18:32 UTC (rev 9189) +++ trunk/examples/python/xw31.py 2008-12-18 12:52:48 UTC (rev 9190) @@ -56,6 +56,8 @@ def main(): + status = 0 + # Test if device initialization screwed around with the preset # compression parameter. compression2 = plgcompression() @@ -64,7 +66,7 @@ if compression2 != compression1: sys.stderr.write("plgcompression test failed\n") plend() - sys.exit(1) + status = 1 # Test if device initialization screwed around with any of the # preset familying values. @@ -73,7 +75,7 @@ if fam2 != fam1 or num2 != num1 or bmax2 != bmax1: sys.stderr.write("plgfam test failed\n") plend() - sys.exit(1) + status = 1 # Test if device initialization screwed around with any of the # preset page values. @@ -82,7 +84,7 @@ 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() - sys.exit(1) + status = 1 # Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure # they work without any obvious error messages. @@ -100,7 +102,7 @@ if level2 != 1: sys.stderr.write("plglevel test failed.\n") plend() - sys.exit(1) + status = 1 pladv(0) plvpor(0.01, 0.99, 0.02, 0.49) @@ -109,7 +111,7 @@ if xmin != 0.01 or xmax != 0.99 or ymin != 0.02 or ymax != 0.49: sys.stderr.write("plgvpd test failed\n") plend() - sys.exit(1) + status = 1 xmid = 0.5*(xmin+xmax) ymid = 0.5*(ymin+ymax) @@ -119,7 +121,7 @@ if xmin != 0.2 or xmax != 0.3 or ymin != 0.4 or ymax != 0.5: sys.stderr.write("plgvpw test failed\n") plend() - sys.exit(1) + status = 1 # Get world coordinates for middle of viewport (wx, wy, win) = plcalc_world(xmid,ymid) @@ -127,10 +129,14 @@ 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() - sys.exit(1) + status = 1 # Retrieve and print the name of the output file (if any) fnam = plgfnam() + if fnam == '' : + sys.stdout.write("No output file name is set\n") + else : + sys.stdout.write("Output file name read\n") sys.stderr.write("Output file name is %s\n" % fnam) # Set and get the number of digits used to display axis labels @@ -142,7 +148,7 @@ if digmax != 3: sys.stderr.write("plgxax test failed\n") plend() - sys.exit(1) + status = 1 plsyax(4,0) (digmax, digits) = plgyax() @@ -150,7 +156,7 @@ if digmax != 4: sys.stderr.write("plgyax test failed\n") plend() - sys.exit(1) + status = 1 plszax(5,0) (digmax, digits) = plgzax() @@ -158,7 +164,7 @@ if digmax != 5: sys.stderr.write("plgzax test failed\n") plend() - sys.exit(1) + status = 1 plsdidev(0.05, PL_NOTSET, 0.1, 0.2) (mar, aspect, jx, jy) = plgdidev() @@ -166,7 +172,7 @@ if mar != 0.05 or jx != 0.1 or jy != 0.2: sys.stderr.write("plgdidev test failed\n") plend() - sys.exit(1) + status = 1 plsdiori(1.0) ori = plgdiori() @@ -174,7 +180,7 @@ if ori != 1.0 : sys.stderr.write("plgdiori test failed\n") plend() - sys.exit(1) + status = 1 plsdiplt(0.1, 0.2, 0.9, 0.8) (xmin, ymin, xmax, ymax) = plgdiplt() @@ -182,7 +188,7 @@ if xmin != 0.1 or xmax != 0.9 or ymin != 0.2 or ymax != 0.8: sys.stderr.write("plgdiplt test failed\n") plend() - sys.exit(1) + status = 1 plsdiplz(0.1, 0.1, 0.9, 0.9) (zxmin, zymin, zxmax, zymax) = plgdiplt() @@ -190,7 +196,7 @@ 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() - sys.exit(1) + status = 1 plscolbg(10,20,30) (r, g, b) = plgcolbg() @@ -198,7 +204,7 @@ if r != 10 or g != 20 or b != 30: sys.stderr.write("plgcolbg test failed\n") plend() - sys.exit(1) + status = 1 plscolbga(20, 30, 40, 0.5) (r, g, b, a) = plgcolbga() @@ -206,12 +212,15 @@ if r != 20 or g != 30 or b != 40 or a != 0.5: sys.stderr.write("plgcolbga test failed\n") plend() - sys.exit(1) + status = 1 # Restore defaults #plcol0(1) + if status != 0 : + sys.exit(status) + main() # Terminate plplot plend() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |