(только частичный код) < /p>
Код: Выделить всё
class SciDate
{
private:
year_month_day m_date;
unsigned m_hour{0};
unsigned m_minute{0};
unsigned m_second{0};
public:
SciDate()
{
year_month_day cur_date{floor(date::make_zoned(date::current_zone(), chrono::system_clock::now()).get_local_time())};
m_date = cur_date;
}
SciDate(int y, int m, int d) : m_date(date::year(y),date::month(m),date::day(d)) {}
SciDate(const SciDate& d) : m_date(d.m_date), m_hour(d.m_hour), m_minute(d.m_minute), m_second(d.m_second) {}
SciDate operator=(const SciDate& rhs)
{
if (this != &rhs) {
SciDate tmp(rhs);
return tmp;
}
return *this;
}
}
Код: Выделить всё
TEST_F(SciDateTest, constuct_copy)
{
for(int y=FIRST_YEAR; y
Подробнее здесь: [url]https://stackoverflow.com/questions/79675583/why-does-previous-constructor-pass-tests-but-new-constructor-fails-when-assignin[/url]