From 533d216b11f3923dab8b4fd5e5d16d983d8f70d3 Mon Sep 17 00:00:00 2001 From: Jonathan M Davis Date: Thu, 17 Sep 2015 20:14:28 -0700 Subject: [PATCH] Revert "std.datetime_doc_update 1 of 9" This reverts commit 81391ff59cc170715a7f8757e6672019a84853f1. This was well intentioned, but it moves the unit tests into a templated struct, which makes it so that they get instantiated for every template instantiation. --- std/datetime.d | 231 +++++++++++++++++++++++++------------------------ 1 file changed, 120 insertions(+), 111 deletions(-) diff --git a/std/datetime.d b/std/datetime.d index a53846365..952365369 100644 --- a/std/datetime.d +++ b/std/datetime.d @@ -17964,6 +17964,18 @@ public: Throws: $(LREF DateTimeException) if this interval is empty. + + Examples: +-------------------- +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( + Date(1994, 12, 24))); + +assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( + Date(2000, 1, 5))); + +assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( + Date(2012, 3, 1))); +-------------------- +/ bool isAfter(in TP timePoint) const pure { @@ -17972,18 +17984,6 @@ public: return timePoint < _begin; } - /// - unittest - { - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( - Date(1994, 12, 24))); - - assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( - Date(2000, 1, 5))); - - assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( - Date(2012, 3, 1))); - } /++ Whether this interval is after the given interval and does not intersect @@ -17994,6 +17994,18 @@ public: Throws: $(LREF DateTimeException) if either interval is empty. + + Examples: +-------------------- +assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( + Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); + +assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( + Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); + +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( + Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); +-------------------- +/ bool isAfter(in Interval interval) const pure { @@ -18003,18 +18015,6 @@ public: return _begin >= interval._end; } - /// - unittest - { - assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( - Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); - - assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( - Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); - - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( - Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); - } /++ Whether this interval is after the given interval and does not intersect @@ -18028,6 +18028,12 @@ public: Throws: $(LREF DateTimeException) if this interval is empty. + + Examples: +-------------------- +assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( + PosInfInterval!Date(Date(1999, 5, 4)))); +-------------------- +/ bool isAfter(in PosInfInterval!TP interval) const pure { @@ -18036,12 +18042,6 @@ public: return false; } - /// - unittest - { - assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( - PosInfInterval!Date(Date(1999, 5, 4)))); - } /++ Whether this interval is after the given interval and does not intersect @@ -18052,6 +18052,12 @@ public: Throws: $(LREF DateTimeException) if this interval is empty. + + Examples: +-------------------- +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( + NegInfInterval!Date(Date(1996, 1, 2)))); +-------------------- +/ bool isAfter(in NegInfInterval!TP interval) const pure { @@ -18060,12 +18066,6 @@ public: return _begin >= interval._end; } - /// - unittest - { - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAfter( - NegInfInterval!Date(Date(1996, 1, 2)))); - } /++ Whether the given interval overlaps this interval. @@ -18075,6 +18075,18 @@ public: Throws: $(LREF DateTimeException) if either interval is empty. + + Examples: +-------------------- +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( + Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); + +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( + Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); + +assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( + Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); +-------------------- +/ bool intersects(in Interval interval) const pure { @@ -18084,18 +18096,6 @@ public: return interval._begin < _end && interval._end > _begin; } - /// - unittest - { - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( - Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2)))); - - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( - Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17)))); - - assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( - Interval!Date(Date(1989, 3, 1), Date(1996, 1, 2)))); - } /++ Whether the given interval overlaps this interval. @@ -18105,6 +18105,15 @@ public: Throws: $(LREF DateTimeException) if this interval is empty. + + Examples: +-------------------- +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( + PosInfInterval!Date(Date(1999, 5, 4)))); + +assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( + PosInfInterval!Date(Date(2012, 3, 1)))); +-------------------- +/ bool intersects(in PosInfInterval!TP interval) const pure { @@ -18113,15 +18122,6 @@ public: return _end > interval._begin; } - /// - unittest - { - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( - PosInfInterval!Date(Date(1999, 5, 4)))); - - assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( - PosInfInterval!Date(Date(2012, 3, 1)))); - } /++ Whether the given interval overlaps this interval. @@ -18131,6 +18131,15 @@ public: Throws: $(LREF DateTimeException) if this interval is empty. + + Examples: +-------------------- +assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( + NegInfInterval!Date(Date(1996, 1, 2)))); + +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( + NegInfInterval!Date(Date(2000, 1, 2)))); +-------------------- +/ bool intersects(in NegInfInterval!TP interval) const pure { @@ -18139,15 +18148,6 @@ public: return _begin < interval._end; } - /// - unittest - { - assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( - NegInfInterval!Date(Date(1996, 1, 2)))); - - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersects( - NegInfInterval!Date(Date(2000, 1, 2)))); - } /++ Returns the intersection of two intervals @@ -18158,6 +18158,17 @@ public: Throws: $(LREF DateTimeException) if the two intervals do not intersect or if either interval is empty. + + Examples: +-------------------- +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( + Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == + Interval!Date(Date(1996, 1 , 2), Date(2000, 8, 2))); + +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( + Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) == + Interval!Date(Date(1999, 1 , 12), Date(2011, 9, 17))); +-------------------- +/ Interval intersection(in Interval interval) const { @@ -18171,17 +18182,6 @@ public: return Interval(begin, end); } - /// - unittest - { - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( - Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) == - Interval!Date(Date(1996, 1 , 2), Date(2000, 8, 2))); - - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( - Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) == - Interval!Date(Date(1999, 1 , 12), Date(2011, 9, 17))); - } /++ Returns the intersection of two intervals @@ -18192,6 +18192,17 @@ public: Throws: $(LREF DateTimeException) if the two intervals do not intersect or if this interval is empty. + + Examples: +-------------------- +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( + PosInfInterval!Date(Date(1990, 7, 6))) == + Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1))); + +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( + PosInfInterval!Date(Date(1999, 1, 12))) == + Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1))); +-------------------- +/ Interval intersection(in PosInfInterval!TP interval) const { @@ -18202,17 +18213,6 @@ public: return Interval(_begin > interval._begin ? _begin : interval._begin, _end); } - /// - unittest - { - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( - PosInfInterval!Date(Date(1990, 7, 6))) == - Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1))); - - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( - PosInfInterval!Date(Date(1999, 1, 12))) == - Interval!Date(Date(1999, 1 , 12), Date(2012, 3, 1))); - } /++ Returns the intersection of two intervals @@ -18223,6 +18223,17 @@ public: Throws: $(LREF DateTimeException) if the two intervals do not intersect or if this interval is empty. + + Examples: +-------------------- +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( + NegInfInterval!Date(Date(1999, 7, 6))) == + Interval!Date(Date(1996, 1 , 2), Date(1999, 7, 6))); + +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( + NegInfInterval!Date(Date(2013, 1, 12))) == + Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1))); +-------------------- +/ Interval intersection(in NegInfInterval!TP interval) const { @@ -18233,17 +18244,6 @@ public: return Interval(_begin, _end < interval._end ? _end : interval._end); } - /// - unittest - { - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( - NegInfInterval!Date(Date(1999, 7, 6))) == - Interval!Date(Date(1996, 1 , 2), Date(1999, 7, 6))); - - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).intersection( - NegInfInterval!Date(Date(2013, 1, 12))) == - Interval!Date(Date(1996, 1 , 2), Date(2012, 3, 1))); - } /++ Whether the given interval is adjacent to this interval. @@ -18254,6 +18254,18 @@ public: Throws: $(LREF DateTimeException) if either interval is empty. + + Examples: +-------------------- +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( + Interval!Date(Date(1990, 7, 6), Date(1996, 1, 2)))); + +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( + Interval!Date(Date(2012, 3, 1), Date(2013, 9, 17)))); + +assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( + Interval!Date(Date(1989, 3, 1), Date(2012, 3, 1)))); +-------------------- +/ bool isAdjacent(in Interval interval) const pure { @@ -18263,18 +18275,6 @@ public: return _begin == interval._end || _end == interval._begin; } - /// - unittest - { - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( - Interval!Date(Date(1990, 7, 6), Date(1996, 1, 2)))); - - assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( - Interval!Date(Date(2012, 3, 1), Date(2013, 9, 17)))); - - assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( - Interval!Date(Date(1989, 3, 1), Date(2012, 3, 1)))); - } /++ Whether the given interval is adjacent to this interval. @@ -18285,6 +18285,15 @@ public: Throws: $(LREF DateTimeException) if this interval is empty. + + Examples: +-------------------- +assert(!Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( + PosInfInterval!Date(Date(1999, 5, 4)))); + +assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).isAdjacent( + PosInfInterval!Date(Date(2012, 3, 1)))); +-------------------- +/ bool isAdjacent(in PosInfInterval!TP interval) const pure {