38 #include <gtest/gtest.h>
56 TEST(CyclesTest, PrefixIncrement)
59 EXPECT_EQ(1, ++cycles);
60 EXPECT_EQ(2, ++cycles);
65 TEST(CyclesTest, PrefixDecrement)
68 EXPECT_EQ(9, --cycles);
69 EXPECT_EQ(8, --cycles);
73 TEST(CyclesTest, InPlaceAddition)
78 EXPECT_EQ(17, cycles);
81 TEST(CyclesTest, GreaterThanLessThan)
85 EXPECT_TRUE(two_cycles > one_cycle);
86 EXPECT_TRUE(one_cycle < two_cycles);
89 TEST(CyclesTest, AddCycles)
93 Cycles added = cycles_1 + cycles_2;
97 TEST(CyclesTest, SubtractCycles)
101 Cycles subtracted = cycles_1 - cycles_2;
102 EXPECT_EQ(24, subtracted);
107 Cycles cycles(1ULL << 40);
108 Cycles cycles_shifted = cycles >> 5;
109 EXPECT_EQ((1ULL << 35), cycles_shifted);
114 Cycles cycles(1ULL << 40);
115 Cycles cycles_shifted = cycles << 20;
116 EXPECT_EQ((1ULL << 60), cycles_shifted);
122 std::ostringstream
ss;
123 ss <<
"The number of cycles is: " << cycles << std::endl;
124 EXPECT_EQ(
"The number of cycles is: 56\n",
ss.str());
131 TEST(MicroPCTest, CheckMicroPCRomBit)
136 TEST(MicroPCTest, RomMicroPCTest)
141 TEST(MicroPCTest, NormalMicroPCTest)
146 TEST(MicroPCTest, IsRomMicroPCTest)
151 TEST(MicroPCTest, IsNotRomMicroPCTest)
176 TEST(TypesTest, floatsToBitsDoubleInput)
178 double val = 0.84023;
182 TEST(TypesTest, floatsToBitsFloatInput)