FUNCTION main() AS LONG
    DIM a AS STRING = "Hello"
    DIM b AS STRING = "World"
    DIM c AS STRING
    DIM err AS LONG = 0

    c = a & " " & b
    IF c <> "Hello World" THEN err = 1

    IF UCASE$("abc") <> "ABC" THEN err = 2
    IF LCASE$("XYZ") <> "xyz" THEN err = 3
    IF TRIM$("  spaced  ") <> "spaced" THEN err = 4
    IF LTRIM$("  left") <> "left" THEN err = 5
    IF RTRIM$("right  ") <> "right" THEN err = 6

    IF LEFT$("Hello", 2) <> "He" THEN err = 7
    IF RIGHT$("Hello", 2) <> "lo" THEN err = 8
    IF MID$("Hello", 2, 2) <> "el" THEN err = 9

    IF INSTR("Hello World", "World") <> 7 THEN err = 10
    IF INSTR(4, "Hello World", "o") <> 5 THEN err = 11

    IF ASC("A") <> 65 THEN err = 12
    IF CHR$(66) <> "B" THEN err = 13

    IF VAL("42") <> 42.0 THEN err = 14
    IF STR$(123.0) <> "123" THEN err = 15

    IF SPACE$(3) <> "   " THEN err = 16
    IF STRING$(3, 65) <> "AAA" THEN err = 17

    main = err
END FUNCTION
