Eliminate redundant tests:

* The unit tests should reflect basic definitions.
* Derivative relationships do not need to be tested.
* Derivative tests needlessly increase test times and noise.
This commit is contained in:
Howard Hinnant 2015-08-09 13:27:39 -04:00
parent 28eadffa06
commit 57c7d88eda

View File

@ -42,50 +42,17 @@
#include <type_traits> #include <type_traits>
static_assert(date::days{1} == std::chrono::seconds{86400}, "");
static_assert(date::days{1} == std::chrono::hours{24}, ""); static_assert(date::days{1} == std::chrono::hours{24}, "");
static_assert( std::is_convertible<date::days, std::chrono::seconds>{}, "");
static_assert( std::is_convertible<date::days, std::chrono::minutes>{}, "");
static_assert( std::is_convertible<date::days, std::chrono::hours>{}, "");
static_assert(!std::is_convertible<date::days, date::weeks>{}, "");
static_assert(!std::is_convertible<date::days, date::months>{}, "");
static_assert(!std::is_convertible<date::days, date::years>{}, "");
static_assert(date::weeks{1} == std::chrono::seconds{604800}, "");
static_assert(date::weeks{1} == date::days{7}, ""); static_assert(date::weeks{1} == date::days{7}, "");
static_assert( std::is_convertible<date::weeks, std::chrono::seconds>{}, "");
static_assert( std::is_convertible<date::weeks, std::chrono::minutes>{}, "");
static_assert( std::is_convertible<date::weeks, std::chrono::hours>{}, "");
static_assert( std::is_convertible<date::weeks, date::days>{}, "");
static_assert(!std::is_convertible<date::weeks, date::months>{}, "");
static_assert(!std::is_convertible<date::weeks, date::years>{}, "");
static_assert(date::months{1} == std::chrono::seconds{2629746}, ""); static_assert(date::months{12} == date::years{1}, "");
static_assert(date::days{30} < date::months{1} && date::months{1} < date::days{31}, ""); static_assert(date::days{30} < date::months{1} && date::months{1} < date::days{31}, "");
static_assert(date::weeks{4} < date::months{1} && date::months{1} < date::weeks{5}, ""); static_assert(date::weeks{4} < date::months{1} && date::months{1} < date::weeks{5}, "");
static_assert(!std::is_convertible<date::months, date::years>{}, "");
static_assert(!std::is_convertible<date::months, date::weeks>{}, "");
static_assert(!std::is_convertible<date::months, date::days>{}, "");
static_assert(!std::is_convertible<date::months, std::chrono::hours>{}, "");
static_assert(!std::is_convertible<date::months, std::chrono::minutes>{}, "");
static_assert( std::is_convertible<date::months, std::chrono::seconds>{}, "");
static_assert( std::is_convertible<date::months, std::chrono::milliseconds>{}, "");
static_assert( std::is_convertible<date::months, std::chrono::microseconds>{}, "");
static_assert( std::is_convertible<date::months, std::chrono::nanoseconds>{}, "");
static_assert(date::years{1} == std::chrono::seconds{31556952}, ""); static_assert(date::years{400} == date::days{146097}, "");
static_assert(date::days{365} < date::years{1} && date::years{1} < date::days{366}, ""); static_assert(date::days{365} < date::years{1} && date::years{1} < date::days{366}, "");
static_assert(date::weeks{52} < date::years{1} && date::years{1} < date::weeks{53}, ""); static_assert(date::weeks{52} < date::years{1} && date::years{1} < date::weeks{53}, "");
static_assert(date::years{1} == date::months{12}, "");
static_assert( std::is_convertible<date::years, date::months>{}, "");
static_assert(!std::is_convertible<date::years, date::weeks>{}, "");
static_assert(!std::is_convertible<date::years, date::days>{}, "");
static_assert(!std::is_convertible<date::years, std::chrono::hours>{}, "");
static_assert(!std::is_convertible<date::years, std::chrono::minutes>{}, "");
static_assert( std::is_convertible<date::years, std::chrono::seconds>{}, "");
static_assert( std::is_convertible<date::years, std::chrono::milliseconds>{}, "");
static_assert( std::is_convertible<date::years, std::chrono::microseconds>{}, "");
static_assert( std::is_convertible<date::years, std::chrono::nanoseconds>{}, "");
static_assert(std::is_same<date::day_point::duration, date::days>{}, ""); static_assert(std::is_same<date::day_point::duration, date::days>{}, "");