danalbert created this revision.
num_put::put uses %p for pointer types, but the exact format of %p is
implementation defined behavior for the C library. Compare output to
snprintf for portability.
Repository:
rL LLVM
https://reviews.llvm.org/D29197
Files:
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
Index:
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
===================================================================
---
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
+++
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
@@ -38,6 +38,12 @@
char str[50];
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios,
'*', v);
std::string ex(str, iter.base());
- assert(ex == "0x0" || ex == "(nil)");
+ char expected_str[32] = {};
+ // num_put::put uses %p for pointer types, but the exact format of %p
is
+ // implementation defined behavior for the C library. Compare output to
+ // snprintf for portability.
+ int rc = snprintf(expected_str, sizeof(expected_str), "%p", v);
+ assert(rc > 0);
+ assert(ex == expected_str);
}
}
Index: test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
===================================================================
--- test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
+++ test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
@@ -38,6 +38,12 @@
char str[50];
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "0x0" || ex == "(nil)");
+ char expected_str[32] = {};
+ // num_put::put uses %p for pointer types, but the exact format of %p is
+ // implementation defined behavior for the C library. Compare output to
+ // snprintf for portability.
+ int rc = snprintf(expected_str, sizeof(expected_str), "%p", v);
+ assert(rc > 0);
+ assert(ex == expected_str);
}
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits