Fix build.

This commit is contained in:
Victor Zverovich 2014-06-06 11:14:53 -07:00
parent 5b054ae7b8
commit acf94abffd

View File

@ -28,6 +28,7 @@
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdarg>
#include <cstring>
#include <fstream>
@ -49,7 +50,6 @@ FILE *FOpen(const char *filename, const char *mode) {
#include "util.h"
#include "gtest-extra.h"
#include <math.h>
#include <stdint.h>
#undef min
@ -1229,11 +1229,17 @@ TEST(FormatterTest, FormatDouble) {
EXPECT_EQ("+0000392.6", str(Format("{0:+010.4g}") << 392.65));
}
TEST(FormatterTest, SignBit) {
#ifndef signbit
# define signbit std::signbit
#endif
EXPECT_EQ(1, signbit(-std::numeric_limits<double>::quiet_NaN()));
}
TEST(FormatterTest, FormatNaN) {
double nan = std::numeric_limits<double>::quiet_NaN();
EXPECT_EQ("nan", str(Format("{}") << nan));
EXPECT_EQ("+nan", str(Format("{:+}") << nan));
EXPECT_EQ(1, signbit(-nan));
EXPECT_EQ("-nan", str(Format("{}") << -nan));
EXPECT_EQ(" nan", str(Format("{: }") << nan));
EXPECT_EQ("NAN", str(Format("{:F}") << nan));