os-k/src/kaleid/linux/test-common.c

45 lines
1.3 KiB
C

//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Authors: spectral` //
// NeoX //
// //
// Desc: Test file for common/ //
//----------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define KEEP_KALCOMM_TYPES_MINIMAL
#include "common/common.h"
#include "common/string.h"
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
const char *test1 = "test string\n";
char *test2 = malloc(strlen(test1));
char *test3 = malloc(strlen(test1));
printf("1\n");
#undef strlen
assert(strlen("test string") == _osk_strlen("test string"));
#undef strcpy
assert(strcmp(strcpy(test2, test1), _osk_strcpy(test3, test1)) == 0);
// tests done
printf("2\n");
free(test2);
free(test3);
return 0;
}