- TEST_SPEC.md: Updated test directory structure to reflect Core/Asset, Core/IO, and Resources/<Type> subdirectories - TEST_SPEC.md: Updated module names and test counts (852 total) - TEST_SPEC.md: Updated build commands for new Resources subdirectories - README.md: Updated engine structure with Core/Asset/ and Core/IO/ - README.md: Updated Resources section with layered architecture - README.md: Updated test coverage table with accurate counts
76 lines
1.8 KiB
C++
76 lines
1.8 KiB
C++
#include <gtest/gtest.h>
|
|
#include <XCEngine/Core/IO/ResourcePackage.h>
|
|
#include <XCEngine/Core/Containers/Array.h>
|
|
#include <XCEngine/Core/Types.h>
|
|
|
|
using namespace XCEngine::Resources;
|
|
using namespace XCEngine::Containers;
|
|
using namespace XCEngine::Core;
|
|
|
|
namespace {
|
|
|
|
TEST(ResourcePackageBuilder, DefaultConstructor) {
|
|
ResourcePackageBuilder builder;
|
|
EXPECT_TRUE(builder.GetOutputPath().Empty());
|
|
EXPECT_EQ(builder.GetProgress(), 0.0f);
|
|
}
|
|
|
|
TEST(ResourcePackageBuilder, SetOutputPath) {
|
|
ResourcePackageBuilder builder;
|
|
builder.SetOutputPath("test.pkg");
|
|
EXPECT_EQ(builder.GetOutputPath(), "test.pkg");
|
|
}
|
|
|
|
TEST(ResourcePackageBuilder, AddFile) {
|
|
ResourcePackageBuilder builder;
|
|
builder.SetOutputPath("test.pkg");
|
|
|
|
bool result = builder.AddFile("nonexistent.txt", "test.txt");
|
|
EXPECT_FALSE(result);
|
|
}
|
|
|
|
TEST(ResourcePackageBuilder, BuildWithoutFiles) {
|
|
ResourcePackageBuilder builder;
|
|
builder.SetOutputPath("test.pkg");
|
|
|
|
bool result = builder.Build();
|
|
EXPECT_FALSE(result);
|
|
}
|
|
|
|
TEST(ResourcePackage, DefaultConstructor) {
|
|
ResourcePackage pkg;
|
|
EXPECT_FALSE(pkg.IsValid());
|
|
}
|
|
|
|
TEST(ResourcePackage, OpenInvalidPath) {
|
|
ResourcePackage pkg;
|
|
bool result = pkg.Open("invalid/path/package.pkg");
|
|
EXPECT_FALSE(result);
|
|
EXPECT_FALSE(pkg.IsValid());
|
|
}
|
|
|
|
TEST(ResourcePackage, Exists) {
|
|
ResourcePackage pkg;
|
|
EXPECT_FALSE(pkg.Exists("test.txt"));
|
|
}
|
|
|
|
TEST(ResourcePackage, GetSize) {
|
|
ResourcePackage pkg;
|
|
EXPECT_EQ(pkg.GetSize("test.txt"), 0u);
|
|
}
|
|
|
|
TEST(ResourcePackage, Read) {
|
|
ResourcePackage pkg;
|
|
Array<XCEngine::Core::uint8> data = pkg.Read("test.txt");
|
|
EXPECT_EQ(data.Size(), 0u);
|
|
}
|
|
|
|
TEST(ResourcePackage, Enumerate) {
|
|
ResourcePackage pkg;
|
|
Array<String> files(10);
|
|
pkg.Enumerate("*.txt", files);
|
|
EXPECT_EQ(files.Size(), 0u);
|
|
}
|
|
|
|
} // namespace
|