mirror of
https://github.com/google/googletest.git
synced 2024-12-26 17:41:03 +08:00
Merge pull request #4374 from masbug:main
PiperOrigin-RevId: 568317621 Change-Id: Icf7fb519f96f5e88eb0df491eed143134c8ac6eb
This commit is contained in:
commit
5bd0f08e0d
@ -37,6 +37,7 @@
|
|||||||
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_
|
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_
|
||||||
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_
|
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <type_traits> // IWYU pragma: keep
|
#include <type_traits> // IWYU pragma: keep
|
||||||
#include <utility> // IWYU pragma: keep
|
#include <utility> // IWYU pragma: keep
|
||||||
|
|
||||||
@ -69,22 +70,22 @@ constexpr bool PrefixOf(const char* a, const char* b) {
|
|||||||
return *a == 0 || (*a == *b && internal::PrefixOf(a + 1, b + 1));
|
return *a == 0 || (*a == *b && internal::PrefixOf(a + 1, b + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int N, int M>
|
template <size_t N, size_t M>
|
||||||
constexpr bool StartsWith(const char (&prefix)[N], const char (&str)[M]) {
|
constexpr bool StartsWith(const char (&prefix)[N], const char (&str)[M]) {
|
||||||
return N <= M && internal::PrefixOf(prefix, str);
|
return N <= M && internal::PrefixOf(prefix, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int N, int M>
|
template <size_t N, size_t M>
|
||||||
constexpr bool EndsWith(const char (&suffix)[N], const char (&str)[M]) {
|
constexpr bool EndsWith(const char (&suffix)[N], const char (&str)[M]) {
|
||||||
return N <= M && internal::PrefixOf(suffix, str + M - N);
|
return N <= M && internal::PrefixOf(suffix, str + M - N);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int N, int M>
|
template <size_t N, size_t M>
|
||||||
constexpr bool Equals(const char (&a)[N], const char (&b)[M]) {
|
constexpr bool Equals(const char (&a)[N], const char (&b)[M]) {
|
||||||
return N == M && internal::PrefixOf(a, b);
|
return N == M && internal::PrefixOf(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int N>
|
template <size_t N>
|
||||||
constexpr bool ValidateSpec(const char (&spec)[N]) {
|
constexpr bool ValidateSpec(const char (&spec)[N]) {
|
||||||
return internal::Equals("const", spec) ||
|
return internal::Equals("const", spec) ||
|
||||||
internal::Equals("override", spec) ||
|
internal::Equals("override", spec) ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user