Are these (known) bugs?

biozic dransic at
Sat Jan 29 01:08:32 PST 2011

Le 28/01/11 22:55, Jonathan M Davis a écrit :
> On Friday, January 28, 2011 10:57:58 biozic wrote:
>> Hi,
>> I am playing with the to-be-released std.datetime, and encountered these
>> errors (the last one concerns std.variant, actually), with dmd 2.052
>> (Mac OS X 10.6):
>> ---
>> import std.array, std.datetime, std.variant;
>> unittest {
>>       auto app = appender!(Interval!Date[]);
>>       auto interval = Interval!Date(Date(2000, 1, 1), Date(2011, 2, 3));
>>       app.put(interval);
>>       // Error: datetime.d(20208): Invariant Failure: begin is not before
>> or equal to end.
>> }
> There no known bugs in std.datetime. My guess would be that the issue lies with
> appender and Interval!(Date).init and/or something set to void if appender does
> that at all. But since Date.init would be equal to Date.init, it seems extremely
> bizarre that Interval!(Date).init would have its begin and end not be equal,
> which makes it less likely that Interval!(Date).init would be the problem. So, I
> don't know. The code is very thoroughly tested, but that doesn't mean that I
> didn't miss something, and it's possible that there's a bug in appender. I'm not
> at all familiar with how appender works. I'll have to take a look at it tonight.
> But std.datetime has a ton of unit tests and, as far as I know, is currently
> passing all of them on Linux, Windows, and OS X (I don't know about FreeBSD).
> The most likely problems would be on OS X or FreeBSD, since I don't have a
> system with either OS X or FreeBSD, and there could be problems in time zones
> other than America/Los_Angeles - particularly on Windows where you can't easily
> test time zones other than the one that you're in - since all of my development
> has been done in America/Los_Angeles. But I'm not aware of any bugs. So, if you
> do find problems, please report them.
> - Jonathan M Davis

I could not use an Interval in a Variant, because Interval defines a 
length property which does not return a size_t value, and Variant does 
not handle it (I have filed a report about this).

Not only the ton of unit tests in std.datetime appears to make it 
rock-solid, but it seems it is also a good test case for other standard 
modules! :)

More information about the Digitalmars-d-learn mailing list