Friday, June 18, 2010

Building the gtest.lib in VS 2010

Convert solution and projects in msvc folder to VS 2010.

Build the solution in release mode and the gtest.lib appears in this folder:  ...\gtest-1.5.0\msvc\gtest\Release\

Building the solution in debug mode will give you a gtestd.lib in this folder:  ...\gtest-1.5.0\msvc\gtest\Debug\

Tuesday, February 9, 2010

GoogleTest Assertions

SUCCEED(); // now output currently
FAIL();
ADD_FAILURE();

Fatal assertion:

ASSERT_THROW(statement, exception_type);
ASSERT_ANY_THROW(statement);
ASSERT_NO_THROW(statement);

Nonfatal assertion:

EXPECT_THROW(statement, exception_type);
EXPECT_ANY_THROW(statement);
EXPECT_NO_THROW(statement);

Examples:

ASSERT_THROW(Foo(5), bar_exception);

EXPECT_NO_THROW
(
  {
      int n= 5;
      Bar(&n);
  }
);

Predicate Assertions

ASSERT_PRED1(pred1, val1);
ASSERT_PRED2(pred2, val1, val2);

...
EXPECT_PRED1(pred1, val1);
...

Tuesday, December 8, 2009

Google Test

Download the install files from here:

http://code.google.com/p/googletest/

Unzip and started reading.

Using VS 2010.

Use the msvc folder.  Contains a solution, but not read me.

There are two sln files:  gtest.sln and gtest-md.sln

What is the md one for?

When I open gtest.sln, I am told that I need to convert the solution.

I seem to remember something about installing, but I don't see it now.

Moved main folder to top.  (C:\testing\gtest-1.4.0)