datetime review part 2 [Update 4]

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 9 17:45:16 PST 2010


On Tuesday, November 09, 2010 16:42:32 bearophile wrote:
> > An option may be to modify the compiler so it allows to override
> > protection in code contained inside unittest{...}.
> 
> Another option is to modify the compiler so it sees unittests modules as
> part of another module (using a mixin() on a string import is too much
> hacky).

Having named unit tests would help a lot. Without those splitting out the unit 
tests is a total no-go for me. I have definitely found that managing the unit 
tests is easier when they are next to the functions that they're testing rather 
than elsewhere. If they were named, then they would be easier to keep track of 
at it would not be as big a deal, but it would stilll be problematic since it 
would be harder to verify that each function is indeed properly tested. As it 
is, you can just look right under the function to see its unit tests. It does 
make it harder to find the actual functions, but I think that the maintainability 
of having the unit tests right next to the functions is worth more. A proper IDE 
would even negate the problem entirely, since then you could click on the 
function name to go to.

As for simplifying the tests, a lot of them just would not turn into a loop very 
well unless you were willing to increase the number of values being tested by a 
fair margin. That would make the tests take that much longer to run. I'm sure 
that if I took the time to, I could reduce some of the tests in terms of lines 
of code without reducing what is being tested, but that's a lot of work to go to 
at this point, and I have better things to be doing. Having the number of tests 
that I do has been a big help, and if anything, there probably aren't enough of 
them, so I'm not going to listen to any arguments to reduce their number (which 
you apparently weren't arguing). I do agree that reducing their space could be 
useful, but again, it would be a lot of work to do - many don't reduce as nicely 
as they might first appear to, and that's a lot of tests to got through. If 
Andrei were to insist that it be done before being put into Phobos, then I'd 
have to do it, but as it is, they work, and I'd rather be spending my time on 
more productive things. Maybe I'll spend some time to try and reduce the test 
line count without reducing the tests at some point, but it does not seem worth 
it right now.

- Jonathan M Davis


More information about the Digitalmars-d mailing list