From e789327c87c66041299ef735506c92d2a6a67bfa Mon Sep 17 00:00:00 2001 From: mgcaret Date: Fri, 13 Mar 2020 23:33:14 -0700 Subject: [PATCH] increase test coverage, now 84% of system words --- test/5.3.2.fs | 6 ++++++ test/5.3.3.fs | 34 ++++++++++++++++++++++++++++++++++ test/5.3.7.6.fs | 12 ++++++++++++ test/7.3.4.fs | 2 ++ test/7.5.3.fs | 13 ++++++++++++- test/byte-load-test.fs | 4 ++++ test/test-manifest.yaml | 13 +++++++++++++ 7 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 test/5.3.2.fs create mode 100644 test/5.3.3.fs create mode 100644 test/5.3.7.6.fs create mode 100644 test/byte-load-test.fs diff --git a/test/5.3.2.fs b/test/5.3.2.fs new file mode 100644 index 0000000..84211e9 --- /dev/null +++ b/test/5.3.2.fs @@ -0,0 +1,6 @@ +testing 5.3.2 Forth FCode Functions + +\ This only tests functions not covered in the 7.3.x tests + + +t{ (cr -> }t diff --git a/test/5.3.3.fs b/test/5.3.3.fs new file mode 100644 index 0000000..4af7969 --- /dev/null +++ b/test/5.3.3.fs @@ -0,0 +1,34 @@ +testing 5.3.3 FCode implementation functions + +\ Only testing built-in functions, it is expected that +\ the remaining Open Firmware specification, if implemented +\ will be done in Forth source or FCode. + +\ Also, OF816 doesn't implement some of the FCode functions +\ as visible words (e.g. new-token, etc.) +\ These are untested by this suite. + +testing 5.3.3.1 Defining new FCode functions + +t{ s" mytrue" ' true (is-user-word) -> }t +t{ fc get-token drop -> ' ferror }t + +600 get-token 2constant old-600 +t{ ' true false 600 set-token -> }t +t{ 600 get-token -> ' true false }t +t{ ' false true 600 set-token -> }t +t{ 600 get-token -> ' false true }t +t{ old-600 600 set-token -> }t +t{ old-600 600 get-token swap >r = r> rot = -> true true }t + +testing 5.3.3.3 Controlling values and defers + +\ BEHAVIOR tested elsewhere, but we'll test here to verify +\ (is-user-word) + +t{ ' mytrue behavior -> ' true }t + +testing OF816 5.3.3-related checks + +\ 0 and ff fcodes should be equivalent +t{ 0 get-token ff get-token swap >r = r> rot = -> true true }t diff --git a/test/5.3.7.6.fs b/test/5.3.7.6.fs new file mode 100644 index 0000000..f790301 --- /dev/null +++ b/test/5.3.7.6.fs @@ -0,0 +1,12 @@ +testing 5.3.7.6 Start and end + +hex + +\ ferror token validated in 5.3.3.x, now let's test +t{ ' ferror catch >r clear r> 0= -> false }t + +\ Fcode: version1 true end0 +: test-fcode " "(fd 08 00 a4 00 00 00 0a a4 00)" ; + +\ covers: $byte-exec +t{ test-fcode drop 1 byte-load -> true }t diff --git a/test/7.3.4.fs b/test/7.3.4.fs index 47c5962..97789d3 100644 --- a/test/7.3.4.fs +++ b/test/7.3.4.fs @@ -61,8 +61,10 @@ t{ ' exit? 0= -> false }t testing 7.3.4.7 String literals +\ covers: " t{ " test" swap 0> -> 4 true }t t{ s" test" swap 0> -> 4 true }t +\ covers: " t{ " test"(41)" swap 0> -> 5 true }t t{ s" testA" drop " test"(41)" comp -> 0 }t diff --git a/test/7.5.3.fs b/test/7.5.3.fs index 7661f01..fce08ed 100644 --- a/test/7.5.3.fs +++ b/test/7.5.3.fs @@ -1,4 +1,15 @@ -testing Dictionary +testing 7.5.3 Dictionary + +testing 7.5.3.1 Dictionary search + +\ not implemented: .calls $sift sifting t{ ' words 0= -> false }t +testing 7.5.3.2 Decompiler + +\ Hard to test properly + +t{ ' see 0= -> false }t +t{ ' (see) 0= -> false }t + diff --git a/test/byte-load-test.fs b/test/byte-load-test.fs new file mode 100644 index 0000000..56fd51c --- /dev/null +++ b/test/byte-load-test.fs @@ -0,0 +1,4 @@ +\ To be tokenized with toke and embedded in the 5.3.7.6 test +version1 true end0 + + diff --git a/test/test-manifest.yaml b/test/test-manifest.yaml index 388e663..8ca9c46 100644 --- a/test/test-manifest.yaml +++ b/test/test-manifest.yaml @@ -69,6 +69,14 @@ load: - tester.fs - 7.5.3.fs +- name: 5.3.2 Forth FCode Functions + load: + - tester.fs + - 5.3.2.fs +- name: 5.3.3 FCode implementation functions + load: + - tester.fs + - 5.3.3.fs - name: 5.3.4.3 Get local arguments load: - tester.fs @@ -85,6 +93,11 @@ load: - tester.fs - 5.3.7.4.fs +- name: 5.3.7.6 Start and end + load: + - tester.fs + - 5.3.7.6.fs + - name: OF816 Words load: - tester.fs