| 979 | // Check that a null-terminated array, a, has the same elements as b. |
| 980 | template <typename T> |
| 981 | void ExpectVectorContainsUnordered(const T* a, const std::vector<T>& b) { |
| 982 | // Compute the size of a. |
| 983 | int size = 0; |
| 984 | while (a[size]) { |
| 985 | ++size; |
| 986 | } |
| 987 | ASSERT_EQ(size, b.size()); |
| 988 | |
| 989 | // Sort a. |
| 990 | std::vector<T> a_sorted(size); |
| 991 | copy(a, a + size, a_sorted.begin()); |
| 992 | sort(a_sorted.begin(), a_sorted.end()); |
| 993 | |
| 994 | // Sort b. |
| 995 | std::vector<T> b_sorted(b); |
| 996 | sort(b_sorted.begin(), b_sorted.end()); |
| 997 | |
| 998 | // Compare. |
| 999 | for (int i = 0; i < size; ++i) { |
| 1000 | EXPECT_EQ(a_sorted[i], b_sorted[i]); |
| 1001 | } |
| 1002 | } |
| 1003 | |
| 1004 | static void ExpectProblemHasResidualBlocks( |
| 1005 | const ProblemImpl& problem, |
no test coverage detected