65 lines
No EOL
1.1 KiB
C++
65 lines
No EOL
1.1 KiB
C++
//
|
|
// Created by n0ffie on 10/02/2025.
|
|
//
|
|
|
|
|
|
#include <alyson.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
// gtests
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
bool test_path(const char* path)
|
|
{
|
|
if (path == NULL)
|
|
return false;
|
|
|
|
ALPath al_path = al_demangle_path(path);
|
|
if (al_path == NULL)
|
|
return false;
|
|
|
|
if (al_path->path == NULL)
|
|
return false;
|
|
|
|
printf("Path: %s\n", al_path->path);
|
|
|
|
char* string = al_mangle_path(al_path);
|
|
if (strcmp(string, path) != 0) {
|
|
printf("%s : %s\n", path, string);
|
|
return false;
|
|
}
|
|
printf("\t%s\n", string);
|
|
free(string);
|
|
|
|
al_destroy_path(al_path);
|
|
return true;
|
|
}
|
|
|
|
void pathEQ_test(const char* string) {
|
|
ALPath al_path = al_demangle_path(string);
|
|
char* s2 = al_mangle_path(al_path);
|
|
EXPECT_STREQ(string, s2);
|
|
free(s2);
|
|
al_destroy_path(al_path);
|
|
}
|
|
|
|
|
|
TEST(PathEqual, normal) {
|
|
pathEQ_test("res://normal:path/this.is");
|
|
}
|
|
|
|
TEST(PathEqual, group_long_type) {
|
|
pathEQ_test("gays://i/love:gays/iam.one/kind.of");
|
|
}
|
|
|
|
TEST(PathEqual, group_type) {
|
|
pathEQ_test("g/es://this/is:shit");
|
|
}
|
|
|
|
int main(int argc, char** argv) {
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
return RUN_ALL_TESTS();
|
|
} |