+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2003-2007, International Business Machines Corporation and
+ * Copyright (c) 2003-2013, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*
/*
* Macro for assert style tests.
*/
-#define TEST_ASSERT(expr) \
-if (!(expr)) { \
- log_err("FAILED Assertion \"" #expr "\" at %s:%d.\n", __FILE__, __LINE__); \
-}
+#define TEST_ASSERT(expr) UPRV_BLOCK_MACRO_BEGIN { \
+ if (!(expr)) { \
+ log_err("FAILED Assertion \"" #expr "\" at %s:%d.\n", __FILE__, __LINE__); \
+ } \
+} UPRV_BLOCK_MACRO_END
/*
char expectedResult[300];
/* check that local buffers are big enough for the test case */
- if (sizeof(buf) <= bufCap) {
+ if ((int32_t)sizeof(buf) <= bufCap) {
log_err("At file:line %s:%d, requested bufCap too large.\n");
return;
}
va_start(args, line);
memset(buf, 0, sizeof(buf));
len = utrace_vformat(buf, bufCap, indent, format, args);
+ (void)len; /* Suppress set but not used warning. */
/* Check results. */
if (strcmp(expectedResult, buf) != 0) {
static UBool gFnFormatError = FALSE;
static void U_CALLCONV testTraceEntry(const void *context, int32_t fnNumber) {
+ (void)context; // suppress compiler warnings about unused variable
const char *fnName;
const char *bogusFnName;
static void U_CALLCONV testTraceExit(const void *context, int32_t fnNumber,
const char *fmt, va_list args) {
+ (void)context; // suppress compiler warnings about unused variable
char buf[1000];
const char *fnName;
const char *bogusFnName;
static void U_CALLCONV testTraceData(const void *context, int32_t fnNumber, int32_t level,
const char *fmt, va_list args) {
+ // suppress compiler warnings about unused variables
+ (void)context;
+ (void)level;
char buf[1000];
const char *fnName;
const char *bogusFnName;
/* printf(" %s() %s\n", fnName, buf); */
}
-static UConverter * psuedo_ucnv_open(const char *name, UErrorCode * err)
+#if !ENABLE_TRACING_ORIG_VAL
+static UConverter * pseudo_ucnv_open(const char *name, UErrorCode * err)
{
UTRACE_ENTRY_OC(UTRACE_UCNV_LOAD);
UTRACE_EXIT_PTR_STATUS(NULL, *err);
return NULL;
}
-static void psuedo_ucnv_close(UConverter * cnv)
+static void pseudo_ucnv_close(UConverter * cnv)
{
UTRACE_ENTRY_OC(UTRACE_UCNV_UNLOAD);
UTRACE_DATA1(UTRACE_OPEN_CLOSE, "unload converter %p", cnv);
UTRACE_EXIT_VALUE((int32_t)TRUE);
}
-
+#endif
/*
* TestTraceAPI
TEST_ASSERT(U_SUCCESS(status));
ucnv_close(cnv);
#else
- cnv = psuedo_ucnv_open(NULL, &status);
+ cnv = pseudo_ucnv_open(NULL, &status);
TEST_ASSERT(U_SUCCESS(status));
- psuedo_ucnv_close(cnv);
+ pseudo_ucnv_close(cnv);
#endif
TEST_ASSERT(gTraceEntryCount > 0);
TEST_ASSERT(gTraceExitCount > 0);
/* Null ptrs for strings, vectors */
test_format("Null string - %s", 50, 0, "Null string - *NULL*", __LINE__, NULL);
- test_format("Null string - %S", 50, 0, "Null string - *NULL*", __LINE__, NULL);
+ test_format("Null string - %S", 50, 0, "Null string - *NULL*", __LINE__, NULL, -1);
test_format("Null vector - %vc", 50, 0, "Null vector - *NULL* [00000002]", __LINE__, NULL, 2);
test_format("Null vector - %vC", 50, 0, "Null vector - *NULL* [00000002]", __LINE__, NULL, 2);
test_format("Null vector - %vd", 50, 0, "Null vector - *NULL* [00000002]", __LINE__, NULL, 2);