Jump to content
Roger Cigol

Google Tests (unit testing framework) working with Embarcadero C++ clang compiler?

Recommended Posts

GoogleTests has lots of ASSERT_xxxx type functions to cover most common (and indeed uncommon) C++ types. But it doesn’t know about the Embarcadero String type.

To make it easy and consistent to do Embarcadero String types I have made a simple C++ unit which I have called ASSERT_STRING_EQ. I simply include ASSERT_STRING_EQ.h at the top of googletest files that require comparisons of String types and make sure ASSERT_STRING_EQ.cpp is added to the project file.

The contents of ASSERT_STRING_EQ.cpp is as follows:

void ASSERT_STRING_EQ(String A, String B)
   ASSERT_STREQ(A.c_str(), B.c_str());

void ASSERT_STRING_NE(String A, String B)
   ASSERT_STRNE(A.c_str(), B.c_str());


Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now