Skip to content

Commit

Permalink
with_variable
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Apr 6, 2024
1 parent a7356e7 commit 7285f7b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions geometry/frame_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ using FrameDeathTest = FrameTest;

// Check that non-serializable frames are detected at compile-time.
PRINCIPIA_CHECK_WELL_FORMED(FrameTest::World1::ReadFromMessage(message),
WITH<serialization::Frame> message);
with_variable<serialization::Frame> message);
PRINCIPIA_CHECK_ILL_FORMED(FrameTest::F1::ReadFromMessage(message),
WITH<serialization::Frame> message);
with_variable<serialization::Frame> message);
PRINCIPIA_CHECK_ILL_FORMED(FrameTest::F2::ReadFromMessage(message),
WITH<serialization::Frame> message);
with_variable<serialization::Frame> message);
PRINCIPIA_CHECK_ILL_FORMED(FrameTest::F3::ReadFromMessage(message),
WITH<serialization::Frame> message);
with_variable<serialization::Frame> message);

TEST_F(FrameDeathTest, SerializationError) {
EXPECT_DEATH({
Expand Down
24 changes: 12 additions & 12 deletions geometry/grassmann_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,29 +297,29 @@ TEST_F(GrassmannTest, Normalize) {
using F = Frame<struct FrameTag>;

PRINCIPIA_CHECK_WELL_FORMED(v.WriteToMessage(&message),
WITH<Vector<Length, GrassmannTest::World>> v,
WITH<serialization::Multivector> message);
with_variable<Vector<Length, GrassmannTest::World>> v,

Check warning on line 300 in geometry/grassmann_test.cpp

View workflow job for this annotation

GitHub Actions / check-cpp

whitespace/line_length

Lines should be <= 80 characters long
with_variable<serialization::Multivector> message);
// TODO(phl): We should refuse to serialize these at compile time; right now
// only deserialization fails.
PRINCIPIA_CHECK_WELL_FORMED(v.WriteToMessage(&message),
WITH<Vector<Length, F>> v,
WITH<serialization::Multivector> message);
with_variable<Vector<Length, F>> v,
with_variable<serialization::Multivector> message);
PRINCIPIA_CHECK_WELL_FORMED(v.WriteToMessage(&message),
WITH<Bivector<Length, F>> v,
WITH<serialization::Multivector> message);
with_variable<Bivector<Length, F>> v,
with_variable<serialization::Multivector> message);
PRINCIPIA_CHECK_WELL_FORMED(v.WriteToMessage(&message),
WITH<Trivector<Length, F>> v,
WITH<serialization::Multivector> message);
with_variable<Trivector<Length, F>> v,
with_variable<serialization::Multivector> message);

PRINCIPIA_CHECK_WELL_FORMED(
(Vector<Length, GrassmannTest::World>::ReadFromMessage(message)),
WITH<serialization::Multivector> message);
with_variable<serialization::Multivector> message);
PRINCIPIA_CHECK_ILL_FORMED((Vector<Length, F>::ReadFromMessage(message)),
WITH<serialization::Multivector> message);
with_variable<serialization::Multivector> message);
PRINCIPIA_CHECK_ILL_FORMED((Bivector<Length, F>::ReadFromMessage(message)),
WITH<serialization::Multivector> message);
with_variable<serialization::Multivector> message);
PRINCIPIA_CHECK_ILL_FORMED((Trivector<Length, F>::ReadFromMessage(message)),
WITH<serialization::Multivector> message);
with_variable<serialization::Multivector> message);

TEST_F(GrassmannDeathTest, SerializationError) {
using V = Vector<Length, World>;
Expand Down
4 changes: 2 additions & 2 deletions numerics/polynomial_in_monomial_basis_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ TEST_F(PolynomialInMonomialBasisTest, Evaluate2P) {
}

PRINCIPIA_CHECK_WELL_FORMED(p.Primitive(),
WITH<PolynomialInMonomialBasisTest::P2A> p);
with_variable<PolynomialInMonomialBasisTest::P2A> p);

Check warning on line 154 in numerics/polynomial_in_monomial_basis_test.cpp

View workflow job for this annotation

GitHub Actions / check-cpp

whitespace/line_length

Lines should be <= 80 characters long
PRINCIPIA_CHECK_ILL_FORMED(p.Primitive(),
WITH<PolynomialInMonomialBasisTest::P2P> p);
with_variable<PolynomialInMonomialBasisTest::P2P> p);

// Check that a polynomial of high order may be declared.
TEST_F(PolynomialInMonomialBasisTest, Evaluate17) {
Expand Down
2 changes: 1 addition & 1 deletion testing_utilities/check_well_formedness.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
expected_well_formedness_description, \
expression, \
...) \
template<template<typename> typename WITH = std::type_identity_t> \
template<template<typename> typename with_variable = std::type_identity_t> \
concept unique_concept_name = requires(__VA_ARGS__) { (expression); }; \
static_assert(expected_well_formedness unique_concept_name<>, \
"Expected\n " #expression \
Expand Down
8 changes: 4 additions & 4 deletions testing_utilities/check_well_formedness_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string>
#include <utility>

PRINCIPIA_CHECK_ILL_FORMED(s + 3, WITH<std::string> s);
PRINCIPIA_CHECK_ILL_FORMED(s + "3", WITH<std::pair<double, double>> s);
PRINCIPIA_CHECK_WELL_FORMED(s + t, WITH<std::string> s, WITH<std::string> t);
PRINCIPIA_CHECK_ILL_FORMED(s - t, WITH<std::string> s, WITH<std::string> t);
PRINCIPIA_CHECK_ILL_FORMED(s + 3, with_variable<std::string> s);
PRINCIPIA_CHECK_ILL_FORMED(s + "3", with_variable<std::pair<double, double>> s);
PRINCIPIA_CHECK_WELL_FORMED(s + t, with_variable<std::string> s, with_variable<std::string> t);

Check warning on line 8 in testing_utilities/check_well_formedness_test.cpp

View workflow job for this annotation

GitHub Actions / check-cpp

whitespace/line_length

Lines should be <= 80 characters long
PRINCIPIA_CHECK_ILL_FORMED(s - t, with_variable<std::string> s, with_variable<std::string> t);

Check warning on line 9 in testing_utilities/check_well_formedness_test.cpp

View workflow job for this annotation

GitHub Actions / check-cpp

whitespace/line_length

Lines should be <= 80 characters long

0 comments on commit 7285f7b

Please sign in to comment.