I am looking to compare two arrays in google test. In UnitTest++ this is done through CHECK_ARRAY_EQUAL. How do you do it in google test?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would really suggest looking at Google C++ Mocking Framework. Even if you don’t want to mock anything, it allows you to write rather complicated assertions with ease.
For example
There’s plenty of matchers for every possible situations, and you can combine them to achieve almost anything.
Did I tell you that
ElementsAreneeds onlyiteratorsandsize()method on a class to work? So it not only works with any container from STL but with custom containers also.Google Mock claims to be almost as portable as Google Test and frankly I don’t see why you wouldn’t use it. It is just purely awesome.