tests: add test_platform__compiler()

This commit is contained in:
Hugues Delorme 2015-04-09 18:19:39 +02:00
parent f66e35638d
commit 08767a0b1d

View File

@ -18,9 +18,11 @@
#include "utest_lib.h" #include "utest_lib.h"
#include "../src/gmio_core/global.h" #include "../src/gmio_core/global.h"
#include "../src/gmio_core/transfer.h"
#include "../src/gmio_stl/stl_triangle.h" #include "../src/gmio_stl/stl_triangle.h"
#include <stddef.h> #include <stddef.h>
#include <string.h>
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(push) # pragma warning(push)
@ -61,6 +63,30 @@ const char* test_platform__global_h()
return NULL; return NULL;
} }
const char* test_platform__compiler()
{
/* Check that initialization with { 0 } works as expected */
const gmio_transfer_t trsf_null_bracket0 = { 0 };
gmio_transfer_t trsf_null_memset0;
memset(&trsf_null_memset0, 0, sizeof(gmio_transfer_t));
UTEST_ASSERT(memcmp(
&trsf_null_bracket0,
&trsf_null_memset0,
sizeof(gmio_transfer_t))
== 0);
UTEST_ASSERT(sizeof(gmio_transfer_t) >= (sizeof(gmio_stream_t)
+ sizeof(gmio_buffer_t)
+ sizeof(gmio_task_iface_t)));
/* GeomIO doesn't support platforms where NULL != 0 */
UTEST_ASSERT(NULL == 0);
return NULL;
}
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(pop) # pragma warning(pop)
#endif #endif
@ -70,6 +96,7 @@ const char* all_tests()
UTEST_SUITE_START(); UTEST_SUITE_START();
UTEST_RUN(test_platform__alignment); UTEST_RUN(test_platform__alignment);
UTEST_RUN(test_platform__global_h); UTEST_RUN(test_platform__global_h);
UTEST_RUN(test_platform__compiler);
return NULL; return NULL;
} }