Files
allwpilib/ntcore/src/test/native/cpp/TestPrinters.h
Tyler Veness fbdc810887 Upgrade to C++20 (#4239)
* Use explicit this capture required by C++20
* Use C++20 span
* Replace wpi::numbers with std::numbers
* Fix C++20 clang-tidy warning false positive in fmt
* Remove ciso646 include since C++20 removed that header
* Fix global-buffer-overflow asan warnings in ntcore tests
* Add DIOSetProxy constructor to HAL

* Upgrade MSVC compiler to 2022
* Bump native-utils to 2023.2.7 (changes to std=c++20)

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2022-10-15 16:33:14 -07:00

66 lines
1.5 KiB
C++

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <ostream>
#include <span>
#include <string>
#include <string_view>
#include "gtest/gtest.h"
namespace wpi {
class json;
inline void PrintTo(std::string_view str, ::std::ostream* os) {
::testing::internal::PrintStringTo(std::string{str}, os);
}
template <typename T>
void PrintTo(std::span<T> val, ::std::ostream* os) {
*os << '{';
bool first = true;
for (auto v : val) {
if (first) {
first = false;
} else {
*os << ", ";
}
*os << ::testing::PrintToString(v);
}
*os << '}';
}
void PrintTo(const json& val, ::std::ostream* os);
} // namespace wpi
namespace nt {
namespace net3 {
class Message3;
} // namespace net3
namespace net {
struct ClientMessage;
struct ServerMessage;
} // namespace net
// class EntryNotification;
class Handle;
class PubSubOptions;
class Value;
// void PrintTo(const EntryNotification& event, std::ostream* os);
void PrintTo(const Handle& handle, std::ostream* os);
void PrintTo(const net3::Message3& msg, std::ostream* os);
void PrintTo(const net::ClientMessage& msg, std::ostream* os);
void PrintTo(const net::ServerMessage& msg, std::ostream* os);
void PrintTo(const Value& value, std::ostream* os);
void PrintTo(const PubSubOptions& options, std::ostream* os);
} // namespace nt