Skip to content

Commit

Permalink
TestSuite: comments on *relatively* heavy includes in other comparators.
Browse files Browse the repository at this point in the history
Yeah, because a StringView.h is a whooping 4k lines. From which
unfortunately 2.3k is <type_traits> and <utility>, 500k <iosfwd> and
770k <cstdlib>. Without assertions it's just 2.2k, of which 1.7k is
<type_traits>.

Gotta get rid of <utility> next, it seems, and <iosfwd> is also long
overdue.
  • Loading branch information
mosra committed Mar 8, 2022
1 parent 2870b77 commit dc4f2ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/Corrade/TestSuite/Compare/SortedContainer.h
Expand Up @@ -33,6 +33,8 @@

#include <algorithm> /* std::sort() */

/* Given there's <algorithm> already, it won't really help much if we'd PIMPL
the Array include */
#include "Corrade/Containers/Array.h"
#include "Corrade/Containers/constructHelpers.h"
#include "Corrade/TestSuite/Compare/Container.h"
Expand Down
12 changes: 3 additions & 9 deletions src/Corrade/TestSuite/Compare/String.h
Expand Up @@ -31,6 +31,9 @@
* @m_since_latest
*/

/* Theoretically, if there would be C string overloads and PIMPL'd internals,
this include would not be needed... but practically a string comparison
almost never involves just C string literals, so I don't see a point. */
#include "Corrade/Containers/StringView.h"
#include "Corrade/TestSuite/Comparator.h"
#include "Corrade/TestSuite/visibility.h"
Expand Down Expand Up @@ -122,9 +125,6 @@ template<> class CORRADE_TESTSUITE_EXPORT Comparator<Compare::StringHasPrefix> {
void printMessage(ComparisonStatusFlags flags, Utility::Debug& out, const char* actual, const char* expected) const;

private:
/* I could make these pointers to avoid the include, but that would
force people to just include StringView on their own even if they
would be passing plain C string literals, so there's no point */
Containers::StringView _actualValue;
Containers::StringView _expectedPrefixValue;
};
Expand All @@ -136,8 +136,6 @@ template<> class CORRADE_TESTSUITE_EXPORT Comparator<Compare::StringHasSuffix> {
void printMessage(ComparisonStatusFlags flags, Utility::Debug& out, const char* actual, const char* expected) const;

private:
/* Same as above, makes no sense to have these as pointers to avoid the
include */
Containers::StringView _actualValue;
Containers::StringView _expectedSuffixValue;
};
Expand All @@ -149,8 +147,6 @@ template<> class CORRADE_TESTSUITE_EXPORT Comparator<Compare::StringContains> {
void printMessage(ComparisonStatusFlags flags, Utility::Debug& out, const char* actual, const char* expected) const;

private:
/* Same as above, makes no sense to have these as pointers to avoid the
include */
Containers::StringView _actualValue;
Containers::StringView _expectedToContainValue;
};
Expand All @@ -162,8 +158,6 @@ template<> class CORRADE_TESTSUITE_EXPORT Comparator<Compare::StringNotContains>
void printMessage(ComparisonStatusFlags flags, Utility::Debug& out, const char* actual, const char* expected) const;

private:
/* Same as above, makes no sense to have these as pointers to avoid the
include */
Containers::StringView _actualValue;
Containers::StringView _expectedToNotContainValue;
};
Expand Down

0 comments on commit dc4f2ea

Please sign in to comment.