Moved tests + Added more tests + Added memory testing to actions
Run tests / Run tests (push) Failing after 6s
Run tests / Run tests (push) Failing after 6s
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
tests = [
|
||||
'tostr',
|
||||
]
|
||||
|
||||
foreach t : tests
|
||||
exec = executable(t, t+'.c', include_directories: headers_include, c_args: evh_c_args)
|
||||
test(t, exec, suite: 'types')
|
||||
endforeach
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <stdio.h>
|
||||
#include "ev_types.h"
|
||||
#include "ev_numeric.h"
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
int age;
|
||||
char *desc;
|
||||
} Person;
|
||||
|
||||
DEFINE_TOSTR_FUNCTION(Person, PERSON_PRINT)
|
||||
{
|
||||
sprintf(out, "%s:\n\tage: %d\n\tdesc: %s", self->name, self->age, self->desc);
|
||||
}
|
||||
|
||||
TYPEDATA_GEN(Person,
|
||||
TOSTR(PERSON_PRINT),
|
||||
DEFAULT(
|
||||
.name = "sisyphus",
|
||||
.age = 9999,
|
||||
.desc = "One can only imagine him happy"
|
||||
),
|
||||
INVALID(
|
||||
.name = NULL,
|
||||
.age = -1,
|
||||
.desc = NULL
|
||||
)
|
||||
);
|
||||
|
||||
int main()
|
||||
{
|
||||
puts("");
|
||||
char out[256] = {};
|
||||
|
||||
Person sisyphue = EV_DEFAULT(Person);
|
||||
EV_TOSTR(Person)(&sisyphue, out);
|
||||
|
||||
puts(out);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user