From dce5a0ecb54d41952462a0195b60fe1b590fe605 Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Thu, 9 Dec 2021 08:20:25 +0900 Subject: [PATCH] Add test/fileio.fs --- runtests.fs | 1 + test/fileio-test0.txt | 1 + test/fileio.fs | 15 +++++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 test/fileio-test0.txt create mode 100644 test/fileio.fs diff --git a/runtests.fs b/runtests.fs index addc706..cb89eb4 100644 --- a/runtests.fs +++ b/runtests.fs @@ -11,6 +11,7 @@ include lib/tester.fs include test/core.fs include test/utilities.fs include test/coreexttest.fs +include test/fileio.fs include test/export.fs include lib/string.fs diff --git a/test/fileio-test0.txt b/test/fileio-test0.txt new file mode 100644 index 0000000..72d007b --- /dev/null +++ b/test/fileio-test0.txt @@ -0,0 +1 @@ +ABCDEFGHIJKLMNOPQRSTUVWXYZ diff --git a/test/fileio.fs b/test/fileio.fs new file mode 100644 index 0000000..d6af3b1 --- /dev/null +++ b/test/fileio.fs @@ -0,0 +1,15 @@ +\ planckforth - +\ Copyright (C) 2021 nineties + +testing file I/O + +T{ + s" test/fileio-test0.txt" R/O open-file throw + constant FILE0 -> +}T +T{ 32 allocate throw constant BUF -> }T +T{ BUF 32 FILE0 read-file throw -> 27 }T +T{ s" ABCDEFGHIJKLMNOPQRSTUVWXYZ +" BUF 27 strneq -> true }T +T{ FILE0 close-file throw -> }T +T{ BUF free -> }T