| 491 | } |
| 492 | |
| 493 | void Run(int id, const TimestampValue& now) const { |
| 494 | DateTimeFormatContext dt_ctx(fmt); |
| 495 | dt_ctx.SetCenturyBreakAndCurrentTime(now); |
| 496 | |
| 497 | stringstream desc; |
| 498 | desc << "DateFormatTC [" << id << "]: " << "days_since_epoch:" << days_since_epoch |
| 499 | << " fmt:" << fmt << " str:" << str; |
| 500 | |
| 501 | ASSERT_TRUE(SimpleDateFormatTokenizer::Tokenize(&dt_ctx, PARSE, false)) << desc.str(); |
| 502 | |
| 503 | const DateValue cust_dv(days_since_epoch); |
| 504 | EXPECT_TRUE(cust_dv.IsValid()) << desc.str(); |
| 505 | EXPECT_GE(dt_ctx.fmt_out_len, dt_ctx.fmt_len) << desc.str(); |
| 506 | |
| 507 | string buff = cust_dv.Format(dt_ctx); |
| 508 | EXPECT_TRUE(!buff.empty()) << desc.str(); |
| 509 | EXPECT_LE(buff.length(), dt_ctx.fmt_out_len) << desc.str(); |
| 510 | EXPECT_EQ(buff, string(str, strlen(str))) << desc.str(); |
| 511 | } |
| 512 | |
| 513 | }; |
| 514 | |