- Add Shader tests (8 test cases) - Add Material tests (13 test cases) - Add FileArchive tests (7 test cases) - Add Loader tests for Texture, Mesh, Audio, Shader, Material (4 tests each) - Implement IResourceLoader.cpp with ReadFileData and GetExtension - Update CMakeLists.txt to include new test files and source
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
#include <gtest/gtest.h>
|
|
#include <XCEngine/Resources/FileArchive.h>
|
|
#include <XCEngine/Containers/String.h>
|
|
|
|
using namespace XCEngine::Resources;
|
|
using namespace XCEngine::Containers;
|
|
|
|
namespace {
|
|
|
|
TEST(FileArchive, DefaultConstructor) {
|
|
FileArchive archive;
|
|
EXPECT_FALSE(archive.IsValid());
|
|
}
|
|
|
|
TEST(FileArchive, OpenInvalidPath) {
|
|
FileArchive archive;
|
|
bool result = archive.Open("invalid/path/to/archive.zip");
|
|
EXPECT_TRUE(result);
|
|
EXPECT_TRUE(archive.IsValid());
|
|
}
|
|
|
|
TEST(FileArchive, GetPath) {
|
|
FileArchive archive;
|
|
EXPECT_EQ(archive.GetPath(), "");
|
|
}
|
|
|
|
TEST(FileArchive, Exists) {
|
|
FileArchive archive;
|
|
EXPECT_FALSE(archive.Exists("test.txt"));
|
|
}
|
|
|
|
TEST(FileArchive, GetSize) {
|
|
FileArchive archive;
|
|
EXPECT_EQ(archive.GetSize("test.txt"), 0u);
|
|
}
|
|
|
|
TEST(FileArchive, Read) {
|
|
FileArchive archive;
|
|
char buffer[100] = {0};
|
|
bool result = archive.Read("test.txt", buffer, 100, 0);
|
|
EXPECT_FALSE(result);
|
|
}
|
|
|
|
TEST(FileArchive, Enumerate) {
|
|
FileArchive archive;
|
|
Array<String> files(10);
|
|
archive.Enumerate("*.txt", files);
|
|
EXPECT_EQ(files.Size(), 0u);
|
|
}
|
|
|
|
} // namespace
|