Added some tests for sharedlibrary

This commit is contained in:
Pijus Kamandulis
2024-12-19 23:21:45 +02:00
parent be7a615931
commit 363f822e5a
11 changed files with 276 additions and 24 deletions

View File

@@ -0,0 +1,26 @@
#include "shared.h"
void test_CreateServerInstance()
{
typedef int (*CreateServerInstanceFn)(char *, char *);
CreateServerInstanceFn CreateServerInstance = (CreateServerInstanceFn)load_function("CreateServerInstance");
if (!CreateServerInstance)
{
fprintf(stderr, "Failed to find CreateServerInstance function\n");
return;
}
char *serverName = "TestServer";
char *configJSON = "{\"host\":\"localhost\",\"port\":8080}";
int result = CreateServerInstance(serverName, configJSON);
if (result == 0)
{
printf("CreateServerInstance: SUCCESS\n");
}
else
{
printf("CreateServerInstance: FAILED (result = %d)\n", result);
}
}