stuff
This commit is contained in:
parent
2dbfa1b99e
commit
b1230534c5
22 changed files with 547 additions and 429 deletions
65
alyson/tests/ALPath.cpp
Normal file
65
alyson/tests/ALPath.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
//
|
||||
// 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();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue