Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include "gtest/gtest.h"
00042
00043
00044 TEST(Foo, Bar1) {
00045 }
00046
00047 TEST(Foo, Bar2) {
00048 }
00049
00050 TEST(Foo, DISABLED_Bar3) {
00051 }
00052
00053 TEST(Abc, Xyz) {
00054 }
00055
00056 TEST(Abc, Def) {
00057 }
00058
00059 TEST(FooBar, Baz) {
00060 }
00061
00062 class FooTest : public testing::Test {
00063 };
00064
00065 TEST_F(FooTest, Test1) {
00066 }
00067
00068 TEST_F(FooTest, DISABLED_Test2) {
00069 }
00070
00071 TEST_F(FooTest, Test3) {
00072 }
00073
00074 TEST(FooDeathTest, Test1) {
00075 }
00076
00077
00078
00079 class MyType {
00080 public:
00081 explicit MyType(const std::string& a_value) : value_(a_value) {}
00082
00083 const std::string& value() const { return value_; }
00084
00085 private:
00086 std::string value_;
00087 };
00088
00089
00090 void PrintTo(const MyType& x, std::ostream* os) {
00091 *os << x.value();
00092 }
00093
00094 class ValueParamTest : public testing::TestWithParam<MyType> {
00095 };
00096
00097 TEST_P(ValueParamTest, TestA) {
00098 }
00099
00100 TEST_P(ValueParamTest, TestB) {
00101 }
00102
00103 INSTANTIATE_TEST_CASE_P(
00104 MyInstantiation, ValueParamTest,
00105 testing::Values(MyType("one line"),
00106 MyType("two\nlines"),
00107 MyType("a very\nloooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong line")));
00108
00109
00110
00111
00112
00113 class VeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogName {
00114 };
00115
00116 template <typename T>
00117 class TypedTest : public testing::Test {
00118 };
00119
00120 template <typename T, int kSize>
00121 class MyArray {
00122 };
00123
00124 typedef testing::Types<VeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogName,
00125 int*, MyArray<bool, 42> > MyTypes;
00126
00127 TYPED_TEST_CASE(TypedTest, MyTypes);
00128
00129 TYPED_TEST(TypedTest, TestA) {
00130 }
00131
00132 TYPED_TEST(TypedTest, TestB) {
00133 }
00134
00135
00136
00137 template <typename T>
00138 class TypeParamTest : public testing::Test {
00139 };
00140
00141 TYPED_TEST_CASE_P(TypeParamTest);
00142
00143 TYPED_TEST_P(TypeParamTest, TestA) {
00144 }
00145
00146 TYPED_TEST_P(TypeParamTest, TestB) {
00147 }
00148
00149 REGISTER_TYPED_TEST_CASE_P(TypeParamTest, TestA, TestB);
00150
00151 INSTANTIATE_TYPED_TEST_CASE_P(My, TypeParamTest, MyTypes);
00152
00153 int main(int argc, char **argv) {
00154 ::testing::InitGoogleTest(&argc, argv);
00155
00156 return RUN_ALL_TESTS();
00157 }