You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
naka/src/tests/version.c

37 lines
707 B

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <ints.h>
#include <macros.h>
#include <version.h>
#include <tests.h>
DEFTEST(version_str)
{
const u32 vraw = VERSION(100,200,101,255);
version_t vers = v_rawtoc(vraw);
usize sz = v_ctosn_sz(vers);
TEST_ASSERT(sz > 0);
char verstr[sz+1];
TEST_ASSERT_EQ(v_ctosn(vers, sz+1, verstr), sz);
char* verstr_h;
INFO("Version: 0x%x, raw: 0x%x", vers.raw, vraw);
INFO("Output is: (%lu chars)\t%s", sz, verstr);
INFO("Output is (static):\t%s", v_ctoss(vers));
INFO("Output is (leak):\t\t%s", (verstr_h = v_ctos(vers)));
TEST_ASSERT(verstr_h);
free(verstr_h);
return TEST_OK;
}
RUNTEST_DEBUG(version_str)