diff options
Diffstat (limited to 'samples/sample4_unittest.cc')
-rw-r--r-- | samples/sample4_unittest.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/samples/sample4_unittest.cc b/samples/sample4_unittest.cc index fa5afc7..d5144c0 100644 --- a/samples/sample4_unittest.cc +++ b/samples/sample4_unittest.cc @@ -26,20 +26,28 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) -#include "gtest/gtest.h" + #include "sample4.h" +#include "gtest/gtest.h" +namespace { // Tests the Increment() method. + TEST(Counter, Increment) { Counter c; + // Test that counter 0 returns 0 + EXPECT_EQ(0, c.Decrement()); + // EXPECT_EQ() evaluates its arguments exactly once, so they // can have side effects. EXPECT_EQ(0, c.Increment()); EXPECT_EQ(1, c.Increment()); EXPECT_EQ(2, c.Increment()); + + EXPECT_EQ(3, c.Decrement()); } + +} // namespace |