Drake
type_safe_index_test.cc File Reference
#include "drake/common/type_safe_index.h"
#include <limits>
#include <regex>
#include <sstream>
#include <type_traits>
#include <utility>
#include <vector>
#include <gtest/gtest.h>
#include "drake/common/unused.h"
Include dependency graph for type_safe_index_test.cc:

Namespaces

 drake
 
 drake::common
 

Macros

#define EXPECT_ERROR_MESSAGE_IF_ARMED(expression, reg_exp)
 
#define BINARY_TEST(OP, OP_NAME)
 

Macro Definition Documentation

#define BINARY_TEST (   OP,
  OP_NAME 
)
Value:
template <typename T, typename U, \
typename = decltype(std::declval<T>() OP std::declval<U>())> \
bool has_ ## OP_NAME ## _helper(int) { return true; } \
template <typename T, typename U> \
bool has_ ## OP_NAME ## _helper(...) { return false; } \
template <typename T, typename U> \
bool has_ ## OP_NAME() { return has_ ## OP_NAME ## _helper<T, U>(1); } \
GTEST_TEST(TypeSafeIndex, OP_NAME ## OperatorAvailiblity) { \
EXPECT_FALSE((has_ ## OP_NAME<AIndex, BIndex>())); \
EXPECT_TRUE((has_ ## OP_NAME<AIndex, AIndex>())); \
EXPECT_TRUE((has_ ## OP_NAME<AIndex, int>())); \
EXPECT_TRUE((has_ ## OP_NAME<AIndex, size_t>())); \
EXPECT_TRUE((has_ ## OP_NAME<AIndex, int64_t>())); \
}
GTEST_TEST(MonolaneBuilderTest, Fig8)
Definition: monolane_builder_test.cc:14
#define EXPECT_ERROR_MESSAGE_IF_ARMED (   expression,
  reg_exp 
)
Value:
do {\
try { \
expression; \
GTEST_NONFATAL_FAILURE_("\t" #expression \
" failed to throw std::runtime_error."); \
} catch (const std::runtime_error& err) { \
auto matcher = [](const char* s, const char* re) { \
return regex_match(s, regex(re)); }; \
EXPECT_PRED2(matcher, err.what(), reg_exp); \
} \
} while (0)