FatFS works (read-only, lightly tested).

This commit is contained in:
David Given
2022-08-27 17:43:46 +02:00
parent c9a58e9d57
commit 983f6caf46
14 changed files with 368 additions and 76 deletions

View File

@@ -14,6 +14,7 @@ OBJS += $(OBJDIR)/tests/$1.o
$(call use-library, $(OBJDIR)/tests/$1.exe, $(OBJDIR)/tests/$1.o, LIBFLUXENGINE)
$(call use-library, $(OBJDIR)/tests/$1.exe, $(OBJDIR)/tests/$1.o, LIBARCH)
$(call use-library, $(OBJDIR)/tests/$1.exe, $(OBJDIR)/tests/$1.o, PROTO)
$(call use-library, $(OBJDIR)/tests/$1.exe, $(OBJDIR)/tests/$1.o, FATFS)
endef

View File

@@ -3,45 +3,52 @@
#include "snowhouse/snowhouse.h"
using namespace snowhouse;
static void testJoin()
{
AssertThat(join({}, "/"), Equals(""));
AssertThat(join({"one"}, "/"), Equals("one"));
AssertThat(join({"one", "two"}, "/"), Equals("one/two"));
}
static void testLeftTrim()
{
AssertThat(leftTrimWhitespace("string"), Equals("string"));
AssertThat(leftTrimWhitespace(" string"), Equals("string"));
AssertThat(leftTrimWhitespace(" string "), Equals("string "));
AssertThat(leftTrimWhitespace("string "), Equals("string "));
AssertThat(leftTrimWhitespace("string"), Equals("string"));
AssertThat(leftTrimWhitespace(" string"), Equals("string"));
AssertThat(leftTrimWhitespace(" string "), Equals("string "));
AssertThat(leftTrimWhitespace("string "), Equals("string "));
}
static void testRightTrim()
{
AssertThat(rightTrimWhitespace("string"), Equals("string"));
AssertThat(rightTrimWhitespace(" string"), Equals(" string"));
AssertThat(rightTrimWhitespace(" string "), Equals(" string"));
AssertThat(rightTrimWhitespace("string "), Equals("string"));
AssertThat(rightTrimWhitespace("string"), Equals("string"));
AssertThat(rightTrimWhitespace(" string"), Equals(" string"));
AssertThat(rightTrimWhitespace(" string "), Equals(" string"));
AssertThat(rightTrimWhitespace("string "), Equals("string"));
}
static void testTrim()
{
AssertThat(trimWhitespace("string"), Equals("string"));
AssertThat(trimWhitespace(" string"), Equals("string"));
AssertThat(trimWhitespace(" string "), Equals("string"));
AssertThat(trimWhitespace("string "), Equals("string"));
AssertThat(trimWhitespace("string"), Equals("string"));
AssertThat(trimWhitespace(" string"), Equals("string"));
AssertThat(trimWhitespace(" string "), Equals("string"));
AssertThat(trimWhitespace("string "), Equals("string"));
}
static void testLeafname()
{
AssertThat(getLeafname(""), Equals(""));
AssertThat(getLeafname("filename"), Equals("filename"));
AssertThat(getLeafname("path/filename"), Equals("filename"));
AssertThat(getLeafname("/path/path/filename"), Equals("filename"));
AssertThat(getLeafname(""), Equals(""));
AssertThat(getLeafname("filename"), Equals("filename"));
AssertThat(getLeafname("path/filename"), Equals("filename"));
AssertThat(getLeafname("/path/path/filename"), Equals("filename"));
}
int main(void)
{
testLeftTrim();
testRightTrim();
testTrim();
testLeafname();
return 0;
testJoin();
testLeftTrim();
testRightTrim();
testTrim();
testLeafname();
return 0;
}