From 5e3ec31aae1aeb965061500acfd0054437a0bf7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Fri, 15 Mar 2019 13:09:02 +0100 Subject: [PATCH] Enable output tests --- README.md | 6 +++- tests/standard-testsuite/core.f.js | 44 +++++++++++++++--------------- tests/tests.js | 23 ++++++++++++++++ 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index ba170eb..9adebf4 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,11 @@ Parts of the implementation were influenced by [jonesforth](http://git.annexia.org/?p=jonesforth.git;a=summary), and I 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 diff --git a/tests/standard-testsuite/core.f.js b/tests/standard-testsuite/core.f.js index 8c450a1..acfaae5 100644 --- a/tests/standard-testsuite/core.f.js +++ b/tests/standard-testsuite/core.f.js @@ -947,28 +947,28 @@ T{ SEEBUF -> 12 34 34 }T \\ ------------------------------------------------------------------------ \\ TESTING OUTPUT: . ." CR EMIT SPACE SPACES TYPE U. -\\ -\\ : OUTPUT-TEST -\\ ." YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS:" CR -\\ 41 BL DO I EMIT LOOP CR -\\ 61 41 DO I EMIT LOOP CR -\\ 7F 61 DO I EMIT LOOP CR -\\ ." YOU SHOULD SEE 0-9 SEPARATED BY A SPACE:" CR -\\ 9 1+ 0 DO I . LOOP CR -\\ ." YOU SHOULD SEE 0-9 (WITH NO SPACES):" CR -\\ [CHAR] 9 1+ [CHAR] 0 DO I 0 SPACES EMIT LOOP CR -\\ ." YOU SHOULD SEE A-G SEPARATED BY A SPACE:" CR -\\ [CHAR] G 1+ [CHAR] A DO I EMIT SPACE LOOP CR -\\ ." YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES:" CR -\\ 5 1+ 0 DO I [CHAR] 0 + EMIT 2 SPACES LOOP CR -\\ ." YOU SHOULD SEE TWO SEPARATE LINES:" CR -\\ S" LINE 1" TYPE CR S" LINE 2" TYPE CR -\\ ." YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS:" CR -\\ ." SIGNED: " MIN-INT . MAX-INT . CR -\\ ." UNSIGNED: " 0 U. MAX-UINT U. CR -\\ ; -\\ -\\ T{ OUTPUT-TEST -> }T + +: OUTPUT-TEST + ." YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS:" CR + 41 BL DO I EMIT LOOP CR + 61 41 DO I EMIT LOOP CR + 7F 61 DO I EMIT LOOP CR + ." YOU SHOULD SEE 0-9 SEPARATED BY A SPACE:" CR + 9 1+ 0 DO I . LOOP CR + ." YOU SHOULD SEE 0-9 (WITH NO SPACES):" CR + [CHAR] 9 1+ [CHAR] 0 DO I 0 SPACES EMIT LOOP CR + ." YOU SHOULD SEE A-G SEPARATED BY A SPACE:" CR + [CHAR] G 1+ [CHAR] A DO I EMIT SPACE LOOP CR + ." YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES:" CR + 5 1+ 0 DO I [CHAR] 0 + EMIT 2 SPACES LOOP CR + ." YOU SHOULD SEE TWO SEPARATE LINES:" CR + S" LINE 1" TYPE CR S" LINE 2" TYPE CR + ." YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS:" CR + ." SIGNED: " MIN-INT . MAX-INT . CR + ." UNSIGNED: " 0 U. MAX-UINT U. CR +; + +T{ OUTPUT-TEST -> }T \\ ------------------------------------------------------------------------ diff --git a/tests/tests.js b/tests/tests.js index 2d83823..e5b12c9 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -1448,6 +1448,29 @@ function loadTests(wasmModule, arrayToBase64) { if (tosValue() !== 0) { 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"); }); }); });