diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index d682a5f..b244ef9 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -15,8 +15,10 @@ jobs: uses: actions/checkout@v4 with: # Not recursive, deliberately. The top-level build needs - # deps/libakerror and deps/libakstdlib (via add_subdirectory) and - # deps/basicinterpret (the golden corpus is driven in place from it). + # deps/libakerror and deps/libakstdlib, via add_subdirectory, and + # nothing else: the golden corpus and the Commodore font now live in + # this repository (tests/reference/ and assets/fonts/), so + # deps/basicinterpret is no longer a build dependency at all. # It does *not* need deps/libakgl, which is guarded behind # AKBASIC_WITH_AKGL and defaults OFF -- and recursing into it would # clone SDL, SDL_image, SDL_mixer, SDL_ttf and jansson for a target @@ -32,12 +34,13 @@ jobs: run: | cmake -S . -B build cmake --build build --parallel - # The suite is 70 cases: 41 golden files byte-compared against the Go - # reference's own corpus, 5 local golden cases for verbs the reference - # never implemented, 21 unit tests, 2 embedding examples, and 1 - # known-failing test that asserts the *correct* contract for defects - # carried over from the reference (TODO.md section 6). A green run - # therefore does not mean defect-free -- see AKBASIC_KNOWN_FAILING_TESTS. + # The suite is 78 cases: 41 golden files byte-compared against the Go + # reference's own corpus (checked in at tests/reference/, see its README), + # 9 local golden cases for verbs the reference never implemented, 25 unit + # tests, 2 embedding examples, and 1 known-failing test that asserts the + # *correct* contract for defects carried over from the reference (TODO.md + # section 6). A green run therefore does not mean defect-free -- see + # AKBASIC_KNOWN_FAILING_TESTS. # # AKBASIC_WITH_AKGL is off here, which is the point rather than an # omission: this job is what proves the interpreter builds and passes on a @@ -96,13 +99,14 @@ jobs: run: | sudo apt-get update -y sudo apt-get install -y cmake gcc gcovr - # The gate is a ratchet, not a target: src/ sits at 93.5% of lines and - # 97.8% of functions, so 90 fails on a real regression (a test deleted, or + # The gate is a ratchet, not a target: src/ sits at 94.6% of lines and + # 98.6% of functions, so 90 fails on a real regression (a test deleted, or # new untested code added) without tripping over rounding. # - # The akbasic_akgl target is not in this figure. It is not built in a - # default configuration, and instrumenting it would drag SDL into the - # coverage job for four thin adaptors. + # The akbasic_akgl and akbasic_frontend targets are not in this figure. + # Neither is built in a default configuration, and instrumenting them would + # drag SDL into the coverage job for four thin adaptors and a host. What + # covers them instead is the akgl_build job below. # # There is deliberately no branch gate. Branch coverage reads about 18% # and is not a meaningful number here, for the reason libakgl's and @@ -235,9 +239,9 @@ jobs: uses: actions/checkout@v4 with: # The harness copies the repo and configures a build inside the copy, - # so it needs the same submodules the main build does -- including - # deps/basicinterpret, because the golden corpus is part of what kills - # mutants. + # so it needs the same submodules the main build does. The golden + # corpus is part of what kills mutants and it is checked in now, so + # that is libakerror and libakstdlib and nothing else. submodules: true - name: dependencies run: | diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index d15fa4f..dac235e 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -66,9 +66,9 @@ jobs: uses: actions/checkout@v4 with: # The harness copies the repo and configures a build inside the copy, - # so it needs the same submodules the main build does -- including - # deps/basicinterpret, because the golden corpus is part of what kills - # mutants. + # so it needs the same submodules the main build does. The golden + # corpus is part of what kills mutants and it is checked in now, so + # that is libakerror and libakstdlib and nothing else. submodules: true - name: dependencies run: | diff --git a/CLAUDE.md b/CLAUDE.md index c8ad573..d01c65a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -190,10 +190,17 @@ make tests # or: bash ./test.sh stdout against the sibling `.txt`. The exit code is the number of failures. To run a single case, just run the interpreter on that `.bas` and diff against its `.txt`. -That corpus is the natural acceptance suite for the rewrite: the C interpreter should reproduce the -same stdout for the same `.bas` files. Carry it over (or drive it in place) alongside the per-module -CTest executables the `ak*` style calls for — the two answer different questions, and new language -features from goal 2 need a `.bas`/`.txt` pair as well as unit tests. +That corpus is the acceptance suite for the rewrite: the C interpreter reproduces the same stdout +for the same `.bas` files. **It has been copied into this repository at `tests/reference/`** and no +longer runs out of the submodule — see `tests/reference/README.md` for the provenance and for the +rule that those expectations are never edited to suit this interpreter. It sits alongside the +per-module CTest executables the `ak*` style calls for; the two answer different questions, and new +language features from goal 2 need a `.bas`/`.txt` pair in `tests/language/` as well as unit tests. + +**`deps/basicinterpret` is no longer a build or test dependency.** Both configurations were +configured, built and run from scratch with it moved out of the tree. It is kept only as the +behavioural spec to read when a question about semantics comes up — which is a real use, and the +reason it has not been removed. The Commodore font it also supplied now lives in `assets/fonts/`. `deps/basicinterpret/README.md` is the language reference — implemented verbs, functions, variable type suffixes, and an explicit list of what is *not* implemented. Read it before adding or porting diff --git a/CMakeLists.txt b/CMakeLists.txt index fe350a6..ce446c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -195,10 +195,12 @@ if(AKBASIC_WITH_AKGL) # The reference's own font, at the reference's own size. Its main.go opens # "./fonts/C64_Pro_Mono-STYLE.ttf", which only ever resolved from its own # source directory; compiled in, it resolves from anywhere, and AKBASIC_FONT - # overrides it at runtime for an installed copy. + # overrides it at runtime for an installed copy. Vendored into assets/fonts/ + # rather than reached for in the submodule -- see assets/fonts/PROVENANCE.md, + # which also carries the licence question that came with it. target_compile_definitions(basic PRIVATE AKBASIC_HAVE_AKGL=1 - AKBASIC_FONT_PATH="${CMAKE_CURRENT_SOURCE_DIR}/deps/basicinterpret/fonts/C64_Pro_Mono-STYLE.ttf") + AKBASIC_FONT_PATH="${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts/C64_Pro_Mono-STYLE.ttf") endif() akbasic_instrument(basic) @@ -308,7 +310,7 @@ if(AKBASIC_WITH_AKGL) target_link_libraries(akbasic_test_akgl_frontend PRIVATE akbasic_frontend) target_include_directories(akbasic_test_akgl_frontend PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/tests") target_compile_definitions(akbasic_test_akgl_frontend PRIVATE - AKBASIC_TEST_C64_FONT="${CMAKE_CURRENT_SOURCE_DIR}/deps/basicinterpret/fonts/C64_Pro_Mono-STYLE.ttf") + AKBASIC_TEST_C64_FONT="${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts/C64_Pro_Mono-STYLE.ttf") akbasic_instrument(akbasic_test_akgl_frontend) _add_test(NAME akgl_frontend COMMAND akbasic_test_akgl_frontend) _set_tests_properties(akgl_frontend PROPERTIES @@ -331,13 +333,19 @@ if(AKBASIC_WILL_FAIL_TESTS OR AKBASIC_KNOWN_FAILING_TESTS) ) endif() -# The golden-file suite. It drives deps/basicinterpret/tests/**/*.bas in place -- -# the corpus is a submodule and copying it guarantees drift -- and byte-compares -# stdout against the sibling .txt. One CTest case per .bas so a failure names the -# file. +# The reference's own corpus, byte-compared against the sibling .txt. One CTest +# case per .bas so a failure names the file. +# +# It used to be driven in place out of deps/basicinterpret, on the reasoning that +# copying a submodule's corpus guarantees drift. That reasoning was sound and it +# has been overruled deliberately: the Go dependency is being deprecated, and a +# build that cannot run its acceptance suite without cloning the implementation +# it replaced is not finished. The copy is byte-identical to +# basicinterpreter@d76162c and tests/reference/README.md records +# where it came from and what the drift now costs. file(GLOB_RECURSE AKBASIC_GOLDEN_CASES - RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/deps/basicinterpret" - "${CMAKE_CURRENT_SOURCE_DIR}/deps/basicinterpret/tests/*.bas" + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/tests/reference" + "${CMAKE_CURRENT_SOURCE_DIR}/tests/reference/*.bas" ) foreach(_case IN LISTS AKBASIC_GOLDEN_CASES) @@ -348,7 +356,7 @@ foreach(_case IN LISTS AKBASIC_GOLDEN_CASES) NAME golden_${_name} COMMAND ${CMAKE_COMMAND} -DBASIC=$ - -DCASE=${CMAKE_CURRENT_SOURCE_DIR}/deps/basicinterpret/${_case} + -DCASE=${CMAKE_CURRENT_SOURCE_DIR}/tests/reference/${_case} -P ${CMAKE_CURRENT_SOURCE_DIR}/tests/golden.cmake ) endforeach() @@ -373,10 +381,12 @@ endif() # The local golden corpus, for verbs the reference never implemented. # -# It has to be separate: the corpus above is a submodule and nothing in this -# repository may add files to it, but goal 2's new verbs still need the .bas/.txt -# half of their coverage. Registered under local_ so a failure says at a glance -# which corpus it came from. +# Still separate now that the reference's corpus lives in this repository too, +# and the reason changed rather than went away: tests/reference/ is a *record* of +# what the Go implementation did and nothing in it should ever be edited to suit +# this one, while tests/language/ is ours to change. Registered under local_ so a +# failure says at a glance which of the two it came from -- and so a diff that +# touches tests/reference/ stands out as the thing it is. # # Note what this can and cannot cover. The graphics and sound verbs draw and play # rather than print, so what a golden file sees of them is their *refusals* and diff --git a/README.md b/README.md index 58619fd..8542add 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -This BASIC is styled after [Commodore BASIC 7.0](http://www.jbrain.com/pub/cbm/manuals/128/C128PRG.pdf) and the [Dartmouth BASIC from 1964](https://www.dartmouth.edu/basicfifty/basic.html). It is a C rewrite of [basicinterpreter](https://source.starfort.tech/andrew/basicinterpreter), which was itself built from the instructions for the Java implementation of Lox in [craftinginterpreters.com](https://craftinginterpreters.com) before striking off on its own. The Go version is vendored at `deps/basicinterpret` and is the behavioural specification: when a question about semantics comes up, the answer lives in that code and in its `tests/`. +This BASIC is styled after [Commodore BASIC 7.0](http://www.jbrain.com/pub/cbm/manuals/128/C128PRG.pdf) and the [Dartmouth BASIC from 1964](https://www.dartmouth.edu/basicfifty/basic.html). It is a C rewrite of [basicinterpreter](https://source.starfort.tech/andrew/basicinterpreter), which was itself built from the instructions for the Java implementation of Lox in [craftinginterpreters.com](https://craftinginterpreters.com) before striking off on its own. The Go version is vendored at `deps/basicinterpret` and is the behavioural specification: when a question about semantics comes up, the answer lives in that code. Its acceptance corpus is **checked in here** at [`tests/reference/`](tests/reference/README.md) and runs on every build, so nothing about building or testing this project needs that submodule any more. ```sh git submodule update --init --recursive @@ -9,7 +9,7 @@ cmake --build build --parallel ./build/basic # To run a basic file from the command line -./build/basic deps/basicinterpret/tests/language/functions.bas +./build/basic tests/reference/language/functions.bas # The test suite: unit tests plus the Go version's own corpus, byte-compared ctest --test-dir build --output-on-failure @@ -25,7 +25,7 @@ ctest --test-dir build-akgl --output-on-failure # That build of `basic` is a different program: it opens an 800x600 window, draws # BASIC output into it in the Commodore font, and still puts every byte on stdout. -./build-akgl/basic deps/basicinterpret/tests/language/functions.bas +./build-akgl/basic tests/reference/language/functions.bas ``` There are two workflows. **`.gitea/workflows/ci.yaml`** runs on every push: the suite, @@ -72,7 +72,9 @@ And the port is a good excuse to find out what the original actually does, as op # What Works? -Everything the Go version does. All 41 `.bas` files in `deps/basicinterpret/tests/` produce **byte-identical** output from both implementations, including error messages and the trailing blank line after one. Those files are driven in place as individual CTest cases rather than copied, so the corpus cannot drift from upstream. +Everything the Go version does. All 41 `.bas` files of the reference's own corpus produce **byte-identical** output from both implementations, including error messages and the trailing blank line after one. Each is a separate CTest case, so a failure names the file. + +That corpus lives at [`tests/reference/`](tests/reference/README.md), copied byte for byte out of the Go project. It was driven in place out of the submodule until the Go dependency started being deprecated; its README records where it came from, and that nobody is watching for drift any more because the thing it tracked has stopped moving. **Do not edit those expectations** — a failure there means this interpreter's behaviour changed. ## Case Sensitivity @@ -461,7 +463,7 @@ The exception is `FILTER`, which sets the SID's filter cutoff, band switches and * [libakerror](https://source.starfort.tech/andrew/libakerror) 1.0.0 — TRY/CATCH-style error contexts. Every function that can fail returns one. * [libakstdlib](https://source.starfort.tech/andrew/libakstdlib) 0.2.0 — libc wrappers that report through `libakerror`. * [libakgl](https://source.starfort.tech/andrew/libakgl) 0.2.0 — **optional**, only for `-DAKBASIC_WITH_AKGL=ON`. Pulls in SDL3, and requires `libakstdlib` 0.2, which is why the two move together. -* [basicinterpret](https://source.starfort.tech/andrew/basicinterpret) — the Go original, vendored as the behavioural spec and the acceptance corpus. Not linked, not built. +* [basicinterpret](https://source.starfort.tech/andrew/basicinterpret) — the Go original. Vendored as the behavioural spec for questions about semantics, and for nothing else: its acceptance corpus and its Commodore font are checked in here now, so **the build and the test suite do not need it**. Not linked, not built, and safe to omit. Everything is a submodule; `git submodule update --init --recursive` gets all of it. There is nothing to install first. diff --git a/TODO.md b/TODO.md index c2bde74..09d0177 100644 --- a/TODO.md +++ b/TODO.md @@ -354,10 +354,23 @@ and the only path that existed — `AKBASIC_MODE_RUNSTREAM` reading through the is the code the README quotes, built by every build and registered as a CTest case so a signature change breaks the build rather than rotting the document. -**The acceptance suite is the reference's own corpus, driven in place.** All 41 `.bas` files -under `deps/basicinterpret/tests/` are registered as individual CTest cases and byte-compared -against their `.txt` — including the trailing double newline on an error line (§1.8). Nothing -is copied, so the corpus cannot drift from its upstream. +**The acceptance suite is the reference's own corpus, checked in at `tests/reference/`.** All +41 `.bas` files are registered as individual CTest cases and byte-compared against their `.txt` +— including the trailing double newline on an error line (§1.8). + +It was driven *in place* out of `deps/basicinterpret` until 2026-07-31, on the reasoning that +copying a submodule's corpus guarantees drift. That reasoning was sound and was overruled +deliberately: the Go dependency is being deprecated, and a build that cannot run its own +acceptance suite without cloning the implementation it replaced is not finished. The copy is +byte-identical to `basicinterpreter@d76162c`, and `tests/reference/README.md` records the +provenance, the cost of the drift nobody is watching for now, and the rule that those +expectations are never edited to suit this interpreter. + +**Nothing in the build or the suite needs `deps/basicinterpret` any more**, and that is checked +rather than assumed — both configurations were configured, built and run from scratch with the +submodule moved out of the tree. The Commodore font moved too, to `assets/fonts/`, which was the +other thing tying the build to it; `assets/fonts/PROVENANCE.md` carries the licence question that +came with it. Eighteen unit tests cover the modules the corpus cannot reach on its own. `tests/known_reference_defects.c` is registered in `AKBASIC_KNOWN_FAILING_TESTS` and asserts @@ -1037,7 +1050,7 @@ entire test corpus and passes clean under ASan and UBSan. |---|---| | `ctest` | 76/76 — 41 upstream golden cases, 9 local ones, 23 unit tests, 2 embedding examples, 1 known-failing | | `ctest` with `-DAKBASIC_WITH_AKGL=ON` | 75/75 — the same, minus the three `no_device` cases the SDL driver contradicts, plus `akgl_backends` and `akgl_frontend`; the `akgl_build` CI job | -| Golden corpus | 41/41 byte-exact, driven in place from the submodule — **and 41/41 again through the SDL binary**, which is most of what proves the frontend changes no output | +| Golden corpus | 41/41 byte-exact from `tests/reference/` — **and 41/41 again through the SDL binary**, which is most of what proves the frontend changes no output | | ASan + UBSan | 76/76 | | Line coverage | 94.6% (3857/4076) — above the 90% gate | | Function coverage | 98.6% (287/291) | diff --git a/assets/fonts/C64_Pro_Mono-STYLE.ttf b/assets/fonts/C64_Pro_Mono-STYLE.ttf new file mode 100644 index 0000000..02ff5fc Binary files /dev/null and b/assets/fonts/C64_Pro_Mono-STYLE.ttf differ diff --git a/assets/fonts/PROVENANCE.md b/assets/fonts/PROVENANCE.md new file mode 100644 index 0000000..43d91e8 --- /dev/null +++ b/assets/fonts/PROVENANCE.md @@ -0,0 +1,41 @@ +# C64_Pro_Mono-STYLE.ttf + +| | | +|---|---| +| Font | C64 Pro Mono, by STYLE — | +| Copied from | `basicinterpreter@d76162c`, `fonts/C64_Pro_Mono-STYLE.ttf` | +| Copied on | 2026-07-31 | +| Verified | `cmp`-identical to the submodule copy | + +## Why it is here + +It is the font `deps/basicinterpret/main.go` opens, at the size it opens it, and reproducing +that is part of what the SDL frontend is for. It was reached for inside the submodule until the +Go dependency started being deprecated; the build now has no reason to clone that repository, +and this was the last thing tying it to one. + +Two things use it, both through compile definitions in `CMakeLists.txt`: + +- `AKBASIC_FONT_PATH` — what an `-DAKBASIC_WITH_AKGL=ON` build of `basic` opens. Overridable at + runtime with the `AKBASIC_FONT` environment variable, which is what an installed copy or a + different font wants. +- `AKBASIC_TEST_C64_FONT` — what `tests/akgl_frontend.c` opens, because `TODO.md` §3's + acceptance asks the drawn text to be proved in *this* font rather than any monospaced one. + +## The licence question, which is open + +**STYLE's C64 TrueType fonts are not public domain and this repository does not carry their +licence.** Neither did `basicinterpreter`, which is where the file came from. The terms at + permit free personal and non-commercial use and +require the licence to accompany redistribution; commercial redistribution needs their +permission. + +Copying it here changes nothing legally — the same file was already being redistributed from +the same owner's other public repository — but it does move the question into a project that +is meant to be embeddable in other people's games, which is where it starts to matter. + +**Before this is shipped in anything commercial, or vendored into a game that is:** either +obtain STYLE's permission and include their licence file beside this one, or replace the font. +Replacing it is cheap — the frontend measures whatever font it is handed +(`akbasic_sink_init_akgl` derives the character grid from `akgl_text_measure`), so any +monospaced TTF works and only the two compile definitions above would change. diff --git a/scripts/mutation_test.py b/scripts/mutation_test.py index 53fa22a..fb6bfa1 100755 --- a/scripts/mutation_test.py +++ b/scripts/mutation_test.py @@ -282,9 +282,10 @@ def copy_tree(src, dst): # and a coverage tree drags along every .gcno/.gcda as well. # # deps/ is copied wholesale and has to be: the build pulls libakerror and - # libakstdlib in with add_subdirectory, and the golden suite drives the .bas - # corpus in deps/basicinterpret in place. Only the reference's vendored - # Windows DLLs are dead weight, hence "*.dll". + # libakstdlib in with add_subdirectory. The golden corpus used to be the + # other reason -- it was driven in place out of deps/basicinterpret -- and + # now lives in tests/reference/, which comes along with the rest of the tree. + # Only vendored Windows DLLs are dead weight, hence "*.dll". ignore = shutil.ignore_patterns("build*", ".git", "*.o", "*.so", "*~", "#*#", "*.iso", "*.png", "*.gcno", "*.gcda", "*.dll") diff --git a/tests/reference/README.md b/tests/reference/README.md new file mode 100644 index 0000000..c4fc2b9 --- /dev/null +++ b/tests/reference/README.md @@ -0,0 +1,49 @@ +# The reference interpreter's own test corpus + +These 41 `.bas` files and their 41 `.txt` expectations are **not this project's tests.** They +are a byte-for-byte copy of the acceptance corpus belonging to the Go implementation this +interpreter was ported from: + +| | | +|---|---| +| Source | `https://source.starfort.tech/andrew/basicinterpreter`, `tests/` | +| Copied at | commit `d76162cb37eeaccddae2cf6cab7af7bc8175d6d2` ("Update README.md") | +| Copied on | 2026-07-31 | +| Verified | every file `cmp`-identical to the submodule at the time of the copy | + +They are registered as the `golden_*` CTest cases and run against `basic` on every build, in +both the default and the `-DAKBASIC_WITH_AKGL=ON` configurations. + +## Why they are a copy now, when they deliberately were not + +Until 2026-07-31 these were driven *in place* out of `deps/basicinterpret`, and the reasoning +was written down in `CMakeLists.txt`: the corpus is a submodule, and copying a submodule's +corpus guarantees drift. + +That reasoning was sound. It was overruled on purpose, because the Go dependency is being +deprecated and a build that cannot run its own acceptance suite without cloning the +implementation it replaced is not finished. + +**What the change costs, stated plainly so nobody has to rediscover it:** if the Go +implementation ever gains a test, this directory will not. There is no longer anything +watching for that. The trade is deliberate — the Go project is the thing being retired, so a +corpus that stops tracking it is a corpus that stopped tracking something that stopped moving. + +## The rule for editing these + +**Don't.** + +This directory is a *record of what the Go implementation did*, and it is what makes the claim +"reproduces the reference byte for byte" checkable at all. A failure here means this +interpreter's behaviour changed, and the answer is to change this interpreter or to record a +deliberate deviation in `TODO.md` §5 — never to edit the expectation to match. + +New cases for this project's own behaviour go in `tests/language/`, which is registered under +`local_*` for exactly this reason: the prefix says which corpus a failure came from, and a diff +that touches `tests/reference/` stands out as the thing it is. + +There is one case worth knowing about before anybody "fixes" it. +`examples/strreverse.bas` names a variable `INPUT$`, which a real Commodore 128 would refuse +and which this interpreter accepts only because the reference's reserved-word check never +fires. That is `TODO.md` §6 item 16, and it is the reason that item is filed as a decision +rather than a defect: making the check work costs this case. diff --git a/tests/reference/examples/bubblesort.bas b/tests/reference/examples/bubblesort.bas new file mode 100644 index 0000000..ed53ce8 --- /dev/null +++ b/tests/reference/examples/bubblesort.bas @@ -0,0 +1,29 @@ +10 DIM A#(5) +15 ITERATIONS# = 0 +20 A#(0) = 5 +21 A#(1) = 2 +22 A#(2) = 4 +23 A#(3) = 1 +24 A#(4) = 3 +25 PRINT "BEFORE SORTING: " +26 FOR I# = 0 TO 4 +27 PRINT A#(I#) +28 NEXT I# +30 CHANGED# = 0 +32 ITERATIONS# = ITERATIONS# + 1 +35 FOR I# = 0 TO 3 +45 J# = I#+1 +46 REM PRINT "COMPARING INDEXES " + I# + " (" + A#(I#) + ") AND " + J# + " +50 IF A#(I#) <= A#(J#) THEN GOTO 100 +55 REM PRINT "SWAPPING INDEXES " + I# + " AND " + J# +60 TMP# = A#(I#) +70 A#(I#) = A#(J#) +80 A#(J#) = TMP# +85 CHANGED# = CHANGED# + 1 +100 NEXT I# +110 IF CHANGED# <> 0 THEN GOTO 30 +115 PRINT "AFTER SORTING:" +120 FOR I# = 0 TO 4 +130 PRINT A#(I#) +140 NEXT I# +145 PRINT "SORTED IN " + ITERATIONS# + " ITERATIONS" diff --git a/tests/reference/examples/bubblesort.txt b/tests/reference/examples/bubblesort.txt new file mode 100644 index 0000000..1800b32 --- /dev/null +++ b/tests/reference/examples/bubblesort.txt @@ -0,0 +1,13 @@ +BEFORE SORTING: +5 +2 +4 +1 +3 +AFTER SORTING: +1 +2 +3 +4 +5 +SORTED IN 4 ITERATIONS diff --git a/tests/reference/examples/factorial.bas b/tests/reference/examples/factorial.bas new file mode 100644 index 0000000..bf47c8f --- /dev/null +++ b/tests/reference/examples/factorial.bas @@ -0,0 +1,10 @@ +10 N# = 5 +20 RESULT# = 1 +30 GOSUB 100 +40 PRINT "FACTORIAL(5) IS " + RESULT# +50 QUIT +100 IF N# <= 1 THEN RETURN +110 RESULT# = RESULT# * N# +120 N# = N# - 1 +130 GOSUB 100 +140 RETURN diff --git a/tests/reference/examples/factorial.txt b/tests/reference/examples/factorial.txt new file mode 100644 index 0000000..0dc65aa --- /dev/null +++ b/tests/reference/examples/factorial.txt @@ -0,0 +1 @@ +FACTORIAL(5) IS 120 diff --git a/tests/reference/examples/strreverse.bas b/tests/reference/examples/strreverse.bas new file mode 100644 index 0000000..deadc48 --- /dev/null +++ b/tests/reference/examples/strreverse.bas @@ -0,0 +1,7 @@ +10 INPUT$ = "HELLO" +20 STRLEN# = LEN(INPUT$) - 1 +30 REV$ = "" +40 FOR I# = STRLEN# TO 0 STEP -1 +50 REV$ = REV$ + MID(INPUT$, I#, 1) +60 NEXT I# +70 PRINT "REVERSED: " + REV$ diff --git a/tests/reference/examples/strreverse.txt b/tests/reference/examples/strreverse.txt new file mode 100644 index 0000000..c576d53 --- /dev/null +++ b/tests/reference/examples/strreverse.txt @@ -0,0 +1 @@ +REVERSED: OLLEH diff --git a/tests/reference/language/arithmetic/float.bas b/tests/reference/language/arithmetic/float.bas new file mode 100644 index 0000000..38984cf --- /dev/null +++ b/tests/reference/language/arithmetic/float.bas @@ -0,0 +1,7 @@ +10 PRINT 2.0 + 2.0 +20 PRINT 2.0 * 2.0 +30 PRINT 4.0 / 2.0 +40 PRINT 4.0 - 2.0 +50 PRINT 1.0 / 0.5 +60 PRINT 12.0 / 4.0 +70 PRINT 1.20 / 0.4 diff --git a/tests/reference/language/arithmetic/float.txt b/tests/reference/language/arithmetic/float.txt new file mode 100644 index 0000000..09b8108 --- /dev/null +++ b/tests/reference/language/arithmetic/float.txt @@ -0,0 +1,7 @@ +4.000000 +4.000000 +2.000000 +2.000000 +2.000000 +3.000000 +3.000000 diff --git a/tests/reference/language/arithmetic/integer.bas b/tests/reference/language/arithmetic/integer.bas new file mode 100644 index 0000000..da8435e --- /dev/null +++ b/tests/reference/language/arithmetic/integer.bas @@ -0,0 +1,5 @@ +10 PRINT 2 + 2 +20 PRINT 2 * 2 +30 PRINT 4 / 2 +40 PRINT 4 - 2 + diff --git a/tests/reference/language/arithmetic/integer.txt b/tests/reference/language/arithmetic/integer.txt new file mode 100644 index 0000000..d643e2b --- /dev/null +++ b/tests/reference/language/arithmetic/integer.txt @@ -0,0 +1,3 @@ +4 +4 +2 diff --git a/tests/reference/language/array_multidimensional.bas b/tests/reference/language/array_multidimensional.bas new file mode 100644 index 0000000..f96319e --- /dev/null +++ b/tests/reference/language/array_multidimensional.bas @@ -0,0 +1,6 @@ +10 DIM A#(8, 8) +20 PRINT LEN(A#) +30 A#(0,7) = 31337 +40 A#(1,7) = 65535 +50 PRINT A#(0,7) +60 PRINT A#(1,7) diff --git a/tests/reference/language/array_multidimensional.txt b/tests/reference/language/array_multidimensional.txt new file mode 100644 index 0000000..4315a89 --- /dev/null +++ b/tests/reference/language/array_multidimensional.txt @@ -0,0 +1,3 @@ +64 +31337 +65535 diff --git a/tests/reference/language/array_outofbounds.bas b/tests/reference/language/array_outofbounds.bas new file mode 100644 index 0000000..652c4e2 --- /dev/null +++ b/tests/reference/language/array_outofbounds.bas @@ -0,0 +1,3 @@ +10 DIM A#(3) +20 PRINT A#(4) +30 PRINT "FAILURE" \ No newline at end of file diff --git a/tests/reference/language/array_outofbounds.txt b/tests/reference/language/array_outofbounds.txt new file mode 100644 index 0000000..177a409 --- /dev/null +++ b/tests/reference/language/array_outofbounds.txt @@ -0,0 +1,2 @@ +? 20 : RUNTIME ERROR Variable index access out of bounds at dimension 0: 4 (max 2) + diff --git a/tests/reference/language/arrays.bas b/tests/reference/language/arrays.bas new file mode 100644 index 0000000..91251b8 --- /dev/null +++ b/tests/reference/language/arrays.bas @@ -0,0 +1,9 @@ +10 DIM A#(3) +20 A#(0) = 100 +30 A#(1) = 101 +40 A#(2) = 102 +50 IF LEN(A#) <> 3 THEN PRINT "LEN(A#) != 3 : " + LEN(A#) + " FAILURE" +60 IF A#(0) <> 100 THEN PRINT "A#(0) != 100 : " + A#(0) + " FAILURE" +70 IF A#(1) <> 101 THEN PRINT "A#(1) != 101 : " + A#(1) + " FAILURE" +80 IF A#(2) <> 102 THEN PRINT "A#(2) != 102 : " + A#(2) + " FAILURE" +90 PRINT "SUCCESS" diff --git a/tests/reference/language/arrays.txt b/tests/reference/language/arrays.txt new file mode 100644 index 0000000..ff43ca4 --- /dev/null +++ b/tests/reference/language/arrays.txt @@ -0,0 +1 @@ +SUCCESS diff --git a/tests/reference/language/caseinsensitivefunctionsandcommands.bas b/tests/reference/language/caseinsensitivefunctionsandcommands.bas new file mode 100644 index 0000000..0edbe80 --- /dev/null +++ b/tests/reference/language/caseinsensitivefunctionsandcommands.bas @@ -0,0 +1,2 @@ +10 print "HELLO" +20 print mod(12, 5) diff --git a/tests/reference/language/caseinsensitivefunctionsandcommands.txt b/tests/reference/language/caseinsensitivefunctionsandcommands.txt new file mode 100644 index 0000000..9aa5e0f --- /dev/null +++ b/tests/reference/language/caseinsensitivefunctionsandcommands.txt @@ -0,0 +1,2 @@ +HELLO +2 diff --git a/tests/reference/language/flowcontrol/forloop.bas b/tests/reference/language/flowcontrol/forloop.bas new file mode 100644 index 0000000..e317701 --- /dev/null +++ b/tests/reference/language/flowcontrol/forloop.bas @@ -0,0 +1,4 @@ +10 FOR I# = 1 TO 4 +20 PRINT I# +30 NEXT I# +40 QUIT \ No newline at end of file diff --git a/tests/reference/language/flowcontrol/forloop.txt b/tests/reference/language/flowcontrol/forloop.txt new file mode 100644 index 0000000..94ebaf9 --- /dev/null +++ b/tests/reference/language/flowcontrol/forloop.txt @@ -0,0 +1,4 @@ +1 +2 +3 +4 diff --git a/tests/reference/language/flowcontrol/forloopwaitingforcommand.bas b/tests/reference/language/flowcontrol/forloopwaitingforcommand.bas new file mode 100644 index 0000000..76f2f4d --- /dev/null +++ b/tests/reference/language/flowcontrol/forloopwaitingforcommand.bas @@ -0,0 +1,13 @@ +10 REM This shows the waitingForCommand utility in the BasicEnvironment +11 REM We have a FOR loop here with a condition where the loop should +12 REM not execute at all. But because the checking of the conditional is +13 REM delayed until the bottom of the loop, we run the risk of the +14 REM runtime executing every line between FOR ... NEXT even though it +15 REM shouldn't. waitingForCommand prevents this from occurring +20 FOR I# = 1 TO 1 +30 PRINT "waitingForCommand FAILS if this is seen" +40 NEXT I# +50 FOR I# = 1 TO 2 +60 PRINT "waitingForCommand PASS if this is seen" +70 NEXT I# +80 QUIT \ No newline at end of file diff --git a/tests/reference/language/flowcontrol/forloopwaitingforcommand.txt b/tests/reference/language/flowcontrol/forloopwaitingforcommand.txt new file mode 100644 index 0000000..c198262 --- /dev/null +++ b/tests/reference/language/flowcontrol/forloopwaitingforcommand.txt @@ -0,0 +1,2 @@ +waitingForCommand PASS if this is seen +waitingForCommand PASS if this is seen diff --git a/tests/reference/language/flowcontrol/goto.bas b/tests/reference/language/flowcontrol/goto.bas new file mode 100644 index 0000000..d369055 --- /dev/null +++ b/tests/reference/language/flowcontrol/goto.bas @@ -0,0 +1,3 @@ +10 GOTO 30 +20 PRINT "FAILURE" +30 PRINT "SUCCESS" diff --git a/tests/reference/language/flowcontrol/goto.txt b/tests/reference/language/flowcontrol/goto.txt new file mode 100644 index 0000000..ff43ca4 --- /dev/null +++ b/tests/reference/language/flowcontrol/goto.txt @@ -0,0 +1 @@ +SUCCESS diff --git a/tests/reference/language/flowcontrol/ifthenelse.bas b/tests/reference/language/flowcontrol/ifthenelse.bas new file mode 100644 index 0000000..34940ca --- /dev/null +++ b/tests/reference/language/flowcontrol/ifthenelse.bas @@ -0,0 +1,11 @@ +10 A# = 1 +20 IF A# == 1 THEN GOTO 30 ELSE GOTO 40 +30 PRINT "A# IS 1" +35 GOTO 50 +45 PRINT "A# IS NOT 1" +50 IF A# == 2 THEN GOTO 60 ELSE GOTO 80 +60 PRINT "A# IS 2" +65 PRINT A# +70 GOTO 90 +80 PRINT "A# IS NOT 2" +90 PRINT "DONE" \ No newline at end of file diff --git a/tests/reference/language/flowcontrol/ifthenelse.txt b/tests/reference/language/flowcontrol/ifthenelse.txt new file mode 100644 index 0000000..f1ced77 --- /dev/null +++ b/tests/reference/language/flowcontrol/ifthenelse.txt @@ -0,0 +1,3 @@ +A# IS 1 +A# IS NOT 2 +DONE diff --git a/tests/reference/language/flowcontrol/nestedforloops.bas b/tests/reference/language/flowcontrol/nestedforloops.bas new file mode 100644 index 0000000..16e6115 --- /dev/null +++ b/tests/reference/language/flowcontrol/nestedforloops.bas @@ -0,0 +1,10 @@ +10 FOR I# = 1 TO 4 +15 PRINT "OUTER : I# IS " + I# +20 FOR J# = 2 TO 3 +23 PRINT "INNER : I# IS " + I# +25 PRINT "INNER : J# IS " + J# +30 PRINT "INNER : I# * J# IS " + (I# * J#) +40 NEXT J# +50 NEXT I# +60 PRINT "DONE" +70 QUIT diff --git a/tests/reference/language/flowcontrol/nestedforloops.txt b/tests/reference/language/flowcontrol/nestedforloops.txt new file mode 100644 index 0000000..2ff3843 --- /dev/null +++ b/tests/reference/language/flowcontrol/nestedforloops.txt @@ -0,0 +1,29 @@ +OUTER : I# IS 1 +INNER : I# IS 1 +INNER : J# IS 2 +INNER : I# * J# IS 2 +INNER : I# IS 1 +INNER : J# IS 3 +INNER : I# * J# IS 3 +OUTER : I# IS 2 +INNER : I# IS 2 +INNER : J# IS 2 +INNER : I# * J# IS 4 +INNER : I# IS 2 +INNER : J# IS 3 +INNER : I# * J# IS 6 +OUTER : I# IS 3 +INNER : I# IS 3 +INNER : J# IS 2 +INNER : I# * J# IS 6 +INNER : I# IS 3 +INNER : J# IS 3 +INNER : I# * J# IS 9 +OUTER : I# IS 4 +INNER : I# IS 4 +INNER : J# IS 2 +INNER : I# * J# IS 8 +INNER : I# IS 4 +INNER : J# IS 3 +INNER : I# * J# IS 12 +DONE diff --git a/tests/reference/language/flowcontrol/nestedforloopwaitingforcommand.bas b/tests/reference/language/flowcontrol/nestedforloopwaitingforcommand.bas new file mode 100644 index 0000000..79be7c0 --- /dev/null +++ b/tests/reference/language/flowcontrol/nestedforloopwaitingforcommand.bas @@ -0,0 +1,11 @@ +10 REM This shows the waitingForCommand utility in the BasicEnvironment +11 REM when we have a nested for loop. The inner loop SHOULD execute, but +12 REM the outer loop should NOT execute. Therefore, neither loop should execute. +20 FOR I# = 1 TO 0 +25 FOR J# = 2 TO 4 +30 PRINT "waitingForCommand FAILS if this is seen" +32 QUIT +35 NEXT J# +40 NEXT I# +50 PRINT "SUCCESS" +80 QUIT \ No newline at end of file diff --git a/tests/reference/language/flowcontrol/nestedforloopwaitingforcommand.txt b/tests/reference/language/flowcontrol/nestedforloopwaitingforcommand.txt new file mode 100644 index 0000000..ff43ca4 --- /dev/null +++ b/tests/reference/language/flowcontrol/nestedforloopwaitingforcommand.txt @@ -0,0 +1 @@ +SUCCESS diff --git a/tests/reference/language/functions.bas b/tests/reference/language/functions.bas new file mode 100644 index 0000000..aa7dfad --- /dev/null +++ b/tests/reference/language/functions.bas @@ -0,0 +1,6 @@ +10 DEF SQR(X#) = X# * X# +20 DEF MUL(X#, Y#) = X# * Y# +30 A# = SQR(3) +40 B# = MUL(A#, 4) +50 IF A# <> 9 THEN PRINT "SQR FAIL" ELSE PRINT "SQR PASS" +60 IF B# <> 36 THEN PRINT "MUL FAIL" ELSE PRINT "MUL PASS" diff --git a/tests/reference/language/functions.txt b/tests/reference/language/functions.txt new file mode 100644 index 0000000..1a9f11c --- /dev/null +++ b/tests/reference/language/functions.txt @@ -0,0 +1,2 @@ +SQR PASS +MUL PASS diff --git a/tests/reference/language/functions/atn.bas b/tests/reference/language/functions/atn.bas new file mode 100644 index 0000000..e5dfc01 --- /dev/null +++ b/tests/reference/language/functions/atn.bas @@ -0,0 +1 @@ +10 PRINT ATN(3) diff --git a/tests/reference/language/functions/atn.txt b/tests/reference/language/functions/atn.txt new file mode 100644 index 0000000..48f1acd --- /dev/null +++ b/tests/reference/language/functions/atn.txt @@ -0,0 +1 @@ +1.249046 diff --git a/tests/reference/language/functions/chr.bas b/tests/reference/language/functions/chr.bas new file mode 100644 index 0000000..f6be40f --- /dev/null +++ b/tests/reference/language/functions/chr.bas @@ -0,0 +1,3 @@ +10 PRINT "97 : " + CHR(97) +20 PRINT "65 : " + CHR(65) +30 PRINT "64 : " + CHR(64) diff --git a/tests/reference/language/functions/chr.txt b/tests/reference/language/functions/chr.txt new file mode 100644 index 0000000..8c7f7b5 --- /dev/null +++ b/tests/reference/language/functions/chr.txt @@ -0,0 +1,3 @@ +97 : a +65 : A +64 : @ diff --git a/tests/reference/language/functions/cos.bas b/tests/reference/language/functions/cos.bas new file mode 100644 index 0000000..4279656 --- /dev/null +++ b/tests/reference/language/functions/cos.bas @@ -0,0 +1 @@ +10 PRINT COS(90) diff --git a/tests/reference/language/functions/cos.txt b/tests/reference/language/functions/cos.txt new file mode 100644 index 0000000..320a485 --- /dev/null +++ b/tests/reference/language/functions/cos.txt @@ -0,0 +1 @@ +-0.448074 diff --git a/tests/reference/language/functions/hex.bas b/tests/reference/language/functions/hex.bas new file mode 100644 index 0000000..87b1fd1 --- /dev/null +++ b/tests/reference/language/functions/hex.bas @@ -0,0 +1 @@ +10 PRINT HEX(255) diff --git a/tests/reference/language/functions/hex.txt b/tests/reference/language/functions/hex.txt new file mode 100644 index 0000000..fcd15ac --- /dev/null +++ b/tests/reference/language/functions/hex.txt @@ -0,0 +1 @@ +ff diff --git a/tests/reference/language/functions/instr.bas b/tests/reference/language/functions/instr.bas new file mode 100644 index 0000000..d80d679 --- /dev/null +++ b/tests/reference/language/functions/instr.bas @@ -0,0 +1,3 @@ +10 X$ = "HELLO" +20 Y$ = "LLO" +30 PRINT INSTR(X$, Y$) diff --git a/tests/reference/language/functions/instr.txt b/tests/reference/language/functions/instr.txt new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/tests/reference/language/functions/instr.txt @@ -0,0 +1 @@ +2 diff --git a/tests/reference/language/functions/left.bas b/tests/reference/language/functions/left.bas new file mode 100644 index 0000000..24a5931 --- /dev/null +++ b/tests/reference/language/functions/left.bas @@ -0,0 +1 @@ +10 PRINT LEFT("HELLO", 2) diff --git a/tests/reference/language/functions/left.txt b/tests/reference/language/functions/left.txt new file mode 100644 index 0000000..3b4bba6 --- /dev/null +++ b/tests/reference/language/functions/left.txt @@ -0,0 +1 @@ +HE diff --git a/tests/reference/language/functions/len.bas b/tests/reference/language/functions/len.bas new file mode 100644 index 0000000..1c671ba --- /dev/null +++ b/tests/reference/language/functions/len.bas @@ -0,0 +1,5 @@ +10 A$ = "HELLO" +20 STRLEN# = LEN(A$) +30 IF STRLEN# == 5 THEN GOTO 50 +40 PRINT "FAILURE" +50 PRINT "SUCCESS" diff --git a/tests/reference/language/functions/len.txt b/tests/reference/language/functions/len.txt new file mode 100644 index 0000000..ff43ca4 --- /dev/null +++ b/tests/reference/language/functions/len.txt @@ -0,0 +1 @@ +SUCCESS diff --git a/tests/reference/language/functions/log.bas b/tests/reference/language/functions/log.bas new file mode 100644 index 0000000..810bcbe --- /dev/null +++ b/tests/reference/language/functions/log.bas @@ -0,0 +1 @@ +10 PRINT LOG(3.14) diff --git a/tests/reference/language/functions/log.txt b/tests/reference/language/functions/log.txt new file mode 100644 index 0000000..47dbaf6 --- /dev/null +++ b/tests/reference/language/functions/log.txt @@ -0,0 +1 @@ +1.144223 diff --git a/tests/reference/language/functions/mid.bas b/tests/reference/language/functions/mid.bas new file mode 100644 index 0000000..9e7511f --- /dev/null +++ b/tests/reference/language/functions/mid.bas @@ -0,0 +1,3 @@ +10 A$ = "HELLO" +20 B$ = MID(A$, 2, 3) +30 PRINT B$ diff --git a/tests/reference/language/functions/mid.txt b/tests/reference/language/functions/mid.txt new file mode 100644 index 0000000..5d0044f --- /dev/null +++ b/tests/reference/language/functions/mid.txt @@ -0,0 +1 @@ +LLO diff --git a/tests/reference/language/functions/mod.bas b/tests/reference/language/functions/mod.bas new file mode 100644 index 0000000..d2d268f --- /dev/null +++ b/tests/reference/language/functions/mod.bas @@ -0,0 +1,6 @@ +10 PRINT MOD(10, 3) +20 PRINT MOD(12, 5) +30 PRINT MOD(4, 2) +40 REM MOD() ONLY WORKS WITH INTEGERS - RESULTS WITH FLOATING POINT ARE UNRELIABLE +50 REM PRINT MOD(1.2, 0.4) +60 REM THERE IS NO ERROR THROWN HERE. JUST DONT DO IT. diff --git a/tests/reference/language/functions/mod.txt b/tests/reference/language/functions/mod.txt new file mode 100644 index 0000000..a384d6e --- /dev/null +++ b/tests/reference/language/functions/mod.txt @@ -0,0 +1,3 @@ +1 +2 +0 diff --git a/tests/reference/language/functions/pointer.bas b/tests/reference/language/functions/pointer.bas new file mode 100644 index 0000000..e1ffcc4 --- /dev/null +++ b/tests/reference/language/functions/pointer.bas @@ -0,0 +1,8 @@ +10 A# = 255 +20 B# = POINTER(A#) +30 IF PEEK(B#) == 255 THEN GOTO 50 +40 PRINT "FAILURE: PEEK != 255" +50 POKE B#, 127 +60 IF PEEK(B#) == 127 THEN GOTO 80 +70 PRINT "FAILURE : POKE DID NOT SET 127" +80 PRINT "SUCCESS" diff --git a/tests/reference/language/functions/pointer.txt b/tests/reference/language/functions/pointer.txt new file mode 100644 index 0000000..ff43ca4 --- /dev/null +++ b/tests/reference/language/functions/pointer.txt @@ -0,0 +1 @@ +SUCCESS diff --git a/tests/reference/language/functions/rad.bas b/tests/reference/language/functions/rad.bas new file mode 100644 index 0000000..93e90e9 --- /dev/null +++ b/tests/reference/language/functions/rad.bas @@ -0,0 +1 @@ +10 PRINT RAD(90) diff --git a/tests/reference/language/functions/rad.txt b/tests/reference/language/functions/rad.txt new file mode 100644 index 0000000..45455f4 --- /dev/null +++ b/tests/reference/language/functions/rad.txt @@ -0,0 +1 @@ +1.570796 diff --git a/tests/reference/language/functions/right.bas b/tests/reference/language/functions/right.bas new file mode 100644 index 0000000..158c86a --- /dev/null +++ b/tests/reference/language/functions/right.bas @@ -0,0 +1,2 @@ +10 PRINT RIGHT("HELLO", 3) +20 PRINT RIGHT("HELLO", 7) diff --git a/tests/reference/language/functions/right.txt b/tests/reference/language/functions/right.txt new file mode 100644 index 0000000..5a8ec4c --- /dev/null +++ b/tests/reference/language/functions/right.txt @@ -0,0 +1,2 @@ +LLO +HELLO diff --git a/tests/reference/language/functions/sgn.bas b/tests/reference/language/functions/sgn.bas new file mode 100644 index 0000000..b836002 --- /dev/null +++ b/tests/reference/language/functions/sgn.bas @@ -0,0 +1,4 @@ +10 X# = -1 +20 PRINT SGN(X#) +30 PRINT SGN(0) +40 PRINT SGN(1) diff --git a/tests/reference/language/functions/sgn.txt b/tests/reference/language/functions/sgn.txt new file mode 100644 index 0000000..6f858bd --- /dev/null +++ b/tests/reference/language/functions/sgn.txt @@ -0,0 +1,3 @@ +-1 +0 +1 diff --git a/tests/reference/language/functions/shl.bas b/tests/reference/language/functions/shl.bas new file mode 100644 index 0000000..d4c1f1d --- /dev/null +++ b/tests/reference/language/functions/shl.bas @@ -0,0 +1,4 @@ +10 A# = 8 +20 B# = SHL(A#, 2) +30 PRINT B# +40 PRINT SHL(8, 2) diff --git a/tests/reference/language/functions/shl.txt b/tests/reference/language/functions/shl.txt new file mode 100644 index 0000000..fc40ae5 --- /dev/null +++ b/tests/reference/language/functions/shl.txt @@ -0,0 +1,2 @@ +32 +32 diff --git a/tests/reference/language/functions/shr.bas b/tests/reference/language/functions/shr.bas new file mode 100644 index 0000000..bb15d55 --- /dev/null +++ b/tests/reference/language/functions/shr.bas @@ -0,0 +1,4 @@ +10 A# = 32 +20 B# = SHR(A#, 2) +30 PRINT B# +40 PRINT SHR(32, 2) diff --git a/tests/reference/language/functions/shr.txt b/tests/reference/language/functions/shr.txt new file mode 100644 index 0000000..226aaf8 --- /dev/null +++ b/tests/reference/language/functions/shr.txt @@ -0,0 +1,2 @@ +8 +8 diff --git a/tests/reference/language/functions/sin.bas b/tests/reference/language/functions/sin.bas new file mode 100644 index 0000000..74797d9 --- /dev/null +++ b/tests/reference/language/functions/sin.bas @@ -0,0 +1 @@ +10 PRINT SIN(90) diff --git a/tests/reference/language/functions/sin.txt b/tests/reference/language/functions/sin.txt new file mode 100644 index 0000000..4b28a90 --- /dev/null +++ b/tests/reference/language/functions/sin.txt @@ -0,0 +1 @@ +0.893997 diff --git a/tests/reference/language/functions/spc.bas b/tests/reference/language/functions/spc.bas new file mode 100644 index 0000000..0c69bb5 --- /dev/null +++ b/tests/reference/language/functions/spc.bas @@ -0,0 +1 @@ +10 PRINT "BASIC IS" + SPC(16) + "FUN" diff --git a/tests/reference/language/functions/spc.txt b/tests/reference/language/functions/spc.txt new file mode 100644 index 0000000..09acb2d --- /dev/null +++ b/tests/reference/language/functions/spc.txt @@ -0,0 +1 @@ +BASIC IS FUN diff --git a/tests/reference/language/functions/str.bas b/tests/reference/language/functions/str.bas new file mode 100644 index 0000000..8d4d39d --- /dev/null +++ b/tests/reference/language/functions/str.bas @@ -0,0 +1,2 @@ +10 X% = -123.456 +20 PRINT STR(X%) diff --git a/tests/reference/language/functions/str.txt b/tests/reference/language/functions/str.txt new file mode 100644 index 0000000..4b54fa5 --- /dev/null +++ b/tests/reference/language/functions/str.txt @@ -0,0 +1 @@ +-123.456000 diff --git a/tests/reference/language/functions/tan.bas b/tests/reference/language/functions/tan.bas new file mode 100644 index 0000000..9cde19c --- /dev/null +++ b/tests/reference/language/functions/tan.bas @@ -0,0 +1 @@ +10 PRINT TAN(90) diff --git a/tests/reference/language/functions/tan.txt b/tests/reference/language/functions/tan.txt new file mode 100644 index 0000000..3aa45a5 --- /dev/null +++ b/tests/reference/language/functions/tan.txt @@ -0,0 +1 @@ +-1.995200 diff --git a/tests/reference/language/functions/val.bas b/tests/reference/language/functions/val.bas new file mode 100644 index 0000000..1828362 --- /dev/null +++ b/tests/reference/language/functions/val.bas @@ -0,0 +1,3 @@ +10 PRINT VAL("32") +20 PRINT VAL("123.456") +30 PRINT VAL("-256") diff --git a/tests/reference/language/functions/val.txt b/tests/reference/language/functions/val.txt new file mode 100644 index 0000000..3eab1c9 --- /dev/null +++ b/tests/reference/language/functions/val.txt @@ -0,0 +1,3 @@ +32.000000 +123.456000 +-256.000000 diff --git a/tests/reference/language/functions/xor.bas b/tests/reference/language/functions/xor.bas new file mode 100644 index 0000000..b093aa3 --- /dev/null +++ b/tests/reference/language/functions/xor.bas @@ -0,0 +1,2 @@ +10 PRINT XOR(50, 10) +20 PRINT XOR(25, 5) diff --git a/tests/reference/language/functions/xor.txt b/tests/reference/language/functions/xor.txt new file mode 100644 index 0000000..2de399a --- /dev/null +++ b/tests/reference/language/functions/xor.txt @@ -0,0 +1,2 @@ +56 +28 diff --git a/tests/reference/language/functions_multiline.bas b/tests/reference/language/functions_multiline.bas new file mode 100644 index 0000000..80652e2 --- /dev/null +++ b/tests/reference/language/functions_multiline.bas @@ -0,0 +1,9 @@ +5 DEF ADDTWO(A#, B#) = A# + B# +10 DEF ADDTWOSR(A#, B#) +20 C# = A# + B# +30 RETURN C# +40 REM PRINT ADDTWO(3, 5) +45 D# = ADDTWO(3, 5) +50 PRINT D# +55 E# = ADDTWOSR(3, 5) +60 PRINT E# diff --git a/tests/reference/language/functions_multiline.txt b/tests/reference/language/functions_multiline.txt new file mode 100644 index 0000000..226aaf8 --- /dev/null +++ b/tests/reference/language/functions_multiline.txt @@ -0,0 +1,2 @@ +8 +8 diff --git a/tests/reference/language/label.bas b/tests/reference/language/label.bas new file mode 100644 index 0000000..55e53ce --- /dev/null +++ b/tests/reference/language/label.bas @@ -0,0 +1,5 @@ +10 I# = 0 +20 LABEL DOITAGAIN +30 I# = I# + 1 +40 IF I# <> 3 THEN GOTO DOITAGAIN +50 PRINT "DONE" diff --git a/tests/reference/language/label.txt b/tests/reference/language/label.txt new file mode 100644 index 0000000..c8e8a13 --- /dev/null +++ b/tests/reference/language/label.txt @@ -0,0 +1 @@ +DONE diff --git a/tests/reference/language/read_data.bas b/tests/reference/language/read_data.bas new file mode 100644 index 0000000..c863a7b --- /dev/null +++ b/tests/reference/language/read_data.bas @@ -0,0 +1,4 @@ +10 READ A$, B# +20 DATA "HELLO", 12345 +30 PRINT A$ +40 PRINT B# diff --git a/tests/reference/language/read_data.txt b/tests/reference/language/read_data.txt new file mode 100644 index 0000000..3704c91 --- /dev/null +++ b/tests/reference/language/read_data.txt @@ -0,0 +1,2 @@ +HELLO +12345