mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 21:32:26 +00:00
Port updated tests and binary snapping, with corrected Reals code, from tidy branch.
This commit is contained in:
parent
b1dc7d77e8
commit
ca2cc52a44
221 changed files with 949 additions and 550 deletions
4
src/test/confidence/texts/expected
Normal file
4
src/test/confidence/texts/expected
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
aaa
|
||||
-3.1E+02
|
||||
-311.141504
|
||||
-3.1D+002
|
||||
5
src/test/confidence/texts/test.sh
Normal file
5
src/test/confidence/texts/test.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
. ../testenv.sh
|
||||
$OBECOMP testTexts.mod -m
|
||||
./testTexts >result
|
||||
. ../testresult.sh
|
||||
41
src/test/confidence/texts/testTexts.mod
Normal file
41
src/test/confidence/texts/testTexts.mod
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
(* compile with voc -M testTexts.Mod *)
|
||||
MODULE testTexts;
|
||||
|
||||
IMPORT Texts, Console;
|
||||
|
||||
CONST pi = -311.1415;
|
||||
|
||||
VAR
|
||||
W: Texts.Writer;
|
||||
T: Texts.Text;
|
||||
R: Texts.Reader;
|
||||
ch: CHAR;
|
||||
i: INTEGER;
|
||||
s: ARRAY 1024 OF CHAR;
|
||||
|
||||
BEGIN
|
||||
Texts.OpenWriter(W);
|
||||
|
||||
Texts.WriteString(W, "aaa"); Texts.WriteLn(W);
|
||||
Texts.WriteReal(W, pi, 7); Texts.WriteLn(W);
|
||||
Texts.WriteRealFix(W, pi, 0, 7); Texts.WriteLn(W);
|
||||
Texts.WriteLongReal(W, pi, 7); Texts.WriteLn(W);
|
||||
|
||||
NEW(T); Texts.Open(T, "test.txt");
|
||||
|
||||
Texts.Append(T, W.buf);
|
||||
(*Texts.Store(W, T);*)
|
||||
|
||||
Texts.OpenReader(R, T, 0);
|
||||
Texts.Read(R, ch);
|
||||
i := 0;
|
||||
WHILE ~R.eot DO
|
||||
IF ch = 0DX THEN
|
||||
s[i] := 0X; i := 0; Console.String(s); Console.Ln
|
||||
ELSE
|
||||
s[i] := ch; INC(i)
|
||||
END;
|
||||
Texts.Read(R, ch)
|
||||
END;
|
||||
s[i] := 0X; (*Console.String(s)*)
|
||||
END testTexts.
|
||||
Loading…
Add table
Add a link
Reference in a new issue