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 <3ds.h>
|
||||||
|
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
|
#include "test_fs.h"
|
||||||
|
|
||||||
|
static int testCounter = 0;
|
||||||
|
static void (*tests[]) (void) = {
|
||||||
|
FS_TestAll
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -12,38 +18,34 @@ int main()
|
|||||||
gfxInit();
|
gfxInit();
|
||||||
gfxSet3D(false);
|
gfxSet3D(false);
|
||||||
|
|
||||||
superStr[0] = 0;
|
clearScreen();
|
||||||
|
print("Press A to begin...\n");
|
||||||
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)
|
|
||||||
);
|
|
||||||
|
|
||||||
APP_STATUS status;
|
APP_STATUS status;
|
||||||
while ((status=aptGetStatus()) != APP_EXITING) {
|
while ((status = aptGetStatus()) != APP_EXITING) {
|
||||||
switch (status) {
|
if (status == APP_RUNNING) {
|
||||||
case APP_RUNNING:
|
|
||||||
drawFrame();
|
drawFrame();
|
||||||
|
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
if (hidKeysDown() & KEY_B) {
|
if (hidKeysDown() & KEY_B) {
|
||||||
break;
|
break;
|
||||||
} else if (hidKeysDown() & KEY_A) {
|
} else if (hidKeysDown() & KEY_A) {
|
||||||
print("FSUSER_CreateDirectory %08X\n", (unsigned int)
|
clearScreen();
|
||||||
FSUSER_CreateDirectory(NULL, sdmcArchive, FS_makePath(PATH_CHAR, "/new_dir"))
|
|
||||||
);
|
if (testCounter < (sizeof(tests) / sizeof(tests[0]))) {
|
||||||
|
tests[testCounter]();
|
||||||
|
testCounter++;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
print("\n");
|
||||||
case APP_SUSPENDING:
|
print("Press A to continue...\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (status == APP_SUSPENDING) {
|
||||||
aptReturnToMenu();
|
aptReturnToMenu();
|
||||||
break;
|
} else if (status == APP_SLEEPMODE) {
|
||||||
case APP_SLEEPMODE:
|
|
||||||
aptWaitStatusEvent();
|
aptWaitStatusEvent();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -51,6 +53,7 @@ int main()
|
|||||||
gspWaitForEvent(GSPEVENT_VBlank0, false);
|
gspWaitForEvent(GSPEVENT_VBlank0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearScreen();
|
||||||
gfxExit();
|
gfxExit();
|
||||||
hidExit();
|
hidExit();
|
||||||
aptExit();
|
aptExit();
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
|
||||||
char superStr[8192];
|
static char superStr[8192];
|
||||||
static int cnt;
|
static int cnt;
|
||||||
|
|
||||||
static int countLines(const char* str)
|
static int countLines(const char* str)
|
||||||
@ -74,3 +74,9 @@ void print(const char* format, ...)
|
|||||||
|
|
||||||
drawFrame();
|
drawFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearScreen()
|
||||||
|
{
|
||||||
|
superStr[0] = 0;
|
||||||
|
drawFrame();
|
||||||
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#ifndef OUTPUT_H
|
#ifndef OUTPUT_H
|
||||||
#define OUTPUT_H
|
#define OUTPUT_H
|
||||||
|
|
||||||
extern char superStr[];
|
|
||||||
|
|
||||||
void drawFrame();
|
void drawFrame();
|
||||||
void print(const char* format, ...);
|
void print(const char* format, ...);
|
||||||
|
void clearScreen();
|
||||||
|
|
||||||
#endif
|
#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