TEST(gnc_date_operators, test_move_assignment) { GncDate a(2045, 11, 13); GncDate b; b = std::move(a); EXPECT_TRUE(a.isnull()); EXPECT_TRUE (b.format("%Y-%m-%d") == "2045-11-13"); }
GDate* gnc_g_date_new_today () { GncDate gncd; auto ymd = gncd.year_month_day(); auto month = static_cast<GDateMonth>(ymd.month); auto result = g_date_new_dmy (ymd.day, month, ymd.year); g_assert(g_date_valid (result)); return result; }void
//This is a bit convoluted because it uses GncDate's GncDateImpl constructor and year_month_day() function. There's no good way to test the former without violating the privacy of the implementation. TEST(gnc_datetime_functions, test_date) { GncDateTime atime(2394187200); //2045-11-13 12:00:00 Z GncDate gncd = atime.date(); auto ymd = gncd.year_month_day(); EXPECT_EQ(ymd.year, 2045); EXPECT_EQ(ymd.month, 11); EXPECT_EQ(ymd.day, 13); }
TEST(gnc_date_constructors, test_default_constructor) { GncDate date; EXPECT_FALSE(date.isnull()); }