summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWan-Teh Chang <wtc@google.com>2015-07-15 14:17:37 -0700
committerWan-Teh Chang <wtc@google.com>2015-07-15 14:17:37 -0700
commitd960f75cf9cdd0d24f3c7cecc32d95afb5137825 (patch)
treed1083552883bb619622c03d5f2f9ccc043d4319e
parentc4958331205cecd12d18efc282de77d02810ffe4 (diff)
downloadnspr-hg-d960f75cf9cdd0d24f3c7cecc32d95afb5137825.tar.gz
Bug 1088790: Conditionally compile the ssize_t test cases for Unix
only. r=ted.
-rw-r--r--pr/tests/prfz.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/pr/tests/prfz.c b/pr/tests/prfz.c
index 30a36222..0c5a4324 100644
--- a/pr/tests/prfz.c
+++ b/pr/tests/prfz.c
@@ -17,11 +17,15 @@ main(int argc, char **argv)
char buffer[128];
size_t unsigned_small = 266;
+#ifdef XP_UNIX
ssize_t signed_small_p = 943;
ssize_t signed_small_n = -1;
+#endif
size_t unsigned_max = SIZE_MAX;
size_t unsigned_min = 0;
+#ifdef XP_UNIX
ssize_t signed_max = SSIZE_MAX;
+#endif
printf("Test: unsigned small '%%zu' : ");
PR_snprintf(buffer, sizeof(buffer), "%zu", unsigned_small);
@@ -31,6 +35,7 @@ main(int argc, char **argv)
}
printf("OK\n");
+#ifdef XP_UNIX
printf("Test: signed small positive '%%zd' : ");
PR_snprintf(buffer, sizeof(buffer), "%zd", signed_small_p);
if (strncmp(buffer, "943", sizeof(buffer)) != 0) {
@@ -38,7 +43,7 @@ main(int argc, char **argv)
return -1;
}
printf("OK\n");
-
+
printf("Test: signed small negative '%%zd' : ");
PR_snprintf(buffer, sizeof(buffer), "%zd", signed_small_n);
if (strncmp(buffer, "-1", sizeof(buffer)) != 0) {
@@ -46,7 +51,8 @@ main(int argc, char **argv)
return -1;
}
printf("OK\n");
-
+#endif
+
printf("Test: 0 '%%zu' : ");
PR_snprintf(buffer, sizeof(buffer), "%zu", unsigned_min);
if (strncmp(buffer, "0", sizeof(buffer)) != 0) {
@@ -62,7 +68,8 @@ main(int argc, char **argv)
return -1;
}
printf("OK\n");
-
+
+#ifdef XP_UNIX
printf("Test: SSIZE_MAX '%%zx' : ");
PR_snprintf(buffer, sizeof(buffer), "%zx", signed_max);
if (*buffer != '7' ||
@@ -71,6 +78,7 @@ main(int argc, char **argv)
return -1;
}
printf("OK\n");
+#endif
return 0;
}