File: switch.yab

package info (click to toggle)
yabasic 1%3A2.78.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,356 kB
  • ctags: 1,575
  • sloc: ansic: 10,420; sh: 9,406; makefile: 17
file content (51 lines) | stat: -rw-r--r-- 1,104 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51


for i=1 to 2
  for j=1 to 8
    x=0
    switch j
      case 1:x=1:poke "__assert_stack_size",1:break
      case 2:x=2:break
      case 3:case 4:case 5:x=3:break
      case 6:x=4:break
      default:x=5
    end switch
  next j
  poke "__assert_stack_size",0
  if (x=0) exit -1
  if (j=1 and x<>1) exit 1
  if (j=2 and x<>1) exit 2
  if (j=3 and x<>3) exit 3
  if (j=4 and x<>3) exit 4
  if (j=5 and x<>3) exit 5
  if (j=6 and x<>4) exit 6
  if (j=7 and x<>5) exit 7
  if (j=8 and x<>5) exit 8
next i
poke "__assert_stack_size",0


for i=1 to 2
  for j=1 to 8
    x$=""
    switch j
      case 1:x$="1":poke "__assert_stack_size",1:break
      case 2:x$="2":break
      case 3:case 4:case 5:x$="3":break
      case 6:x$="4":break
      default:x$="5"
    end switch
  next j
  poke "__assert_stack_size",0
  if (x$="") exit -1
  if (j=1 and x$<>"1") exit 1
  if (j=2 and x$<>"1") exit 2
  if (j=3 and x$<>"3") exit 3
  if (j=4 and x$<>"3") exit 4
  if (j=5 and x$<>"3") exit 5
  if (j=6 and x$<>"4") exit 6
  if (j=7 and x$<>"5") exit 7
  if (j=8 and x$<>"5") exit 8
next i
poke "__assert_stack_size",0