octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: missing tests


From: Carnë Draug
Subject: Re: missing tests
Date: Fri, 17 Jan 2014 12:12:54 +0000

On 16 January 2014 16:17, Markus Appel <address@hidden> wrote:
> On 01/16/2014 12:46 PM, Carnė Draug wrote:
>>
>> The tests look good to me, and quite extensive. I would add some to
>> matrices as well, not only scalars. Example:
>>
>> %!test
>> %! a = b = randi ([-1000 1000], 10, 15, 14, 78);
>> %! b(b>255) = 255;
>> %! b(b<0) = 0;
>> %! assert (cast (a, "uint8"), uint8 (b));
>>
>> Similarly, you could test that scalars works fine with one example,
>> and then all the other possibilities (complex numbers, above and below
>> the range, etc) in a matrix with a single test.
>>
>> Carnė
> Do you think that it is (in general) a good idea to use anything
> randomized in tests?
> If a check fails and needs to be examined, I would expect that exactly
> the same stuff gets tested every time I run it.

It is just a very convenient way to generate a matrix with multiple
different values. I guess one could set rand ("seed", X) before the
test to always get the same result. You probably right about it but
this has never been a problem.


On 17 January 2014 02:32, mike sander <address@hidden> wrote:
> makes sense.  was there any particular reason for 4 dimensions with those
> values?

Just testing that will work correctly, no matter how many dimensions
has the input.

>> Similarly, you could test that scalars works fine with one example,
>> and then all the other possibilities (complex numbers, above and below
>> the range, etc) in a matrix with a single test.
>
> any chance you could provide a simple example?

The example I shown you would test values below and above the range of
the class. Just thrown an i into the matrix to test for it as well. In
some classes that will generate an error.

Carnë


reply via email to

[Prev in Thread] Current Thread [Next in Thread]