本文整理汇总了C++中TEST_TYPE函数的典型用法代码示例。如果您正苦于以下问题:C++ TEST_TYPE函数的具体用法?C++ TEST_TYPE怎么用?C++ TEST_TYPE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TEST_TYPE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_test
static int
do_test (void)
{
int result = 0;
#define TEST_TYPE(name) \
printf ("%s: ", #name); \
if (sizeof (name) != sizeof (((name *) 0)->__size)) \
{ \
printf ("expected %zu, is %zu\n", \
sizeof (((name *) 0)->__size), sizeof (name)); \
result = 1; \
} \
else \
puts ("OK")
TEST_TYPE (pthread_mutex_t);
TEST_TYPE (pthread_cond_t);
TEST_TYPE (pthread_rwlock_t);
#define TEST_TYPE2(name, internal) \
printf ("%s: ", #name); \
if (sizeof (((name *) 0)->__size) < sizeof (internal)) \
{ \
printf ("expected %zu, is %zu\n", \
sizeof (((name *) 0)->__size), sizeof (internal)); \
result = 1; \
} \
else \
puts ("OK")
TEST_TYPE2 (pthread_attr_t, struct pthread_attr);
TEST_TYPE2 (pthread_mutexattr_t, struct pthread_mutexattr);
TEST_TYPE2 (pthread_condattr_t, struct pthread_condattr);
TEST_TYPE2 (pthread_rwlockattr_t, struct pthread_rwlockattr);
TEST_TYPE2 (pthread_barrier_t, struct pthread_barrier);
TEST_TYPE2 (pthread_barrierattr_t, struct pthread_barrierattr);
TEST_TYPE2 (sem_t, struct new_sem);
TEST_TYPE2 (sem_t, struct old_sem);
for (size_t i = 0; i < sizeof (types) / sizeof (types[0]); ++i)
if (types[i].expected != types[i].is)
{
printf ("%s: expected %zu, is %zu\n",
types[i].name, types[i].expected, types[i].is);
result = 1;
}
return result;
}
示例2: test_pack_COMM_FAULT_OFFSETS
static void test_pack_COMM_FAULT_OFFSETS(void)
{
/* COMM_FAULT_OFFSETS (pack 4) */
TEST_TYPE(COMM_FAULT_OFFSETS, 4, 2);
TEST_FIELD(COMM_FAULT_OFFSETS, short, CommOffset, 0, 2, 2);
TEST_FIELD(COMM_FAULT_OFFSETS, short, FaultOffset, 2, 2, 2);
}
示例3: test_pack_SCONTEXT_QUEUE
static void test_pack_SCONTEXT_QUEUE(void)
{
/* SCONTEXT_QUEUE (pack 4) */
TEST_TYPE(SCONTEXT_QUEUE, 8, 4);
TEST_FIELD(SCONTEXT_QUEUE, ULONG, NumberOfObjects, 0, 4, 4);
TEST_FIELD(SCONTEXT_QUEUE, NDR_SCONTEXT *, ArrayOfObjects, 4, 4, 4);
}
示例4: test_pack_GOPHER_ASK_ATTRIBUTE_TYPEW
static void test_pack_GOPHER_ASK_ATTRIBUTE_TYPEW(void)
{
/* GOPHER_ASK_ATTRIBUTE_TYPEW (pack 4) */
TEST_TYPE(GOPHER_ASK_ATTRIBUTE_TYPEW, 8, 4);
TEST_FIELD(GOPHER_ASK_ATTRIBUTE_TYPEW, LPCWSTR, QuestionType, 0, 4, 4);
TEST_FIELD(GOPHER_ASK_ATTRIBUTE_TYPEW, LPCWSTR, QuestionText, 4, 4, 4);
}
示例5: test_pack_GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE
static void test_pack_GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE(void)
{
/* GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE (pack 4) */
TEST_TYPE(GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE, 8, 4);
TEST_FIELD(GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE, INT, LowerBound, 0, 4, 4);
TEST_FIELD(GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE, INT, UpperBound, 4, 4, 4);
}
示例6: test_pack_INTERNET_ASYNC_RESULT
static void test_pack_INTERNET_ASYNC_RESULT(void)
{
/* INTERNET_ASYNC_RESULT (pack 4) */
TEST_TYPE(INTERNET_ASYNC_RESULT, 8, 4);
TEST_FIELD(INTERNET_ASYNC_RESULT, DWORD_PTR, dwResult, 0, 4, 4);
TEST_FIELD(INTERNET_ASYNC_RESULT, DWORD, dwError, 4, 4, 4);
}
示例7: test_pack_RPC_PROTSEQ_ENDPOINT
static void test_pack_RPC_PROTSEQ_ENDPOINT(void)
{
/* RPC_PROTSEQ_ENDPOINT (pack 4) */
TEST_TYPE(RPC_PROTSEQ_ENDPOINT, 8, 4);
TEST_FIELD(RPC_PROTSEQ_ENDPOINT, unsigned char*, RpcProtocolSequence, 0, 4, 4);
TEST_FIELD(RPC_PROTSEQ_ENDPOINT, unsigned char*, Endpoint, 4, 4, 4);
}
示例8: test_pack_GOPHER_ABSTRACT_ATTRIBUTE_TYPEW
static void test_pack_GOPHER_ABSTRACT_ATTRIBUTE_TYPEW(void)
{
/* GOPHER_ABSTRACT_ATTRIBUTE_TYPEW (pack 4) */
TEST_TYPE(GOPHER_ABSTRACT_ATTRIBUTE_TYPEW, 8, 4);
TEST_FIELD(GOPHER_ABSTRACT_ATTRIBUTE_TYPEW, LPCWSTR, ShortAbstract, 0, 4, 4);
TEST_FIELD(GOPHER_ABSTRACT_ATTRIBUTE_TYPEW, LPCWSTR, AbstractFile, 4, 4, 4);
}
示例9: test_pack_UUID_VECTOR
static void test_pack_UUID_VECTOR(void)
{
/* UUID_VECTOR (pack 4) */
TEST_TYPE(UUID_VECTOR, 8, 4);
TEST_FIELD(UUID_VECTOR, unsigned long, Count, 0, 4, 4);
TEST_FIELD(UUID_VECTOR, UUID *[1], Uuid, 4, 4, 4);
}
示例10: test_pack_RPC_BINDING_VECTOR
static void test_pack_RPC_BINDING_VECTOR(void)
{
/* RPC_BINDING_VECTOR (pack 4) */
TEST_TYPE(RPC_BINDING_VECTOR, 8, 4);
TEST_FIELD(RPC_BINDING_VECTOR, unsigned long, Count, 0, 4, 4);
TEST_FIELD(RPC_BINDING_VECTOR, RPC_BINDING_HANDLE[1], BindingH, 4, 4, 4);
}
示例11: test_pack_GOPHER_ADMIN_ATTRIBUTE_TYPEW
static void test_pack_GOPHER_ADMIN_ATTRIBUTE_TYPEW(void)
{
/* GOPHER_ADMIN_ATTRIBUTE_TYPEW (pack 4) */
TEST_TYPE(GOPHER_ADMIN_ATTRIBUTE_TYPEW, 8, 4);
TEST_FIELD(GOPHER_ADMIN_ATTRIBUTE_TYPEW, LPCWSTR, Comment, 0, 4, 4);
TEST_FIELD(GOPHER_ADMIN_ATTRIBUTE_TYPEW, LPCWSTR, EmailAddress, 4, 4, 4);
}
示例12: test_pack_INTERNET_CONNECTED_INFO
static void test_pack_INTERNET_CONNECTED_INFO(void)
{
/* INTERNET_CONNECTED_INFO (pack 4) */
TEST_TYPE(INTERNET_CONNECTED_INFO, 8, 4);
TEST_FIELD(INTERNET_CONNECTED_INFO, DWORD, dwConnectedState, 0, 4, 4);
TEST_FIELD(INTERNET_CONNECTED_INFO, DWORD, dwFlags, 4, 4, 4);
}
示例13: test_pack_INTERNET_VERSION_INFO
static void test_pack_INTERNET_VERSION_INFO(void)
{
/* INTERNET_VERSION_INFO (pack 4) */
TEST_TYPE(INTERNET_VERSION_INFO, 8, 4);
TEST_FIELD(INTERNET_VERSION_INFO, DWORD, dwMajorVersion, 0, 4, 4);
TEST_FIELD(INTERNET_VERSION_INFO, DWORD, dwMinorVersion, 4, 4, 4);
}
示例14: test_pack_RPC_VERSION
static void test_pack_RPC_VERSION(void)
{
/* RPC_VERSION (pack 4) */
TEST_TYPE(RPC_VERSION, 4, 2);
TEST_FIELD(RPC_VERSION, unsigned short, MajorVersion, 0, 2, 2);
TEST_FIELD(RPC_VERSION, unsigned short, MinorVersion, 2, 2, 2);
}
示例15: test_pack_RPC_SYNTAX_IDENTIFIER
static void test_pack_RPC_SYNTAX_IDENTIFIER(void)
{
/* RPC_SYNTAX_IDENTIFIER (pack 4) */
TEST_TYPE(RPC_SYNTAX_IDENTIFIER, 20, 4);
TEST_FIELD(RPC_SYNTAX_IDENTIFIER, GUID, SyntaxGUID, 0, 16, 4);
TEST_FIELD(RPC_SYNTAX_IDENTIFIER, RPC_VERSION, SyntaxVersion, 16, 4, 2);
}