Mercurial > hg > octave-lojdl
changeset 2769:31f6943ed944
[project @ 1997-03-01 04:16:10 by jwe]
author | jwe |
---|---|
date | Sat, 01 Mar 1997 04:16:11 +0000 |
parents | ee9582e6668f |
children | 7bade0cc3d46 |
files | test/octave.test/switch/switch-1.m test/octave.test/switch/switch-2.m test/octave.test/switch/switch-3.m test/octave.test/switch/switch-4.m test/octave.test/switch/switch-5.m test/octave.test/switch/switch-6.m test/octave.test/switch/switch.exp |
diffstat | 7 files changed, 74 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/test/octave.test/switch/switch-1.m @@ -0,0 +1,10 @@ +a = 1; +b = 2; +c = 3; + +switch 0 case 1 x = a; case 2 x = b; otherwise x = c; endswitch +switch 1 case 1 y = a; case 2 y = b; otherwise y = c; endswitch +switch 2 case 1 z = a; case 2 z = b; otherwise z = c; endswitch +switch 3 case 1 p = a; case 2 p = b; otherwise p = c; endswitch + +x == c && y = a && z = b && p == c
new file mode 100644 --- /dev/null +++ b/test/octave.test/switch/switch-2.m @@ -0,0 +1,21 @@ +a = 1; +b = 2; +c = 3; + +x = zeros (1, 4); + +k = 1; + +for i = 0:3 + switch (i) + case a + x(k) = a; + case b + x(k) = b; + otherwise + x(k) = c; + endswitch + k++; +endfor + +all (x == [3, 1, 2, 3])
new file mode 100644 --- /dev/null +++ b/test/octave.test/switch/switch-3.m @@ -0,0 +1,17 @@ +a = 1; +b = 2; +c = 3; + +x = zeros (1, 4); + +k = 1; + +for i = 0:3 + switch (i) + case a + x(k) = a; + endswitch + k++; +endfor + +all (x == [0, 1, 0, 0])
new file mode 100644 --- /dev/null +++ b/test/octave.test/switch/switch-4.m @@ -0,0 +1,1 @@ +switch endswitch
new file mode 100644 --- /dev/null +++ b/test/octave.test/switch/switch-5.m @@ -0,0 +1,1 @@ +switch case endswitch
new file mode 100644 --- /dev/null +++ b/test/octave.test/switch/switch-6.m @@ -0,0 +1,1 @@ +switch 1 default 1; endswitch
new file mode 100644 --- /dev/null +++ b/test/octave.test/switch/switch.exp @@ -0,0 +1,23 @@ +set test switch-1 +set prog_output "ans = 1" +do_test switch-1.m + +set test switch-2 +set prog_output "ans = 1" +do_test switch-2.m + +set test switch-3 +set prog_output "ans = 1" +do_test switch-3.m + +set test switch-4 +set prog_output "parse error.*" +do_test switch-4.m + +set test switch-5 +set prog_output "parse error.*" +do_test switch-5.m + +set test switch-6 +set prog_output "parse error.*" +do_test switch-6.m