Google C++ Testing Framework_01

Google C++ Testing Framework_01

 

 

#include <gtest/gtest.h>
class MyMath
{
public:
    
static int Add(int num1, int num2);
};
int MyMath::Add(int num1, int num2)
{
    
return num1 + num2;
}
TEST(MyMathTest, Positive)
{
    EXPECT_EQ(
4, MyMath::Add(12));
}
int main(int argc, char **argv)
{
    std::cout 
<< "Running main() from gtest_main.cc\n";

    testing::InitGoogleTest(
&argc, argv);
    
return RUN_ALL_TESTS(); 
}
posted @ 2009-03-22 14:50  jerry550409  阅读(156)  评论(0编辑  收藏  举报