Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of NerfUS by
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 }
Generated on Wed Jul 13 2022 01:51:50 by
1.7.2
