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.
Dependencies: mbed-rtos mbed HardwareInterface
Fork of NerfUS_cmake_cleanup by
Diff: test/GoogleTestTest.cpp
- Revision:
- 3:aaf84424abb1
diff -r 6e467e4978f9 -r aaf84424abb1 test/GoogleTestTest.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/GoogleTestTest.cpp Sat Feb 04 22:48:36 2017 -0500
@@ -0,0 +1,47 @@
+#include "gtest/gtest.h"
+
+#include <string>
+
+TEST(GoogleTestTest, BasicAssertion)
+{
+ ASSERT_TRUE(true);
+ ASSERT_FALSE(false);
+}
+
+TEST(GoogleTestTest, BinaryComparison)
+{
+ ASSERT_EQ(1, 1);
+ ASSERT_NE(1, 2);
+ ASSERT_LT(1, 2);
+ ASSERT_LE(1, 2);
+ ASSERT_GT(3, 2);
+ ASSERT_GE(3, 2);
+}
+
+TEST(GoogleTestTest, CStringComparison)
+{
+ ASSERT_STREQ("alice", "alice");
+ ASSERT_STRNE("alice", "Alice");
+ ASSERT_STRCASEEQ("alice", "Alice");
+ ASSERT_STRCASENE("alice", "bob");
+}
+
+TEST(GoogleTestTest, StringComparison)
+{
+ ASSERT_EQ(std::string("alice"), std::string("alice"));
+ ASSERT_EQ(std::string("alice"), "alice");
+ ASSERT_EQ("alice", std::string("alice"));
+}
+
+TEST(GoogleTestTest, Exceptions)
+{
+ ASSERT_THROW(throw std::exception(), std::exception);
+ ASSERT_NO_THROW(true);
+}
+
+TEST(GoogleTestTest, FloatingPointsComparison)
+{
+ ASSERT_FLOAT_EQ(1.5f, 1.500000000000000000000000001f);
+ ASSERT_DOUBLE_EQ(1.5, 1.500000000000000000000000001);
+ ASSERT_NEAR(1.5, 1.51, 0.02);
+}
