forked from github/server
30 lines
794 B
C
30 lines
794 B
C
|
#include <platform.h>
|
||
|
#include "message.h"
|
||
|
|
||
|
#include <CuTest.h>
|
||
|
#include <tests.h>
|
||
|
|
||
|
static void test_mt_new(CuTest *tc)
|
||
|
{
|
||
|
message_type *mt;
|
||
|
test_setup();
|
||
|
mt = mt_new_va("test", "name:string", "number:int", NULL);
|
||
|
CuAssertPtrNotNull(tc, mt);
|
||
|
CuAssertStrEquals(tc, "test", mt->name);
|
||
|
CuAssertIntEquals(tc, 2, mt->nparameters);
|
||
|
CuAssertPtrNotNull(tc, mt->pnames);
|
||
|
CuAssertStrEquals(tc, "name", mt->pnames[0]);
|
||
|
CuAssertStrEquals(tc, "number", mt->pnames[1]);
|
||
|
CuAssertPtrNotNull(tc, mt->types);
|
||
|
CuAssertStrEquals(tc, "string", mt->types[0]->name);
|
||
|
CuAssertStrEquals(tc, "int", mt->types[1]->name);
|
||
|
test_cleanup();
|
||
|
}
|
||
|
|
||
|
CuSuite *get_message_suite(void)
|
||
|
{
|
||
|
CuSuite *suite = CuSuiteNew();
|
||
|
SUITE_ADD_TEST(suite, test_mt_new);
|
||
|
return suite;
|
||
|
}
|