mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 21:35:42 +00:00
Mark gtest helper results nodiscard
This commit is contained in:
@@ -25,22 +25,23 @@
|
||||
|
||||
using net::eagle0::shardok::storage::fb::Unit;
|
||||
|
||||
auto operator==(
|
||||
[[nodiscard]] auto operator==(
|
||||
const net::eagle0::shardok::common::TileModifier_SingleModifier& lhs,
|
||||
const net::eagle0::shardok::common::TileModifier_SingleModifier& rhs) -> bool;
|
||||
auto operator==(
|
||||
[[nodiscard]] auto operator==(
|
||||
const net::eagle0::shardok::common::TileModifierWithCoords& lhs,
|
||||
const net::eagle0::shardok::common::TileModifierWithCoords& rhs) -> bool;
|
||||
|
||||
using net::eagle0::shardok::common::ActionType;
|
||||
using net::eagle0::shardok::storage::ActionResult;
|
||||
|
||||
auto ResultWithType(const std::vector<ActionResult>& results, ActionType type) -> ActionResult;
|
||||
auto ChangedUnitFbWithId(const ActionResult& result, int id) -> Unit*;
|
||||
auto MaybeChangedUnitFbWithId(const ActionResult& result, int id) -> Unit*;
|
||||
[[nodiscard]] auto ResultWithType(const std::vector<ActionResult>& results, ActionType type)
|
||||
-> ActionResult;
|
||||
[[nodiscard]] auto ChangedUnitFbWithId(const ActionResult& result, int id) -> Unit*;
|
||||
[[nodiscard]] auto MaybeChangedUnitFbWithId(const ActionResult& result, int id) -> Unit*;
|
||||
|
||||
template<class T, class VecT>
|
||||
auto CHECK_CONTAINS(const VecT& vec, const T& obj) -> bool {
|
||||
[[nodiscard]] auto CHECK_CONTAINS(const VecT& vec, const T& obj) -> bool {
|
||||
// Use member function Contains if available (for custom types like CoordsSet)
|
||||
if constexpr (requires { vec.Contains(obj); }) {
|
||||
return vec.Contains(obj);
|
||||
@@ -51,7 +52,7 @@ auto CHECK_CONTAINS(const VecT& vec, const T& obj) -> bool {
|
||||
}
|
||||
|
||||
template<class T, class VecT>
|
||||
auto CHECK_NOCONTAINS(const VecT& vec, const T& obj) -> bool {
|
||||
[[nodiscard]] auto CHECK_NOCONTAINS(const VecT& vec, const T& obj) -> bool {
|
||||
return !CHECK_CONTAINS(vec, obj);
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ void EXPECT_CONTAINS(const VecT& vec, const T& obj) {
|
||||
}
|
||||
|
||||
template<class VecT, class F>
|
||||
auto CHECK_NOCONTAINS_WHERE(const VecT& vec, F where) -> bool {
|
||||
[[nodiscard]] auto CHECK_NOCONTAINS_WHERE(const VecT& vec, F where) -> bool {
|
||||
for (size_t i = 0; i < vec.size(); ++i) {
|
||||
if (where(vec[i])) {
|
||||
std::cout << "Found at index " << i << '\n';
|
||||
@@ -77,12 +78,12 @@ auto CHECK_NOCONTAINS_WHERE(const VecT& vec, F where) -> bool {
|
||||
}
|
||||
|
||||
template<class T, class F>
|
||||
auto GET_RESULT_WHERE(const std::vector<T>& vec, F where) -> T {
|
||||
[[nodiscard]] auto GET_RESULT_WHERE(const std::vector<T>& vec, F where) -> T {
|
||||
return *std::ranges::find_if(vec, where);
|
||||
}
|
||||
|
||||
template<class T, class F>
|
||||
auto CHECK_CONTAINS_WHERE(T& vec, F where) -> bool {
|
||||
[[nodiscard]] auto CHECK_CONTAINS_WHERE(T& vec, F where) -> bool {
|
||||
return std::ranges::find_if(vec, where) != vec.end();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user