Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error matchers #2293

Merged
merged 11 commits into from
Aug 19, 2019
Merged

Add error matchers #2293

merged 11 commits into from
Aug 19, 2019

Conversation

eggrobin
Copy link
Member

Use them in a few tests, unbreaking that which was broken by #2290 in the process.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
astronomy/orbit_analysis_test.cpp Outdated Show resolved Hide resolved
Lt(0.0009));
EXPECT_THAT(
elements.nodal_precession(),
AllOf(AbsoluteErrorFrom(nominal_nodal_precession,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice that the new matchers make it easy to check both absolute and relative errors in a single expectations, but I have a hard time figuring out why we want that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure which kind of error we want here, and this means both matchers are tested.

astronomy/orbital_elements_test.cpp Outdated Show resolved Hide resolved
astronomy/orbital_elements_test.cpp Outdated Show resolved Hide resolved
testing_utilities/error_matchers.hpp Outdated Show resolved Hide resolved
class AbsoluteErrorFromMatcher : public MatcherInterface<Value const&> {
public:
using Error =
decltype(AbsoluteError(std::declval<Value>(), std::declval<Value>()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ever different from Difference<Value>?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some vectors are not scalars.

using ::testing::MatcherInterface;
using ::testing::MatchResultListener;

template<typename Value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put these classes in an unnamed namespace.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is a header; that's what the internal namespace is for.

astronomy/orbit_analysis_test.cpp Outdated Show resolved Hide resolved
astronomy/orbital_elements_test.cpp Outdated Show resolved Hide resolved
testing_utilities/numerics_matchers.hpp Outdated Show resolved Hide resolved
@pleroy pleroy added the LGTM label Aug 19, 2019
@eggrobin eggrobin merged commit cee0233 into mockingbirdnest:master Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants