comparison test/switch.tst @ 17174:c3c1ebfaa7dc

maint: Use common indentation for switch statement. * scripts/general/interp1.m, scripts/geometry/delaunay.m, scripts/help/__unimplemented__.m, scripts/image/cmunique.m, scripts/miscellaneous/edit.m, scripts/optimization/fzero.m, scripts/optimization/sqp.m, scripts/plot/__gnuplot_drawnow__.m, scripts/plot/hidden.m, scripts/plot/legend.m, scripts/plot/print.m, scripts/plot/printd.m, scripts/plot/private/__contour__.m, scripts/plot/private/__fltk_print__.m, scripts/plot/private/__gnuplot_print__.m, scripts/plot/private/__go_draw_axes__.m, scripts/plot/private/__print_parse_opts__.m, scripts/signal/periodogram.m, scripts/sparse/bicg.m, test/slice.tst, test/switch.tst: Use common indentation for switch statement.
author Rik <rik@octave.org>
date Sun, 04 Aug 2013 15:11:34 -0700
parents 57fad64de019
children 5a65b2cc9508
comparison
equal deleted inserted replaced
17173:3a23cbde59d5 17174:c3c1ebfaa7dc
19 %!test 19 %!test
20 %! a = 1; 20 %! a = 1;
21 %! b = 2; 21 %! b = 2;
22 %! c = 3; 22 %! c = 3;
23 %! 23 %!
24 %! switch 0 case 1 x = a; case 2 x = b; otherwise x = c; endswitch 24 %! switch (0) case 1 x = a; case 2 x = b; otherwise x = c; endswitch
25 %! switch 1 case 1 y = a; case 2 y = b; otherwise y = c; endswitch 25 %! switch (1) case 1 y = a; case 2 y = b; otherwise y = c; endswitch
26 %! switch 2 case 1 z = a; case 2 z = b; otherwise z = c; endswitch 26 %! switch (2) case 1 z = a; case 2 z = b; otherwise z = c; endswitch
27 %! switch 3 case 1 p = a; case 2 p = b; otherwise p = c; endswitch 27 %! switch (3) case 1 p = a; case 2 p = b; otherwise p = c; endswitch
28 %! 28 %!
29 %! assert (x == c && y == a && z == b && p == c); 29 %! assert (x == c && y == a && z == b && p == c);
30 30
31 %!test 31 %!test
32 %! a = 1; 32 %! a = 1;
38 %! k = 1; 38 %! k = 1;
39 %! 39 %!
40 %! for i = 0:3 40 %! for i = 0:3
41 %! switch (i) 41 %! switch (i)
42 %! case a 42 %! case a
43 %! x(k) = a; 43 %! x(k) = a;
44 %! case b 44 %! case b
45 %! x(k) = b; 45 %! x(k) = b;
46 %! otherwise 46 %! otherwise
47 %! x(k) = c; 47 %! x(k) = c;
48 %! endswitch 48 %! endswitch
49 %! k++; 49 %! k++;
50 %! endfor 50 %! endfor
51 %! 51 %!
52 %! assert (all (x == [3, 1, 2, 3])); 52 %! assert (all (x == [3, 1, 2, 3]));
60 %! 60 %!
61 %! k = 1; 61 %! k = 1;
62 %! 62 %!
63 %! for i = 0:3 63 %! for i = 0:3
64 %! switch (i) 64 %! switch (i)
65 %! case a 65 %! case a
66 %! x(k) = a; 66 %! x(k) = a;
67 %! endswitch 67 %! endswitch
68 %! k++; 68 %! k++;
69 %! endfor 69 %! endfor
70 %! 70 %!
71 %! assert (all (x == [0, 1, 0, 0])); 71 %! assert (all (x == [0, 1, 0, 0]));
72 72
73 %!test 73 %!test
74 %! a = 1; 74 %! a = 1;
75 %! 75 %!
76 %! switch 1 76 %! switch (1)
77 %! otherwise 77 %! otherwise
78 %! a = 2; 78 %! a = 2;
79 %! endswitch 79 %! endswitch
80 %! 80 %!
81 %! assert (a == 2); 81 %! assert (a == 2);
82 82
83 83