Added better separation of tests, moving the FS tests into source/test_fs
This commit is contained in:
parent
ad56c03d47
commit
fae2f1f821
@ -3,6 +3,12 @@
|
||||
#include <3ds.h>
|
||||
|
||||
#include "output.h"
|
||||
#include "test_fs.h"
|
||||
|
||||
static int testCounter = 0;
|
||||
static void (*tests[]) (void) = {
|
||||
FS_TestAll
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
@ -12,38 +18,34 @@ int main()
|
||||
gfxInit();
|
||||
gfxSet3D(false);
|
||||
|
||||
superStr[0] = 0;
|
||||
|
||||
print("fsInit %08X\n", (unsigned int)
|
||||
fsInit()
|
||||
);
|
||||
|
||||
FS_archive sdmcArchive = { 0x00000009, { PATH_EMPTY, 1, (u8*) "" } };
|
||||
|
||||
print("FSUSER_OpenArchive %08X\n", (unsigned int)
|
||||
FSUSER_OpenArchive(NULL, &sdmcArchive)
|
||||
);
|
||||
clearScreen();
|
||||
print("Press A to begin...\n");
|
||||
|
||||
APP_STATUS status;
|
||||
while ((status = aptGetStatus()) != APP_EXITING) {
|
||||
switch (status) {
|
||||
case APP_RUNNING:
|
||||
if (status == APP_RUNNING) {
|
||||
drawFrame();
|
||||
|
||||
hidScanInput();
|
||||
if (hidKeysDown() & KEY_B) {
|
||||
break;
|
||||
} else if (hidKeysDown() & KEY_A) {
|
||||
print("FSUSER_CreateDirectory %08X\n", (unsigned int)
|
||||
FSUSER_CreateDirectory(NULL, sdmcArchive, FS_makePath(PATH_CHAR, "/new_dir"))
|
||||
);
|
||||
clearScreen();
|
||||
|
||||
if (testCounter < (sizeof(tests) / sizeof(tests[0]))) {
|
||||
tests[testCounter]();
|
||||
testCounter++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case APP_SUSPENDING:
|
||||
print("\n");
|
||||
print("Press A to continue...\n");
|
||||
}
|
||||
|
||||
} else if (status == APP_SUSPENDING) {
|
||||
aptReturnToMenu();
|
||||
break;
|
||||
case APP_SLEEPMODE:
|
||||
} else if (status == APP_SLEEPMODE) {
|
||||
aptWaitStatusEvent();
|
||||
break;
|
||||
}
|
||||
@ -51,6 +53,7 @@ int main()
|
||||
gspWaitForEvent(GSPEVENT_VBlank0, false);
|
||||
}
|
||||
|
||||
clearScreen();
|
||||
gfxExit();
|
||||
hidExit();
|
||||
aptExit();
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "text.h"
|
||||
|
||||
char superStr[8192];
|
||||
static char superStr[8192];
|
||||
static int cnt;
|
||||
|
||||
static int countLines(const char* str)
|
||||
@ -74,3 +74,9 @@ void print(const char* format, ...)
|
||||
|
||||
drawFrame();
|
||||
}
|
||||
|
||||
void clearScreen()
|
||||
{
|
||||
superStr[0] = 0;
|
||||
drawFrame();
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
#ifndef OUTPUT_H
|
||||
#define OUTPUT_H
|
||||
|
||||
extern char superStr[];
|
||||
|
||||
void drawFrame();
|
||||
void print(const char* format, ...);
|
||||
void clearScreen();
|
||||
|
||||
#endif
|
||||
|
45
source/test_fs.c
Normal file
45
source/test_fs.c
Normal file
@ -0,0 +1,45 @@
|
||||
#include "test_fs.h"
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
#include "output.h"
|
||||
|
||||
static FS_archive sdmcArchive;
|
||||
|
||||
void FS_TestAll()
|
||||
{
|
||||
FS_TestInit();
|
||||
FS_TestSdmcOpen();
|
||||
FS_TestSdmcCreateDir();
|
||||
FS_TestSdmcClose();
|
||||
}
|
||||
|
||||
void FS_TestInit()
|
||||
{
|
||||
print("fsInit %08X\n", (unsigned int)
|
||||
fsInit()
|
||||
);
|
||||
}
|
||||
|
||||
void FS_TestSdmcOpen()
|
||||
{
|
||||
sdmcArchive = (FS_archive) { 0x00000009, { PATH_EMPTY, 1, (u8*) "" } };
|
||||
|
||||
print("FSUSER_OpenArchive %08X\n", (unsigned int)
|
||||
FSUSER_OpenArchive(NULL, &sdmcArchive)
|
||||
);
|
||||
}
|
||||
|
||||
void FS_TestSdmcCreateDir()
|
||||
{
|
||||
print("FSUSER_CreateDirectory %08X\n", (unsigned int)
|
||||
FSUSER_CreateDirectory(NULL, sdmcArchive, FS_makePath(PATH_CHAR, "/new_dir"))
|
||||
);
|
||||
}
|
||||
|
||||
void FS_TestSdmcClose()
|
||||
{
|
||||
print("FSUSER_CloseArchive %08X\n", (unsigned int)
|
||||
FSUSER_CloseArchive(NULL, &sdmcArchive)
|
||||
);
|
||||
}
|
22
source/test_fs.h
Normal file
22
source/test_fs.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef TEST_FS_H
|
||||
#define TEST_FS_H
|
||||
|
||||
void FS_TestAll();
|
||||
|
||||
|
||||
void FS_TestInit();
|
||||
|
||||
void FS_TestSdmcOpen();
|
||||
// FS_TestSdmcCreateFile();
|
||||
void FS_TestSdmcRenameFile();
|
||||
void FS_TestSdmcOpenFile();
|
||||
void FS_TestSdmcOpenFileDirectly();
|
||||
void FS_TestSdmcDeleteFile();
|
||||
void FS_TestSdmcCreateDir();
|
||||
// FS_TestSdmcRenameDir();
|
||||
void FS_TestSdmcOpenDir();
|
||||
// FS_TestSdmcDeleteDir();
|
||||
// FS_TestSdmcDeleteDirRecursively();
|
||||
void FS_TestSdmcClose();
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user