38 #include <gtest/gtest.h>
54 TEST(CyclesTest, PrefixIncrement)
57 EXPECT_EQ(1, ++cycles);
58 EXPECT_EQ(2, ++cycles);
63 TEST(CyclesTest, PrefixDecrement)
66 EXPECT_EQ(9, --cycles);
67 EXPECT_EQ(8, --cycles);
71 TEST(CyclesTest, InPlaceAddition)
76 EXPECT_EQ(17, cycles);
79 TEST(CyclesTest, GreaterThanLessThan)
83 EXPECT_TRUE(two_cycles > one_cycle);
84 EXPECT_TRUE(one_cycle < two_cycles);
87 TEST(CyclesTest, AddCycles)
91 Cycles added = cycles_1 + cycles_2;
95 TEST(CyclesTest, SubtractCycles)
99 Cycles subtracted = cycles_1 - cycles_2;
100 EXPECT_EQ(24, subtracted);
106 Cycles cycles_shifted = cycles >> 5;
107 EXPECT_EQ((1
ULL << 35), cycles_shifted);
113 Cycles cycles_shifted = cycles << 20;
114 EXPECT_EQ((1
ULL << 60), cycles_shifted);
120 std::ostringstream
ss;
121 ss <<
"The number of cycles is: " << cycles << std::endl;
122 EXPECT_EQ(
"The number of cycles is: 56\n",
ss.str());
129 TEST(MicroPCTest, CheckMicroPCRomBit)
134 TEST(MicroPCTest, RomMicroPCTest)
139 TEST(MicroPCTest, NormalMicroPCTest)
144 TEST(MicroPCTest, IsRomMicroPCTest)
149 TEST(MicroPCTest, IsNotRomMicroPCTest)
174 TEST(TypesTest, floatsToBitsDoubleInput)
176 double val = 0.84023;
180 TEST(TypesTest, floatsToBitsFloatInput)