[vsipl++] maxval_test
Jules Bergmann
jules at codesourcery.com
Mon Mar 26 17:09:59 UTC 2007
Assem Salama wrote:
> Everyone,
> This test tests the maxval operator. It creates a vector on a subset of
> the processors to test the processor mapping.
Assem,
This looks good. Please address the feedback below and then check it in.
thanks,
-- Jules
> ------------------------------------------------------------------------
Assem,
[1] This file should be called tests/maxval.cpp or tests/par_maxval.cpp.
The _test suffix isn't necessary for files in the tests directory.
[2] Please add a header. All source files in the library need a header.
In the future, please do this before posting a patch.
>
> #include <vsip/initfin.hpp>
> #include <vsip/support.hpp>
> #include <vsip/map.hpp>
> #include <vsip/vector.hpp>
> #include <vsip/selgen.hpp>
> #include <vsip_csl/output.hpp>
> #include <vsip/opt/general_dispatch.hpp>
> #include <vsip/core/reductions/reductions_idx.hpp>
[3] Why is it necessary to include these directly?
>
> if(max == float(size-1) && max_idx[0] == size-1)
> {
> #if DEBUG == 1
> std::cout << "Test passed\n";
> #endif
> return 0;
> } else
> {
> #if DEBUG == 1
> std::cout << "Test failed\n";
> #endif
> return -1;
> }
[4] To make this test easier to extend and easier to debug (if it
fails), it would better to use test_assert than returning the error code
from main, i.e. something like
#if DEBUG == 1
if(max == float(size-1) && max_idx[0] == size-1)
std::cout << "Test passed\n";
else
std::cout << "Test passed\n";
#endif
test_assert(max == float(size-1) && max_idx[0] == size-1);
--
Jules Bergmann
CodeSourcery
jules at codesourcery.com
(650) 331-3385 x705
More information about the vsipl++
mailing list