mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Adding SD tests, removing clean.bat.
This commit is contained in:
@ -0,0 +1,78 @@
|
||||
#include <SD.h>
|
||||
#include <ArduinoTestSuite.h>
|
||||
|
||||
void setup()
|
||||
{
|
||||
int startMemoryUsage = ATS_GetFreeMemory();
|
||||
boolean b;
|
||||
File f;
|
||||
|
||||
ATS_begin("Arduino", "SD Files Test");
|
||||
|
||||
ATS_PrintTestStatus("SD.begin()", b = SD.begin(4));
|
||||
if (!b) goto done;
|
||||
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf.txt"));
|
||||
ATS_PrintTestStatus("SD.open()", f = SD.open("asdf.txt", true)); f.close();
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf.txt"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("/asdf.txt"));
|
||||
ATS_PrintTestStatus("SD.remove()", SD.remove("asdf.txt"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf.txt"));
|
||||
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf"));
|
||||
ATS_PrintTestStatus("SD.mkdir()", SD.mkdir("asdf"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("/asdf"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf/"));
|
||||
ATS_PrintTestStatus("SD.rmdir()", SD.rmdir("asdf"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf"));
|
||||
|
||||
ATS_PrintTestStatus("SD.mkdir()", SD.mkdir("x/y/z"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("x"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("x/"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("x/y"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("x/y/"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("x/y/z"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("x/y/z/"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("/x/y/z/"));
|
||||
ATS_PrintTestStatus("SD.rmdir()", SD.rmdir("x/y/z"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("x"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("x/y"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("x/y/z"));
|
||||
ATS_PrintTestStatus("SD.rmdir()", SD.rmdir("x/y/"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("x"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("x/y"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("x/y/z"));
|
||||
ATS_PrintTestStatus("SD.rmdir()", SD.rmdir("/x"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("x"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("x/y"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("x/y/z"));
|
||||
|
||||
ATS_PrintTestStatus("!SD.open()", !(f = SD.open("asdf/asdf.txt", true))); f.close();
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf.txt"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf/asdf.txt"));
|
||||
ATS_PrintTestStatus("SD.mkdir()", SD.mkdir("asdf"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf"));
|
||||
ATS_PrintTestStatus("SD.open()", f = SD.open("asdf/asdf.txt", true)); f.close();
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf/asdf.txt"));
|
||||
ATS_PrintTestStatus("!SD.rmdir()", !SD.rmdir("asdf"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf/asdf.txt"));
|
||||
ATS_PrintTestStatus("SD.remove()", SD.remove("asdf/asdf.txt"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf/asdf.txt"));
|
||||
ATS_PrintTestStatus("SD.exists()", SD.exists("asdf"));
|
||||
ATS_PrintTestStatus("SD.rmdir()", SD.rmdir("asdf"));
|
||||
ATS_PrintTestStatus("!SD.exists()", !SD.exists("asdf"));
|
||||
|
||||
done:
|
||||
ATS_ReportMemoryUsage(startMemoryUsage);
|
||||
ATS_end();
|
||||
|
||||
}
|
||||
|
||||
void loop() {}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user