diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-01-08 00:23:45 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-01-08 00:23:45 +0000 |
commit | 65de7e062b96a0b579ba832ec8e5527528b8fa51 (patch) | |
tree | a718cd0252d548885e82abe10b5ed17342dd15b0 /include/gtest/gtest-message.h | |
parent | 71ab4d054d79146c16d9fae3d6bf9cdaa5ed5b67 (diff) | |
download | gtest-65de7e062b96a0b579ba832ec8e5527528b8fa51.tar.gz gtest-65de7e062b96a0b579ba832ec8e5527528b8fa51.tar.bz2 gtest-65de7e062b96a0b579ba832ec8e5527528b8fa51.tar.xz |
Changes Message() to print double with enough precision by default.
git-svn-id: http://googletest.googlecode.com/svn/trunk@365 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'include/gtest/gtest-message.h')
-rw-r--r-- | include/gtest/gtest-message.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/gtest/gtest-message.h b/include/gtest/gtest-message.h index 6398712..711ef2f 100644 --- a/include/gtest/gtest-message.h +++ b/include/gtest/gtest-message.h @@ -46,6 +46,8 @@ #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ +#include <limits> + #include <gtest/internal/gtest-string.h> #include <gtest/internal/gtest-internal.h> @@ -89,7 +91,11 @@ class Message { // ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's // stack frame leading to huge stack frames in some cases; gcc does not reuse // the stack space. - Message() : ss_(new internal::StrStream) {} + Message() : ss_(new internal::StrStream) { + // By default, we want there to be enough precision when printing + // a double to a Message. + *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2); + } // Copy constructor. Message(const Message& msg) : ss_(new internal::StrStream) { // NOLINT |