forked from eclipse-wakaama/wakaama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unittests.c
66 lines (56 loc) · 1.79 KB
/
unittests.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*******************************************************************************
*
* Copyright (c) 2015 Bosch Software Innovations GmbH, Germany.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* The Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Bosch Software Innovations GmbH - Please refer to git log
*
*******************************************************************************/
#include <stdio.h>
#include <stdint.h>
#include "CUnit/Basic.h"
#include "tests.h"
// stub function
void * lwm2m_connect_server(uint16_t secObjInstID,
void * userData)
{
return (void *)secObjInstID;
}
void lwm2m_close_connection(void * sessionH,
void * userData)
{
return;
}
CU_ErrorCode add_tests(CU_pSuite pSuite, struct TestTable* testTable)
{
int index;
for (index = 0; NULL != testTable && NULL != testTable[index].name; ++index) {
if (NULL == CU_add_test(pSuite, testTable[index].name, testTable[index].function)) {
fprintf(stderr, "Failed to add test %s\n", testTable[index].name);
return CU_get_error();
}
}
return CUE_SUCCESS;
}
int main()
{
/* initialize the CUnit test registry */
if (CUE_SUCCESS != CU_initialize_registry())
return CU_get_error();
if (CUE_SUCCESS != create_tlv_json_suit()) {
goto exit;
}
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
exit:
CU_cleanup_registry();
return CU_get_error();
}