"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "googletest/samples/sample6_unittest.cc" between
googletest-release-1.10.0.tar.gz and googletest-release-1.11.0.tar.gz

About: GoogleTest is Google's (unit) testing and mocking framework for C++ tests.

sample6_unittest.cc  (googletest-release-1.10.0):sample6_unittest.cc  (googletest-release-1.11.0)
skipping to change at line 75 skipping to change at line 75
// Note that we test an implementation via the base interface // Note that we test an implementation via the base interface
// instead of the actual implementation class. This is important // instead of the actual implementation class. This is important
// for keeping the tests close to the real world scenario, where the // for keeping the tests close to the real world scenario, where the
// implementation is invoked via the base interface. It avoids // implementation is invoked via the base interface. It avoids
// got-yas where the implementation class has a method that shadows // got-yas where the implementation class has a method that shadows
// a method with the same name (but slightly different argument // a method with the same name (but slightly different argument
// types) in the base interface, for example. // types) in the base interface, for example.
PrimeTable* const table_; PrimeTable* const table_;
}; };
#if GTEST_HAS_TYPED_TEST
using testing::Types; using testing::Types;
// Google Test offers two ways for reusing tests for different types. // Google Test offers two ways for reusing tests for different types.
// The first is called "typed tests". You should use it if you // The first is called "typed tests". You should use it if you
// already know *all* the types you are gonna exercise when you write // already know *all* the types you are gonna exercise when you write
// the tests. // the tests.
// To write a typed test case, first use // To write a typed test case, first use
// //
// TYPED_TEST_SUITE(TestCaseName, TypeList); // TYPED_TEST_SUITE(TestCaseName, TypeList);
skipping to change at line 136 skipping to change at line 134
EXPECT_EQ(5, this->table_->GetNextPrime(3)); EXPECT_EQ(5, this->table_->GetNextPrime(3));
EXPECT_EQ(7, this->table_->GetNextPrime(5)); EXPECT_EQ(7, this->table_->GetNextPrime(5));
EXPECT_EQ(11, this->table_->GetNextPrime(7)); EXPECT_EQ(11, this->table_->GetNextPrime(7));
EXPECT_EQ(131, this->table_->GetNextPrime(128)); EXPECT_EQ(131, this->table_->GetNextPrime(128));
} }
// That's it! Google Test will repeat each TYPED_TEST for each type // That's it! Google Test will repeat each TYPED_TEST for each type
// in the type list specified in TYPED_TEST_SUITE. Sit back and be // in the type list specified in TYPED_TEST_SUITE. Sit back and be
// happy that you don't have to define them multiple times. // happy that you don't have to define them multiple times.
#endif // GTEST_HAS_TYPED_TEST
#if GTEST_HAS_TYPED_TEST_P
using testing::Types; using testing::Types;
// Sometimes, however, you don't yet know all the types that you want // Sometimes, however, you don't yet know all the types that you want
// to test when you write the tests. For example, if you are the // to test when you write the tests. For example, if you are the
// author of an interface and expect other people to implement it, you // author of an interface and expect other people to implement it, you
// might want to write a set of tests to make sure each implementation // might want to write a set of tests to make sure each implementation
// conforms to some basic requirements, but you don't know what // conforms to some basic requirements, but you don't know what
// implementations will be written in the future. // implementations will be written in the future.
// //
// How can you write the tests without committing to the type // How can you write the tests without committing to the type
skipping to change at line 222 skipping to change at line 216
// become part of the test case name and can be used in test filters. // become part of the test case name and can be used in test filters.
// The list of types we want to test. Note that it doesn't have to be // The list of types we want to test. Note that it doesn't have to be
// defined at the time we write the TYPED_TEST_P()s. // defined at the time we write the TYPED_TEST_P()s.
typedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable> typedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable>
PrimeTableImplementations; PrimeTableImplementations;
INSTANTIATE_TYPED_TEST_SUITE_P(OnTheFlyAndPreCalculated, // Instance name INSTANTIATE_TYPED_TEST_SUITE_P(OnTheFlyAndPreCalculated, // Instance name
PrimeTableTest2, // Test case name PrimeTableTest2, // Test case name
PrimeTableImplementations); // Type list PrimeTableImplementations); // Type list
#endif // GTEST_HAS_TYPED_TEST_P
} // namespace } // namespace
 End of changes. 3 change blocks. 
7 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)