Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
c0b99fbd
There was an error fetching the commit references. Please try again later.
Commit
c0b99fbd
authored
6 years ago
by
Lukas Cejka
Browse files
Options
Downloads
Patches
Plain Diff
Added templating for first two tests.
parent
3adc0a5f
No related branches found
No related tags found
1 merge request
!16
Matrices
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/UnitTests/Matrices/SparseMatrixTest.h
+82
-27
82 additions, 27 deletions
src/UnitTests/Matrices/SparseMatrixTest.h
with
82 additions
and
27 deletions
src/UnitTests/Matrices/SparseMatrixTest.h
+
82
−
27
View file @
c0b99fbd
...
...
@@ -756,6 +756,61 @@ void test_Print()
EXPECT_EQ
(
printed
.
str
(),
couted
.
str
()
);
}
// test fixture for typed tests
template
<
typename
Matrix
>
class
SparseMatrixTest
:
public
::
testing
::
Test
{
protected:
using
SparseMatrixType
=
Matrix
;
};
// types for which MatrixTest is instantiated
using
SparseMatrixTypes
=
::
testing
::
Types
<
TNL
::
Matrices
::
CSR
<
int
,
TNL
::
Devices
::
Host
,
short
>
,
TNL
::
Matrices
::
CSR
<
long
,
TNL
::
Devices
::
Host
,
short
>
,
TNL
::
Matrices
::
CSR
<
float
,
TNL
::
Devices
::
Host
,
short
>
,
TNL
::
Matrices
::
CSR
<
double
,
TNL
::
Devices
::
Host
,
short
>
,
TNL
::
Matrices
::
CSR
<
int
,
TNL
::
Devices
::
Host
,
int
>
,
TNL
::
Matrices
::
CSR
<
long
,
TNL
::
Devices
::
Host
,
int
>
,
TNL
::
Matrices
::
CSR
<
float
,
TNL
::
Devices
::
Host
,
int
>
,
TNL
::
Matrices
::
CSR
<
double
,
TNL
::
Devices
::
Host
,
int
>
,
TNL
::
Matrices
::
CSR
<
int
,
TNL
::
Devices
::
Host
,
long
>
,
TNL
::
Matrices
::
CSR
<
long
,
TNL
::
Devices
::
Host
,
long
>
,
TNL
::
Matrices
::
CSR
<
float
,
TNL
::
Devices
::
Host
,
long
>
,
TNL
::
Matrices
::
CSR
<
double
,
TNL
::
Devices
::
Host
,
long
>
,
#ifdef HAVE_CUDA
TNL
::
Matrices
::
CSR
<
int
,
TNL
::
Devices
::
Cuda
,
short
>
,
TNL
::
Matrices
::
CSR
<
long
,
TNL
::
Devices
::
Cuda
,
short
>
,
TNL
::
Matrices
::
CSR
<
float
,
TNL
::
Devices
::
Cuda
,
short
>
,
TNL
::
Matrices
::
CSR
<
double
,
TNL
::
Devices
::
Cuda
,
short
>
,
TNL
::
Matrices
::
CSR
<
int
,
TNL
::
Devices
::
Cuda
,
int
>
,
TNL
::
Matrices
::
CSR
<
long
,
TNL
::
Devices
::
Cuda
,
int
>
,
TNL
::
Matrices
::
CSR
<
float
,
TNL
::
Devices
::
Cuda
,
int
>
,
TNL
::
Matrices
::
CSR
<
double
,
TNL
::
Devices
::
Cuda
,
int
>
,
TNL
::
Matrices
::
CSR
<
int
,
TNL
::
Devices
::
Cuda
,
long
>
,
TNL
::
Matrices
::
CSR
<
long
,
TNL
::
Devices
::
Cuda
,
long
>
,
TNL
::
Matrices
::
CSR
<
float
,
TNL
::
Devices
::
Cuda
,
long
>
,
TNL
::
Matrices
::
CSR
<
double
,
TNL
::
Devices
::
Cuda
,
long
>
#endif
>
;
TYPED_TEST_CASE
(
SparseMatrixTest
,
SparseMatrixTypes
);
TYPED_TEST
(
SparseMatrixTest
,
setDimensionsTest
)
{
using
SparseMatrixType
=
typename
TestFixture
::
SparseMatrixType
;
test_SetDimensions
<
SparseMatrixType
>
();
}
TYPED_TEST
(
SparseMatrixTest
,
setCompressedRowLengthsTest
)
{
using
SparseMatrixType
=
typename
TestFixture
::
SparseMatrixType
;
test_SetCompressedRowLengths
<
SparseMatrixType
>
();
}
//// test_getType is not general enough yet. DO NOT TEST IT YET.
//TEST( SparseMatrixTest, CSR_GetTypeTest_Host )
...
...
@@ -770,34 +825,34 @@ void test_Print()
//}
//#endif
TEST
(
SparseMatrixTest
,
CSR_setDimensionsTest_Host
)
{
test_SetDimensions
<
CSR_host_int
>
();
}
#ifdef HAVE_CUDA
TEST
(
SparseMatrixTest
,
CSR_setDimensionsTest_Cuda
)
{
test_SetDimensions
<
CSR_cuda_int
>
();
}
#endif
TEST
(
SparseMatrixTest
,
CSR_setCompressedRowLengthsTest_Host
)
{
test_SetCompressedRowLengths
<
CSR_host_int
>
();
}
#ifdef HAVE_CUDA
TEST
(
SparseMatrixTest
,
CSR_setCompressedRowLengthsTest_Cuda
)
{
test_SetCompressedRowLengths
<
CSR_cuda_int
>
();
}
#endif
//TEST( SparseMatrixTest, CSR_setDimensionsTest_Host )
//{
// test_SetDimensions< CSR_host_int >();
//}
//
//#ifdef HAVE_CUDA
//TEST( SparseMatrixTest, CSR_setDimensionsTest_Cuda )
//{
// test_SetDimensions< CSR_cuda_int >();
//}
//#endif
TEST
(
SparseMatrixTest
,
CSR_setLikeTest_Host
)
{
test_SetLike
<
CSR_host_int
,
CSR_host_float
>
();
}
//TEST( SparseMatrixTest, CSR_setCompressedRowLengthsTest_Host )
//{
// test_SetCompressedRowLengths< CSR_host_int >();
//}
//
//#ifdef HAVE_CUDA
//TEST( SparseMatrixTest, CSR_setCompressedRowLengthsTest_Cuda )
//{
// test_SetCompressedRowLengths< CSR_cuda_int >();
//}
//#endif
//
//TEST( SparseMatrixTest, CSR_setLikeTest_Host )
//{
// test_SetLike< CSR_host_int, CSR_host_float >();
//}
#ifdef HAVE_CUDA
TEST
(
SparseMatrixTest
,
CSR_setLikeTest_Cuda
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment