16#include <gtest/gtest.h>
21TEST(TrackFindingCDCTest, cpp_float)
23 EXPECT_TRUE(std::signbit(-0.0));
24 EXPECT_FALSE(std::signbit(0.0));
25 EXPECT_FALSE(std::signbit(NAN));
28TEST(TrackFindingCDCTest, cpp_max)
33 double maximum = std::max(NAN, value);
34 EXPECT_TRUE(std::isnan(maximum));
36 double maximum2 = std::max(value, NAN);
37 EXPECT_EQ(value, maximum2);
40TEST(TrackFindingCDCTest, cpp_array_init)
42 float values[10] = {};
43 for (
int i = 0; i < 10; ++i) {
44 EXPECT_EQ(0, values[i]);
48TEST(TrackFindingCDCTest, cpp_char_is_signed)
51 EXPECT_GT(0, isSigned);
54TEST(TrackFindingCDCTest, cpp_stringstream_copy)
57 std::stringstream filled_non_const;
58 filled_non_const <<
"filled "
62 const std::stringstream& filled = filled_non_const;
64 std::stringstream copy1;
65 copy1 << filled.rdbuf();
66 filled.rdbuf()->pubseekpos(0, std::ios_base::in);
68 std::stringstream copy2;
69 copy2 << filled.rdbuf();
70 filled.rdbuf()->pubseekpos(0, std::ios_base::in);
72 EXPECT_EQ(filled.str(), copy1.str());
73 EXPECT_EQ(filled.str(), copy2.str());
76TEST(TrackFindingCDCTest, cpp_map_insert)
78 std::map<int, int> defaults{{1, 1}, {2, 2}};
80 std::map<int, int> concret{{1, 10}};
82 concret.insert(defaults.begin(), defaults.end());
85 EXPECT_EQ(10, concret[1]);
88 EXPECT_EQ(2, concret[2]);
91TEST(TrackFindingCDCTest, cpp_remainder)
96 double value = 3.0 / 2.0;
97 double reduced_value = std::remainder(value, 2.0);
99 EXPECT_FLOAT_EQ(-1.0 / 2.0, reduced_value);
103 double value = -3.0 / 2.0;
104 double reduced_value = std::remainder(value, 2.0);
106 EXPECT_FLOAT_EQ(1.0 / 2.0, reduced_value);