Re: [math] Checking preconditions on package private functions

2012-11-29 Thread Ted Dunning
That's fine. I think raw use of reflection might make the tests pretty complicated, but the idea is reasonable. Jmockit allows mocking of static methods (I have used it to mock System.nanoTime(), for instance). By using a partial mock class, you can gain access to private methods as well. On Th

Re: [math] Checking preconditions on package private functions

2012-11-29 Thread Sébastien Brisard
Hi, 2012/11/27 Gilles Sadowski > Hello. > > > > [...] > > Actually, I would like the methods to be tested, so they cannot be > > private. That's the reason why I made them package private. > > You can indirectly test them by passing appropriate arguments to the public > methods that use them. P

Re: [math] Checking preconditions on package private functions

2012-11-27 Thread Gilles Sadowski
Hello. > > [...] > Actually, I would like the methods to be tested, so they cannot be > private. That's the reason why I made them package private. You can indirectly test them by passing appropriate arguments to the public methods that use them. Please do not select a visibility scope just for t

Re: [math] Checking preconditions on package private functions

2012-11-27 Thread Sébastien Brisard
Hi, 2012/11/27 Gilles Sadowski > On Tue, Nov 27, 2012 at 07:22:26AM -0800, Phil Steitz wrote: > > On 11/27/12 6:42 AM, Gilles Sadowski wrote: > > > On Tue, Nov 27, 2012 at 06:24:26AM -0800, Ted Dunning wrote: > > >> Actually, I would still recommend checks. You may know what the code > does >

Re: [math] Checking preconditions on package private functions

2012-11-27 Thread Gilles Sadowski
On Tue, Nov 27, 2012 at 08:15:13AM -0800, Ted Dunning wrote: > > I can only say from my own experience that people make mistakes over time and > having the code warn them when that happens is a good thing. > > Your experience may be different but I have to admit that I have done some > pretty

Re: [math] Checking preconditions on package private functions

2012-11-27 Thread Ted Dunning
I can only say from my own experience that people make mistakes over time and having the code warn them when that happens is a good thing. Your experience may be different but I have to admit that I have done some pretty silly things along the lines of forgetting to follow some constraint.

Re: [math] Checking preconditions on package private functions

2012-11-27 Thread Gilles Sadowski
On Tue, Nov 27, 2012 at 07:22:26AM -0800, Phil Steitz wrote: > On 11/27/12 6:42 AM, Gilles Sadowski wrote: > > On Tue, Nov 27, 2012 at 06:24:26AM -0800, Ted Dunning wrote: > >> Actually, I would still recommend checks. You may know what the code does > >> now, but you can't trust either yourself o

Re: [math] Checking preconditions on package private functions

2012-11-27 Thread Phil Steitz
On 11/27/12 6:42 AM, Gilles Sadowski wrote: > On Tue, Nov 27, 2012 at 06:24:26AM -0800, Ted Dunning wrote: >> Actually, I would still recommend checks. You may know what the code does >> now, but you can't trust either yourself or somebody else in the future. >> Better to do the checks. > I don't

Re: [math] Checking preconditions on package private functions

2012-11-27 Thread Gilles Sadowski
On Tue, Nov 27, 2012 at 06:24:26AM -0800, Ted Dunning wrote: > Actually, I would still recommend checks. You may know what the code does > now, but you can't trust either yourself or somebody else in the future. > Better to do the checks. I don't agree because in this case, the situation is akin

Re: [math] Checking preconditions on package private functions

2012-11-27 Thread Ted Dunning
Actually, I would still recommend checks. You may know what the code does now, but you can't trust either yourself or somebody else in the future. Better to do the checks. On Tue, Nov 27, 2012 at 3:27 AM, Gilles Sadowski < gil...@harfang.homelinux.org> wrote: > Then the answer would be: no > ch

Re: [math] Checking preconditions on package private functions

2012-11-27 Thread Gilles Sadowski
Hello. > > > in classes Gamma and Beta, some functions are package private: > > > - logGammaSum > > > - logGammaMinusLogGammaSum (for lack of a better name) > > > - bcorr > > > These functions are meant to be used by other functions, > > > > None of these functions seem to used. Am I missing

Re: [math] Checking preconditions on package private functions

2012-11-26 Thread Sébastien Brisard
Hi, 2012/11/26 Gilles Sadowski > Hi. > > > in classes Gamma and Beta, some functions are package private: > > - logGammaSum > > - logGammaMinusLogGammaSum (for lack of a better name) > > - bcorr > > These functions are meant to be used by other functions, > > None of these functions seem

Re: [math] Checking preconditions on package private functions

2012-11-26 Thread Gilles Sadowski
Hi. > in classes Gamma and Beta, some functions are package private: > - logGammaSum > - logGammaMinusLogGammaSum (for lack of a better name) > - bcorr > These functions are meant to be used by other functions, None of these functions seem to used. Am I missing something? Gilles > like l

[math] Checking preconditions on package private functions

2012-11-26 Thread Sébastien Brisard
Hi, in classes Gamma and Beta, some functions are package private: - logGammaSum - logGammaMinusLogGammaSum (for lack of a better name) - bcorr These functions are meant to be used by other functions, like logBeta. Each of these functions have their own domain, and in logBeta, we make sure no