NerfUS game coordinator for the Nerf gun firing range

Dependencies:   HardwareInterface mbed-rtos mbed

Fork of NerfUS by NerfUS

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GoogleTestTest.cpp Source File

GoogleTestTest.cpp

00001 #include "gtest/gtest.h"
00002 
00003 #include <string>
00004 
00005 TEST(GoogleTestTest, BasicAssertion)
00006 {
00007     ASSERT_TRUE(true);
00008     ASSERT_FALSE(false);
00009 }
00010 
00011 TEST(GoogleTestTest, BinaryComparison)
00012 {
00013     ASSERT_EQ(1, 1);
00014     ASSERT_NE(1, 2);
00015     ASSERT_LT(1, 2);
00016     ASSERT_LE(1, 2);
00017     ASSERT_GT(3, 2);
00018     ASSERT_GE(3, 2);
00019 }
00020 
00021 TEST(GoogleTestTest, CStringComparison)
00022 {
00023     ASSERT_STREQ("alice", "alice");
00024     ASSERT_STRNE("alice", "Alice");
00025     ASSERT_STRCASEEQ("alice", "Alice");
00026     ASSERT_STRCASENE("alice", "bob");
00027 }
00028 
00029 TEST(GoogleTestTest, StringComparison)
00030 {
00031     ASSERT_EQ(std::string("alice"), std::string("alice"));
00032     ASSERT_EQ(std::string("alice"), "alice");
00033     ASSERT_EQ("alice", std::string("alice"));
00034 }
00035 
00036 TEST(GoogleTestTest, Exceptions)
00037 {
00038     ASSERT_THROW(throw std::exception(), std::exception);
00039     ASSERT_NO_THROW(true);
00040 }
00041 
00042 TEST(GoogleTestTest, FloatingPointsComparison)
00043 {
00044     ASSERT_FLOAT_EQ(1.5f, 1.500000000000000000000000001f);
00045     ASSERT_DOUBLE_EQ(1.5, 1.500000000000000000000000001);
00046     ASSERT_NEAR(1.5, 1.51, 0.02);
00047 }