EffectLib's 18 units are copied verbatim (Type.h: drop a comment backslash that clang splices into the next enum line). The remaining Utils stubs get the 40250 bodies, so .msf fly data resolve relative .mse attachments, and CPythonResource registers mde/mdatr as 40250 does. login_flow spawns level_up.mse and sees its particle draws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.6 KiB
C++
62 lines
2.6 KiB
C++
#include "EterBase/StdAfx.h"
|
|
#include "EterBase/Utils.h"
|
|
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
int main()
|
|
{
|
|
int failures = 0;
|
|
auto check = [&failures](bool ok, const char *name) {
|
|
if (!ok) {
|
|
std::fprintf(stderr, "FAIL %s\n", name);
|
|
++failures;
|
|
}
|
|
};
|
|
check(MIN(-3, 8) == -3 && MIN(8, -3) == -3, "MIN order/sign");
|
|
check(MAX(-3, 8) == 8 && MAX(8, -3) == 8, "MAX order/sign");
|
|
check(MINMAX(2, -5, 9) == 2, "MINMAX lower");
|
|
check(MINMAX(2, 20, 9) == 9, "MINMAX upper");
|
|
check(MINMAX(9, 4, 2) == 9, "MINMAX reversed bounds");
|
|
check(fMIN(-3.5f, 8.5f) == -3.5f, "fMIN sign");
|
|
check(fMAX(200.0f, 0.0f) == 200.0f, "fMAX camera floor");
|
|
check(fMINMAX(2.0f, -5.0f, 9.0f) == 2.0f, "fMINMAX lower");
|
|
check(fMINMAX(2.0f, 20.0f, 9.0f) == 9.0f, "fMINMAX upper");
|
|
|
|
// Path helpers (40250 bodies): CFlyingData::LoadScriptFile resolves a relative attach .mse against
|
|
// GetOnlyPathName of the .msf unless IsGlobalFileName (a drive letter) says it is already absolute.
|
|
check(std::string(GetOnlyPathName("d:/ymir work/effect/a.msf")) == "d:/ymir work/effect/", "GetOnlyPathName dir");
|
|
check(std::string(GetOnlyPathName("a.msf")).empty(), "GetOnlyPathName bare");
|
|
check(IsGlobalFileName("d:/ymir work/a.mse") && !IsGlobalFileName("etc/a.mse"), "IsGlobalFileName");
|
|
std::string name;
|
|
GetOnlyFileName("d:\\ymir work\\a.mse", name);
|
|
check(name == "a.mse", "GetOnlyFileName backslash");
|
|
std::string path, stem, ext;
|
|
GetFilePathNameExtension("d:/x/y.tar.gz", (int) strlen("d:/x/y.tar.gz"), &path, &stem, &ext);
|
|
check(path == "d:/x/" && stem == "y.tar" && ext == "gz", "GetFilePathNameExtension");
|
|
ext.clear();
|
|
GetFileExtension("a/b.mse", 7, &ext);
|
|
check(ext == "mse", "GetFileExtension");
|
|
char p[64] = {}, n[64] = {}, e[64] = {};
|
|
GetFileNameParts("d:/x/y.dds", 10, p, n, e);
|
|
check(!strcmp(p, "d:/x/") && !strcmp(n, "y") && !strcmp(e, "dds"), "GetFileNameParts");
|
|
std::vector<std::string> tokens;
|
|
check(SplitLine("a \"b c\" d", " ", &tokens) && tokens.size() == 3 && tokens[1] == "b c", "SplitLine quotes");
|
|
std::string except = "a-b-c";
|
|
StringExceptCharacter(&except, "-");
|
|
check(except == "abc", "StringExceptCharacter");
|
|
char indexed[32] = "tex";
|
|
GetIndexingName(indexed, 12);
|
|
GetOldIndexingName(indexed, 7);
|
|
check(!strcmp(indexed, "tex127"), "GetIndexingName/GetOldIndexingName");
|
|
std::string local;
|
|
check(GetLocalFileName("D:\\ymir\\", "d:/ymir/a.dds", &local) && local == "a.dds", "GetLocalFileName");
|
|
int argc = 0;
|
|
PCHAR* argv = CommandLineToArgv(const_cast<PCHAR>("x \"y z\" w"), &argc);
|
|
check(argc == 3 && !strcmp(argv[1], "y z"), "CommandLineToArgv");
|
|
free(argv);
|
|
return failures ? 1 : 0;
|
|
}
|