[+] Mini-FS test
This commit is contained in:
parent
1cb883d504
commit
35237b5749
@ -1 +1 @@
|
||||
Subproject commit d67d6b38db245c51b184e3d6a27f3c38c87251b3
|
||||
Subproject commit 3f4cf9387797115b55d4b484bc67bb378090d4cb
|
77
Tests/Public/4. Hello FS/Main.cpp
Normal file
77
Tests/Public/4. Hello FS/Main.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/***
|
||||
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: Main.cpp
|
||||
Date: 2022-2-18
|
||||
Author: Reece
|
||||
***/
|
||||
#include <AuroraRuntime.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(FS, WriteRead)
|
||||
{
|
||||
AuByteBuffer rngbuffer(32);
|
||||
AuByteBuffer inputblob;
|
||||
AuRng::RngFillRange(rngbuffer);
|
||||
|
||||
// Write and read back the RNG blob from a read/writable CWD
|
||||
ASSERT_TRUE(AuIOFS::WriteFile("./test_rng_blob", rngbuffer));
|
||||
ASSERT_TRUE(AuIOFS::ReadFile("./test_rng_blob", inputblob));
|
||||
ASSERT_EQ(inputblob, rngbuffer);
|
||||
|
||||
// Write and read back the RNG blob from a user specific application directory
|
||||
// Defer to brand: Aurora::RuntimeStartInfo#fio.defaultBrand
|
||||
ASSERT_TRUE(AuIOFS::WriteFile("~/my_app_rng_blob", rngbuffer));
|
||||
ASSERT_TRUE(AuIOFS::ReadFile("~/my_app_rng_blob", inputblob));
|
||||
ASSERT_EQ(inputblob, rngbuffer);
|
||||
}
|
||||
|
||||
TEST(FS, WriteCopyRead)
|
||||
{
|
||||
AuByteBuffer rngbuffer(32);
|
||||
AuByteBuffer inputblob;
|
||||
AuRng::RngFillRange(rngbuffer);
|
||||
|
||||
ASSERT_TRUE(AuIOFS::WriteFile("./test_rng_blob_1", rngbuffer));
|
||||
|
||||
AuIOFS::Remove("./test_rng_blob_2");
|
||||
ASSERT_TRUE(AuIOFS::Copy("./test_rng_blob_1", "./test_rng_blob_2"));
|
||||
|
||||
ASSERT_TRUE(AuIOFS::ReadFile("./test_rng_blob_2", inputblob));
|
||||
ASSERT_EQ(inputblob, rngbuffer);
|
||||
}
|
||||
|
||||
TEST(FS, WriteMove)
|
||||
{
|
||||
AuByteBuffer rngbuffer(32);
|
||||
AuByteBuffer inputblob;
|
||||
AuRng::RngFillRange(rngbuffer);
|
||||
|
||||
ASSERT_TRUE(AuIOFS::WriteFile("./test_rng_blob_1", rngbuffer));
|
||||
|
||||
AuIOFS::Remove("./test_rng_blob_2");
|
||||
ASSERT_TRUE(AuIOFS::Relink("./test_rng_blob_1", "./test_rng_blob_2"));
|
||||
ASSERT_FALSE(AuIOFS::FileExists("./test_rng_blob_1"));
|
||||
|
||||
ASSERT_TRUE(AuIOFS::ReadFile("./test_rng_blob_2", inputblob));
|
||||
ASSERT_EQ(inputblob, rngbuffer);
|
||||
}
|
||||
|
||||
TEST(FS, MkDir)
|
||||
{
|
||||
AuIOFS::Remove("./test_dir");
|
||||
ASSERT_FALSE(AuIOFS::DirExists("./test_dir"));
|
||||
ASSERT_TRUE(AuIOFS::DirMk("./test_dir"));
|
||||
ASSERT_TRUE(AuIOFS::DirExists("./test_dir"));
|
||||
ASSERT_TRUE(AuIOFS::Remove("./test_dir"));
|
||||
ASSERT_FALSE(AuIOFS::DirExists("./test_dir"));
|
||||
}
|
||||
|
||||
void RunTests()
|
||||
{
|
||||
Aurora::RuntimeStartInfo info;
|
||||
info.console.fio.enableLogging = false;
|
||||
info.console.forceToolKitWindow = false;
|
||||
info.fio.defaultBrand = "AuSdkBrand";
|
||||
Aurora::RuntimeStart(info);
|
||||
}
|
Loading…
Reference in New Issue
Block a user