#!./yabasic

if left$("abc",2)<>"ab" error "left$ has problems"
if right$("abc",2)<>"bc" error "right$ has problems"
if mid$("abc",2,1)<>"b" error "mid$ has problems"
if chomp$("foo\n")<>"foo" error "chomp$ has problems"
if chomp$("foo")<>"foo" error "chomp$ has problems"
if not glob("foobar","*bar") error "glob has problems"
if not glob("bar","*bar") error "glob has problems"
if len("foo\"")<>4 error "strlen has problems"
if string$(4,"foo")<>"foofoofoofoo" error "string$ has problems"
if string$(0,"foo")<>"" error "string$ has problems"
if replace$("foo","o","uu")<>"fuuuu" error "replace$ has problems"
if replace$("fuuuu","uu","o")<>"foo" error "replace$ has problems"
if replace$("foo","","x")<>"foo" error "replace$ has problems"
if replace$("foo","o","")<>"f" error "replace$ has problems"
if replace$("foo","u","")<>"foo" error "replace$ has problems"

a$="foo"
left$(a$,1)="z"
if a$ <> "zoo" error "Assigning to left$ has problems"
left$(a$,1)="bar"
if a$ <> "boo" error "Assigning to left$ has problems"

a$="bar"
right$(a$,3)="foo"
if a$ <> "foo" error "Assigning to right$ has problems"

a$="foobarbaz"
mid$(a$,4,3)="qux"
if a$ <> "fooquxbaz" error "Assigning to mid$ has problems"
