Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include "gtest/gtest.h"
- #include "gmock/gmock.h"
- using namespace std;
- void inc (int& val);
- int main (int argc, char** argv)
- {
- int i;
- i = 0;
- cout << "Antes: " << i << endl;
- inc(i);
- cout << "Despues: " << i << endl;
- /* We run the tests defined below */
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
- }
- void inc (int& val)
- {
- ++val;
- }
- /* Tests */
- // Tests that inc works correctly
- TEST(IncTest, WorksCorrectly)
- {
- int i = 0;
- inc(i);
- EXPECT_EQ(1, i);
- inc(i);
- EXPECT_EQ(2, i);
- inc(i);
- EXPECT_FALSE((10) == (i));
- }
Add Comment
Please, Sign In to add comment