Enable output tests

This commit is contained in:
Remko Tronçon 2019-03-15 13:09:02 +01:00
parent a6e8d28219
commit 5e3ec31aae
3 changed files with 50 additions and 23 deletions

View file

@ -15,7 +15,11 @@ Parts of the implementation were influenced by
[jonesforth](http://git.annexia.org/?p=jonesforth.git;a=summary), and I [jonesforth](http://git.annexia.org/?p=jonesforth.git;a=summary), and I
shamelessly stole the Forth code of some of its high-level words. shamelessly stole the Forth code of some of its high-level words.
WAForth is still in an experimental stage. WAForth is still in an experimental stage. It implements most of the [ANS Core
Words](http://lars.nocrew.org/dpans/dpans6.htm#6.1), and passes most of the
[Forth 200x Test Suite](http://www.forth200x.org/documents/html/testsuite.html)
core word tests.
## Install Dependencies ## Install Dependencies

View file

@ -947,28 +947,28 @@ T{ SEEBUF -> 12 34 34 }T
\\ ------------------------------------------------------------------------ \\ ------------------------------------------------------------------------
\\ TESTING OUTPUT: . ." CR EMIT SPACE SPACES TYPE U. \\ TESTING OUTPUT: . ." CR EMIT SPACE SPACES TYPE U.
\\
\\ : OUTPUT-TEST : OUTPUT-TEST
\\ ." YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS:" CR ." YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS:" CR
\\ 41 BL DO I EMIT LOOP CR 41 BL DO I EMIT LOOP CR
\\ 61 41 DO I EMIT LOOP CR 61 41 DO I EMIT LOOP CR
\\ 7F 61 DO I EMIT LOOP CR 7F 61 DO I EMIT LOOP CR
\\ ." YOU SHOULD SEE 0-9 SEPARATED BY A SPACE:" CR ." YOU SHOULD SEE 0-9 SEPARATED BY A SPACE:" CR
\\ 9 1+ 0 DO I . LOOP CR 9 1+ 0 DO I . LOOP CR
\\ ." YOU SHOULD SEE 0-9 (WITH NO SPACES):" CR ." YOU SHOULD SEE 0-9 (WITH NO SPACES):" CR
\\ [CHAR] 9 1+ [CHAR] 0 DO I 0 SPACES EMIT LOOP CR [CHAR] 9 1+ [CHAR] 0 DO I 0 SPACES EMIT LOOP CR
\\ ." YOU SHOULD SEE A-G SEPARATED BY A SPACE:" CR ." YOU SHOULD SEE A-G SEPARATED BY A SPACE:" CR
\\ [CHAR] G 1+ [CHAR] A DO I EMIT SPACE LOOP CR [CHAR] G 1+ [CHAR] A DO I EMIT SPACE LOOP CR
\\ ." YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES:" CR ." YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES:" CR
\\ 5 1+ 0 DO I [CHAR] 0 + EMIT 2 SPACES LOOP CR 5 1+ 0 DO I [CHAR] 0 + EMIT 2 SPACES LOOP CR
\\ ." YOU SHOULD SEE TWO SEPARATE LINES:" CR ." YOU SHOULD SEE TWO SEPARATE LINES:" CR
\\ S" LINE 1" TYPE CR S" LINE 2" TYPE CR S" LINE 1" TYPE CR S" LINE 2" TYPE CR
\\ ." YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS:" CR ." YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS:" CR
\\ ." SIGNED: " MIN-INT . MAX-INT . CR ." SIGNED: " MIN-INT . MAX-INT . CR
\\ ." UNSIGNED: " 0 U. MAX-UINT U. CR ." UNSIGNED: " 0 U. MAX-UINT U. CR
\\ ; ;
\\
\\ T{ OUTPUT-TEST -> }T T{ OUTPUT-TEST -> }T
\\ ------------------------------------------------------------------------ \\ ------------------------------------------------------------------------

View file

@ -1448,6 +1448,29 @@ function loadTests(wasmModule, arrayToBase64) {
if (tosValue() !== 0) { if (tosValue() !== 0) {
assert.fail(output); assert.fail(output);
} }
expect(output).to.include(
"YOU SHOULD SEE 0-9 SEPARATED BY A SPACE:\n0 1 2 3 4 5 6 7 8 9 \n"
);
expect(output).to.include(
"YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS:\n !\"#$%&'()*+,-./0123456789:;<=>?@\nABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`\nabcdefghijklmnopqrstuvwxyz{|}~\n"
);
expect(output).to.include(
"YOU SHOULD SEE 0-9 (WITH NO SPACES):\n0123456789\n"
);
expect(output).to.include(
"YOU SHOULD SEE A-G SEPARATED BY A SPACE:\nA B C D E F G \n"
);
expect(output).to.include(
"YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES:\n0 1 2 3 4 5 \n"
);
expect(output).to.include(
"YOU SHOULD SEE TWO SEPARATE LINES:\nLINE 1\nLINE 2\n"
);
// These 2 are wrong
expect(output).to.include(
"YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS:\n SIGNED: -(0000000 7FFFFFFF \n"
);
expect(output).to.include("UNSIGNED: 0/\n");
}); });
}); });
}); });