| 478 | |
| 479 | template <class T> |
| 480 | void TestTimeUnits() { |
| 481 | T withTime = T::MicroSeconds(1249571946000000L); |
| 482 | T onlyMinutes = T::MicroSeconds(1249571940000000L); |
| 483 | T onlyHours = T::MicroSeconds(1249570800000000L); |
| 484 | T onlyDays = T::MicroSeconds(1249516800000000L); |
| 485 | ui64 minutes = 20826199; |
| 486 | ui64 hours = 347103; |
| 487 | ui64 days = 14462; |
| 488 | |
| 489 | UNIT_ASSERT_VALUES_EQUAL(withTime.Minutes(), minutes); |
| 490 | UNIT_ASSERT_VALUES_EQUAL(onlyMinutes, T::Minutes(minutes)); |
| 491 | UNIT_ASSERT_VALUES_EQUAL(onlyMinutes.Minutes(), minutes); |
| 492 | |
| 493 | UNIT_ASSERT_VALUES_EQUAL(withTime.Hours(), hours); |
| 494 | UNIT_ASSERT_VALUES_EQUAL(onlyMinutes.Hours(), hours); |
| 495 | UNIT_ASSERT_VALUES_EQUAL(onlyHours, T::Hours(hours)); |
| 496 | UNIT_ASSERT_VALUES_EQUAL(onlyHours.Hours(), hours); |
| 497 | |
| 498 | UNIT_ASSERT_VALUES_EQUAL(withTime.Days(), days); |
| 499 | UNIT_ASSERT_VALUES_EQUAL(onlyHours.Days(), days); |
| 500 | UNIT_ASSERT_VALUES_EQUAL(onlyDays, T::Days(days)); |
| 501 | UNIT_ASSERT_VALUES_EQUAL(onlyDays.Days(), days); |
| 502 | } |
| 503 | |
| 504 | Y_UNIT_TEST(TestInstantUnits) { |
| 505 | TestTimeUnits<TInstant>(); |