Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / cunit / test_freerdp.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * FreeRDP Unit Tests
4  *
5  * Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <CUnit/CUnit.h>
24 #include <freerdp/types.h>
25 #include <freerdp/utils/stream.h>
26 #include <freerdp/utils/hexdump.h>
27
28 #define add_test_suite(name) \
29         CU_pSuite pSuite; \
30         pSuite = CU_add_suite(#name, init_##name##_suite, clean_##name##_suite); \
31         if (pSuite == NULL) { \
32                 CU_cleanup_registry(); return CU_get_error(); \
33         }
34
35 #define add_test_function(name) \
36         if (CU_add_test(pSuite, #name, test_##name) == NULL) { \
37                 CU_cleanup_registry(); return CU_get_error(); \
38         }
39
40 void dump_data(unsigned char * p, int len, int width, char* name);
41 void assert_stream(STREAM* s, uint8* data, int length, const char* func, int line);
42
43 #define ASSERT_STREAM(_s, _data, _length) assert_stream(_s, _data, _length, __FUNCTION__, __LINE__)