see my img, I find zoned_time can show custom str “America/New_York” 1721904914882986761ns [2024-07-25 10:55:14]
how to custom this value in my own class
I try following code but it only show type in clion watches
#include <gtest/gtest.h>
class DraftTest : public testing::Test {
protected:
// Set up common test data or state if needed
};
#include <iostream>
#include <sstream>
class MyClass {
public:
MyClass(int a, double b) : a_(a), b_(b) {}
// Define how the class should be printed
std::string toString() const {
std::stringstream ss;
ss << "MyClass(a=" << a_ << ", b=" << b_ << ")";
return ss.str();
}
// Provide a way to print using `<<`
friend std::ostream &operator<<(std::ostream &os, const MyClass &obj) {
return os << obj.toString();
}
private:
int a_;
double b_;
};
TEST_F(DraftTest, test_video) {
MyClass obj(1, 2.5);
std::cout << obj << std::endl; // Will use the `<<` operator to print `obj`
// Use obj in your test as needed
}