MCPcopy Create free account
hub / github.com/ceres-solver/ceres-solver / ExpectVectorContainsUnordered

Function ExpectVectorContainsUnordered

internal/ceres/problem_test.cc:981–1002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

979// Check that a null-terminated array, a, has the same elements as b.
980template <typename T>
981void 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
1004static void ExpectProblemHasResidualBlocks(
1005 const ProblemImpl& problem,

Callers 2

TEST_PFunction · 0.85

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected