KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using Boost Test to unit test some C++ code. I have a vector of values that I need to compare with expected results, but I don't want to manually check the values in a loop: BOOST_REQUIRE_EQUAL(values.size(), expected.size()); for( int i = 0; i < size; ++i ) { BOOST_CHECK_EQUAL(values[i], expected[i]); } The main problem is that the loop check doesn't print the index, so it requires some searching to find the mismatch. I could use std::equal or std::mismatch on the two vectors, but that will require a lot of boilerplate as well. Is there a cleaner way to do this?
Tags (comma-separated)
Save Edits
Cancel