mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
cunit: initial commit
This commit is contained in:
100
cunit/test_freerdp.c
Normal file
100
cunit/test_freerdp.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* FreeRDP Unit Tests
|
||||
*
|
||||
* Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "CUnit/Basic.h"
|
||||
|
||||
#include "test_color.h"
|
||||
#include "test_libgdi.h"
|
||||
#include "test_librfx.h"
|
||||
#include "test_ntlmssp.h"
|
||||
#include "test_freerdp.h"
|
||||
|
||||
void dump_data(unsigned char * p, int len, int width, char* name)
|
||||
{
|
||||
unsigned char *line = p;
|
||||
int i, thisline, offset = 0;
|
||||
|
||||
printf("\n%s[%d][%d]:\n", name, len / width, width);
|
||||
while (offset < len)
|
||||
{
|
||||
printf("%04x ", offset);
|
||||
thisline = len - offset;
|
||||
if (thisline > width)
|
||||
thisline = width;
|
||||
|
||||
for (i = 0; i < thisline; i++)
|
||||
printf("%02x ", line[i]);
|
||||
|
||||
for (; i < width; i++)
|
||||
printf(" ");
|
||||
|
||||
printf("\n");
|
||||
offset += thisline;
|
||||
line += thisline;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int index = 1;
|
||||
int *pindex = &index;
|
||||
|
||||
if (CU_initialize_registry() != CUE_SUCCESS)
|
||||
return CU_get_error();
|
||||
|
||||
if (argc < *pindex + 1)
|
||||
{
|
||||
add_color_suite();
|
||||
add_libgdi_suite();
|
||||
add_librfx_suite();
|
||||
add_ntlmssp_suite();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*pindex < argc)
|
||||
{
|
||||
if (strcmp("color", argv[*pindex]) == 0)
|
||||
{
|
||||
add_color_suite();
|
||||
}
|
||||
else if (strcmp("libgdi", argv[*pindex]) == 0)
|
||||
{
|
||||
add_libgdi_suite();
|
||||
}
|
||||
else if (strcmp("librfx", argv[*pindex]) == 0)
|
||||
{
|
||||
add_librfx_suite();
|
||||
}
|
||||
else if (strcmp("ntlmssp", argv[*pindex]) == 0)
|
||||
{
|
||||
add_ntlmssp_suite();
|
||||
}
|
||||
|
||||
*pindex = *pindex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
CU_basic_set_mode(CU_BRM_VERBOSE);
|
||||
CU_basic_run_tests();
|
||||
CU_cleanup_registry();
|
||||
|
||||
return CU_get_error();
|
||||
}
|
||||
|
||||
35
cunit/test_freerdp.h
Normal file
35
cunit/test_freerdp.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* FreeRDP Unit Tests
|
||||
*
|
||||
* Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "CUnit/Basic.h"
|
||||
|
||||
#define add_test_suite(name) \
|
||||
CU_pSuite pSuite; \
|
||||
pSuite = CU_add_suite(#name, init_##name##_suite, clean_##name##_suite); \
|
||||
if (pSuite == NULL) { \
|
||||
CU_cleanup_registry(); return CU_get_error(); \
|
||||
}
|
||||
|
||||
#define add_test_function(name) \
|
||||
if (CU_add_test(pSuite, #name, test_##name) == NULL) { \
|
||||
CU_cleanup_registry(); return CU_get_error(); \
|
||||
}
|
||||
|
||||
void dump_data(unsigned char * p, int len, int width, char* name);
|
||||
2982
cunit/test_libgdi.c
Normal file
2982
cunit/test_libgdi.c
Normal file
File diff suppressed because it is too large
Load Diff
47
cunit/test_libgdi.h
Normal file
47
cunit/test_libgdi.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* GDI Unit Tests
|
||||
*
|
||||
* Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "test_freerdp.h"
|
||||
|
||||
int init_libgdi_suite(void);
|
||||
int clean_libgdi_suite(void);
|
||||
int add_libgdi_suite(void);
|
||||
|
||||
void test_gdi_GetDC(void);
|
||||
void test_gdi_CreateCompatibleDC(void);
|
||||
void test_gdi_CreateBitmap(void);
|
||||
void test_gdi_CreateCompatibleBitmap(void);
|
||||
void test_gdi_CreatePen(void);
|
||||
void test_gdi_CreateSolidBrush(void);
|
||||
void test_gdi_CreatePatternBrush(void);
|
||||
void test_gdi_CreateRectRgn(void);
|
||||
void test_gdi_CreateRect(void);
|
||||
void test_gdi_GetPixel(void);
|
||||
void test_gdi_SetPixel(void);
|
||||
void test_gdi_SetROP2(void);
|
||||
void test_gdi_MoveToEx(void);
|
||||
void test_gdi_LineTo(void);
|
||||
void test_gdi_Ellipse(void);
|
||||
void test_gdi_PtInRect(void);
|
||||
void test_gdi_FillRect(void);
|
||||
void test_gdi_BitBlt_32bpp(void);
|
||||
void test_gdi_BitBlt_16bpp(void);
|
||||
void test_gdi_BitBlt_8bpp(void);
|
||||
void test_gdi_ClipCoords(void);
|
||||
void test_gdi_InvalidateRegion(void);
|
||||
Reference in New Issue
Block a user