mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Some cleanup on file system test, add reset test
This commit is contained in:
@ -17,10 +17,6 @@
|
||||
#include <FS.h>
|
||||
#include "../common/spiffs_mock.h"
|
||||
|
||||
#define SPIFFS_SIZE (64*1024)
|
||||
#define SPIFFS_BLOCK (2*4096)
|
||||
#define SPIFFS_PAGE (512)
|
||||
#define SPIFFS_MOCK_DECLARE(size_kb, block_kb, page_b) SpiffsMock mock(size_kb * 1024, block_kb * 1024, page_b)
|
||||
|
||||
TEST_CASE("FS can begin","[fs]")
|
||||
{
|
||||
@ -45,8 +41,8 @@ TEST_CASE("Files can be written and appended to","[fs]")
|
||||
REQUIRE(SPIFFS.begin());
|
||||
{
|
||||
File f = SPIFFS.open("config1.txt", "w");
|
||||
f.println("file 1");
|
||||
REQUIRE(f);
|
||||
f.println("file 1");
|
||||
}
|
||||
{
|
||||
File f = SPIFFS.open("config1.txt", "a");
|
||||
@ -63,4 +59,22 @@ TEST_CASE("Files can be written and appended to","[fs]")
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Files persist after reset", "[fs]")
|
||||
{
|
||||
SPIFFS_MOCK_DECLARE(1024, 8, 512);
|
||||
REQUIRE(SPIFFS.begin());
|
||||
{
|
||||
File f = SPIFFS.open("config1.txt", "w");
|
||||
REQUIRE(f);
|
||||
f.println("file 1");
|
||||
}
|
||||
SPIFFS_MOCK_RESET();
|
||||
REQUIRE(SPIFFS.begin());
|
||||
{
|
||||
File f = SPIFFS.open("config1.txt", "r");
|
||||
REQUIRE(f);
|
||||
REQUIRE(f.readString() == "file 1\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user