From 2e07085583d2066ce3af14b1a526c8435790917b Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Fri, 24 Dec 2010 12:06:58 -0600 Subject: [PATCH] Testing seek() with file open for reading. --- .../examples/ATS_SD_Seek/ATS_SD_Seek.pde | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libraries/ArduinoTestSuite/examples/ATS_SD_Seek/ATS_SD_Seek.pde b/libraries/ArduinoTestSuite/examples/ATS_SD_Seek/ATS_SD_Seek.pde index 27c7cc545..5b0916ca7 100644 --- a/libraries/ArduinoTestSuite/examples/ATS_SD_Seek/ATS_SD_Seek.pde +++ b/libraries/ArduinoTestSuite/examples/ATS_SD_Seek/ATS_SD_Seek.pde @@ -82,6 +82,24 @@ void setup() f.close(); + f = SD.open("test.txt"); + ATS_PrintTestStatus("SD.open()", f); + if (!f) goto done; + + ATS_PrintTestStatus("position()", f.position() == 0); + ATS_PrintTestStatus("size()", f.size() == 10); + ATS_PrintTestStatus("peek()", f.peek() == 'A'); + ATS_PrintTestStatus("read()", f.read() == 'A'); + + f.seek(4); + + ATS_PrintTestStatus("position()", f.position() == 4); + ATS_PrintTestStatus("size()", f.size() == 10); + ATS_PrintTestStatus("peek()", f.peek() == '4'); + ATS_PrintTestStatus("read()", f.read() == '4'); + + f.close(); + done: ATS_ReportMemoryUsage(startMemoryUsage); ATS_end();