File: eval.yab

package info (click to toggle)
yabasic 1%3A2.91.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,168 kB
  • sloc: ansic: 12,434; sh: 4,417; makefile: 21
file content (30 lines) | stat: -rwxr-xr-x 631 bytes parent folder | download | duplicates (4)
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
#!./yabasic

for n=1 to 2
  restore number
  for a=1 to 2
    read expr$,result
    found = eval(expr$)
    if found <> result then
       print "Expression " + expr$ + " should eval to " + str$(result) + " but gave " + str$(found)
       exit 1
    endif
  next a
next n

for n=1 to 2
  restore string
  for a=1 to 2
    read expr$,result$
    found$ = eval$(expr$)
    if found$ <> result$ then
       print "Expression " + expr$ + " should eval to " + result$ + " but gave " + found$
       exit 1
    endif
  next a
next n

label number
data "1+2",3,"2+3",5
label string
data "\"foo\" + \"bar\"","foobar","left$(\"foo\",1)","f"