BoostGSoC18 / tensor

Adding tensor support to boostorg/ublas
4 stars 1 forks source link

Unit-Test with Macros #8

Closed bassoy closed 6 years ago

bassoy commented 6 years ago

Do we need to specify macros in test/Jamfile.v2 causing different template classes to be instantiated for different tests? Can't we specify this within the unit tests for better encapsulation?

# Define features to test:
#  Value types: USE_FLOAT USE_DOUBLE USE_STD_COMPLEX
#  Proxies: USE_RANGE USE_SLICE
#  Storage types: USE_BOUNDED_ARRAY USE_UNBOUNDED_ARRAY
#  Vector types: USE_STD_VECTOR USE_BOUNDED_VECTOR
#  Matrix types: USE_MATRIX USE_BOUNDED_MATRIX USE_VECTOR_OF_VECTOR
# Adaptors: USE_ADAPTOR

UBLAS_TESTSET = [ modules.peek : UBLAS_TESTSET ] ;
UBLAS_TESTSET ?=
            USE_DOUBLE USE_STD_COMPLEX
            USE_RANGE USE_SLICE
            USE_UNBOUNDED_ARRAY USE_STD_VECTOR USE_BOUNDED_VECTOR USE_MATRIX
            ;

#  Sparse storage: USE_MAP_ARRAY USE_STD_MAP
#  Sparse vectors: USE_MAPPED_VECTOR USE_COMPRESSED_VECTOR USE_COORDINATE_VECTOR
#  Sparse matrices: USE_MAPPED_MATRIX USE_COMPRESSED_MATRIX USE_COORDINATE_MATRIX USE_MAPPED_VECTOR_OF_MAPPED_VECTOR USE_GENERALIZED_VECTOR_OF_VECTOR

UBLAS_TESTSET_SPARSE = [ modules.peek : UBLAS_TESTSET_SPARSE ] ;
UBLAS_TESTSET_SPARSE ?= 
            USE_DOUBLE USE_STD_COMPLEX
            # USE_RANGE USE_SLICE    # Too complex for regression testing
            USE_UNBOUNDED_ARRAY
            USE_MAP_ARRAY USE_STD_MAP
            USE_MAPPED_VECTOR USE_COMPRESSED_VECTOR 
            USE_MAPPED_MATRIX USE_COMPRESSED_MATRIX 
            ;
# Generalize VofV still failing
#            USE_GENERALIZED_VECTOR_OF_VECTOR

UBLAS_TESTSET_SPARSE_COO = [ modules.peek : UBLAS_TESTSET_SPARSE_COO ] ;
UBLAS_TESTSET_SPARSE_COO ?= 
            USE_DOUBLE USE_STD_COMPLEX
            USE_UNBOUNDED_ARRAY
            USE_COORDINATE_VECTOR
            USE_COORDINATE_MATRIX 
;
stefanseefeld commented 6 years ago

Definitely ! I'd prefer tests to define this (using parametrized tests, perhaps), so all we have to do in the build system is to select which tests to build / run.

bassoy commented 6 years ago

Yes, done so for the tensor unit tests. They are all fully parametrized and mostly use BOOST_FIXTURE_TEST_CASE_TEMPLATE where the template parameter is mostly defined as using test_types = zip<int,long,float,double,std::complex<float>>:: with_t<boost::numeric::ublas::first_order, boost::numeric::ublas::last_order>;