Phase 0: Referenzdokumente, Fehlerkatalog, Testkorpus, Ratatui-Spike
Entscheidungen festgehalten: TBVM bestaetigt und eingebettet in die Executables; durchgaengig UTF-8 statt CP437 (dokumentierte Abweichung). - docs/: Sprachreferenz, Forms-Referenz, Dateiformate, TBVM-Design - tb-runtime::errors: klassischer Laufzeitfehler-Katalog (implementiert) - tb-ui::screen: 80x25-Unicode-Zellenpuffer mit 16-Farben-Abbildung, Scrollbereich (VIEW PRINT), Letterboxing; Ratatui-Widget + Tests - Spike: cargo run -p tb-ui --example spike (Farben, Unicode, Tasten, Maus) - tests/compat/: erste Referenzprogramme mit byte-genauer Sollausgabe Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
20
tests/compat/README.md
Normal file
20
tests/compat/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Kompatibilitäts-Testkorpus
|
||||
|
||||
Kleine Referenzprogramme mit dokumentierter erwarteter Ausgabe. Jede
|
||||
`name.bas` hat eine `name.out` mit der exakten Konsolenausgabe (UTF-8,
|
||||
LF-Zeilenenden). **Achtung:** PRINT gibt Zahlen mit führendem Leerzeichen
|
||||
(bzw. `-`) und nachgestelltem Leerzeichen aus — auch am Zeilenende. Die
|
||||
`.out`-Dateien enthalten daher signifikante Leerzeichen am Zeilenende;
|
||||
Editoren dürfen sie nicht wegtrimmen; `.gitattributes` schützt die Dateien
|
||||
vor Zeilenenden-Konvertierung.
|
||||
|
||||
Ab Phase 2 führt ein Test-Harness (`cargo test`) jede Datei per
|
||||
`tbdosc run` aus und vergleicht die Ausgabe. Bis dahin dienen die
|
||||
`.out`-Dateien als festgehaltene Verhaltensspezifikation — wo möglich am
|
||||
Vorbild (Emulator) verifiziert, sonst nach Referenzlage rekonstruiert
|
||||
und mit `TODO verify` im Programmkopf markiert.
|
||||
|
||||
Konventionen:
|
||||
- Nur Konsolen-E/A (keine Forms) bis Phase 4
|
||||
- Kein Zufall/Zeit, außer der Test fixiert die Saat (`RANDOMIZE` mit
|
||||
Konstante) bzw. prüft nur Invarianten
|
||||
3
tests/compat/hello.bas
Normal file
3
tests/compat/hello.bas
Normal file
@@ -0,0 +1,3 @@
|
||||
' Minimalfall: PRINT mit String und Zeilenumbruch
|
||||
PRINT "Hallo, Welt!"
|
||||
END
|
||||
1
tests/compat/hello.out
Normal file
1
tests/compat/hello.out
Normal file
@@ -0,0 +1 @@
|
||||
Hallo, Welt!
|
||||
26
tests/compat/kontrollfluss.bas
Normal file
26
tests/compat/kontrollfluss.bas
Normal file
@@ -0,0 +1,26 @@
|
||||
' FOR/NEXT, DO/LOOP, SELECT CASE, GOSUB
|
||||
FOR i% = 1 TO 3
|
||||
PRINT "for"; i%
|
||||
NEXT i%
|
||||
|
||||
n% = 3
|
||||
DO WHILE n% > 0
|
||||
PRINT "do"; n%
|
||||
n% = n% - 1
|
||||
LOOP
|
||||
|
||||
FOR i% = 1 TO 3
|
||||
SELECT CASE i%
|
||||
CASE 1: PRINT "eins"
|
||||
CASE 2 TO 3: PRINT "zwei-drei"
|
||||
CASE ELSE: PRINT "nie"
|
||||
END SELECT
|
||||
NEXT
|
||||
|
||||
GOSUB Unterprogramm
|
||||
PRINT "ende"
|
||||
END
|
||||
|
||||
Unterprogramm:
|
||||
PRINT "gosub"
|
||||
RETURN
|
||||
11
tests/compat/kontrollfluss.out
Normal file
11
tests/compat/kontrollfluss.out
Normal file
@@ -0,0 +1,11 @@
|
||||
for 1
|
||||
for 2
|
||||
for 3
|
||||
do 3
|
||||
do 2
|
||||
do 1
|
||||
eins
|
||||
zwei-drei
|
||||
zwei-drei
|
||||
gosub
|
||||
ende
|
||||
6
tests/compat/printzahlen.bas
Normal file
6
tests/compat/printzahlen.bas
Normal file
@@ -0,0 +1,6 @@
|
||||
' PRINT-Formatierung von Zahlen: führendes Leerzeichen (bzw. -),
|
||||
' nachgestelltes Leerzeichen; Semikolon = direkt anschließen.
|
||||
PRINT 1; 2; 3
|
||||
PRINT -1; -2
|
||||
PRINT 1.5; -2.5
|
||||
END
|
||||
3
tests/compat/printzahlen.out
Normal file
3
tests/compat/printzahlen.out
Normal file
@@ -0,0 +1,3 @@
|
||||
1 2 3
|
||||
-1 -2
|
||||
1.5 -2.5
|
||||
5
tests/compat/printzonen.bas
Normal file
5
tests/compat/printzonen.bas
Normal file
@@ -0,0 +1,5 @@
|
||||
' Komma = Sprung zur nächsten 14-Zeichen-Druckzone
|
||||
PRINT "a", "b", "c"
|
||||
PRINT "1234567890123", "x"
|
||||
PRINT "12345678901234", "x"
|
||||
END
|
||||
3
tests/compat/printzonen.out
Normal file
3
tests/compat/printzonen.out
Normal file
@@ -0,0 +1,3 @@
|
||||
a b c
|
||||
1234567890123 x
|
||||
12345678901234 x
|
||||
12
tests/compat/strings.bas
Normal file
12
tests/compat/strings.bas
Normal file
@@ -0,0 +1,12 @@
|
||||
' Stringfunktionen; LEN zählt Zeichen (UTF-8-Abweichung dokumentiert)
|
||||
s$ = "Terminal Basic"
|
||||
PRINT LEN(s$)
|
||||
PRINT LEFT$(s$, 8)
|
||||
PRINT RIGHT$(s$, 5)
|
||||
PRINT MID$(s$, 10, 3)
|
||||
PRINT INSTR(s$, "Basic")
|
||||
PRINT UCASE$("äöü grüße")
|
||||
PRINT STRING$(5, "*"); SPACE$(3); "|"
|
||||
PRINT CHR$(65); ASC("A")
|
||||
PRINT STR$(42); "|"; VAL(" 12.5abc")
|
||||
END
|
||||
9
tests/compat/strings.out
Normal file
9
tests/compat/strings.out
Normal file
@@ -0,0 +1,9 @@
|
||||
14
|
||||
Terminal
|
||||
Basic
|
||||
Bas
|
||||
10
|
||||
ÄÖÜ GRÜSSE
|
||||
***** |
|
||||
A 65
|
||||
42| 12.5
|
||||
Reference in New Issue
Block a user