Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
5cd6e870
Commit
5cd6e870
authored
May 08, 2019
by
Praetorius, Simon
Browse files
add test for static-size
parent
35255bb2
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/CMakeLists.txt
View file @
5cd6e870
...
...
@@ -67,12 +67,15 @@ dune_add_test(SOURCES RangeTypeTest.cpp
dune_add_test
(
SOURCES ResizeTest.cpp
LINK_LIBRARIES amdis
)
dune_add_test
(
SOURCES S
witchCases
Test.cpp
dune_add_test
(
SOURCES S
taticSize
Test.cpp
LINK_LIBRARIES amdis
)
dune_add_test
(
SOURCES StringTest.cpp
LINK_LIBRARIES amdis
)
dune_add_test
(
SOURCES SwitchCasesTest.cpp
LINK_LIBRARIES amdis
)
dune_add_test
(
SOURCES TreeDataTest.cpp
LINK_LIBRARIES amdis
)
...
...
test/StaticSizeTest.cpp
0 → 100644
View file @
5cd6e870
#include
<amdis/AMDiS.hpp>
#include
<amdis/common/StaticSize.hpp>
#include
<dune/common/fvector.hh>
#include
<dune/common/fmatrix.hh>
#include
<dune/istl/multitypeblockvector.hh>
#include
<dune/istl/multitypeblockmatrix.hh>
#if HAVE_EIGEN
#include
<Eigen/Dense>
#endif
#include
"Tests.hpp"
using
namespace
AMDiS
;
struct
Null
{};
int
main
(
int
argc
,
char
**
argv
)
{
Environment
env
(
argc
,
argv
);
static_assert
(
Size_v
<
double
>
==
1
,
""
);
static_assert
(
Rows_v
<
double
>
==
1
,
""
);
static_assert
(
Cols_v
<
double
>
==
1
,
""
);
static_assert
(
Size_v
<
Null
>
==
0
,
""
);
static_assert
(
Rows_v
<
Null
>
==
0
,
""
);
static_assert
(
Cols_v
<
Null
>
==
0
,
""
);
using
Vec1
=
Dune
::
FieldVector
<
double
,
2
>
;
using
Vec2
=
Dune
::
MultiTypeBlockVector
<
double
,
double
>
;
using
Vec3
=
std
::
array
<
double
,
2
>
;
using
Vec4
=
std
::
tuple
<
double
,
double
>
;
using
Vec5
=
Dune
::
TupleVector
<
double
,
double
>
;
static_assert
(
Size_v
<
Vec1
>
==
2
,
""
);
static_assert
(
Size_v
<
Vec2
>
==
2
,
""
);
static_assert
(
Size_v
<
Vec3
>
==
2
,
""
);
static_assert
(
Size_v
<
Vec4
>
==
2
,
""
);
static_assert
(
Size_v
<
Vec5
>
==
2
,
""
);
using
Mat1
=
Dune
::
FieldMatrix
<
double
,
2
,
2
>
;
using
Mat2
=
Dune
::
MultiTypeBlockMatrix
<
Vec2
,
Vec2
>
;
static_assert
(
Rows_v
<
Mat1
>
==
2
,
""
);
static_assert
(
Cols_v
<
Mat1
>
==
2
,
""
);
static_assert
(
Rows_v
<
Mat2
>
==
2
,
""
);
static_assert
(
Cols_v
<
Mat2
>
==
2
,
""
);
#if HAVE_EIGEN
using
Vec6
=
Eigen
::
Vector2d
;
using
Vec7
=
Eigen
::
Matrix
<
double
,
2
,
1
>
;
using
Vec8
=
Eigen
::
Matrix
<
double
,
1
,
2
>
;
static_assert
(
Size_v
<
Vec6
>
==
2
,
""
);
static_assert
(
Size_v
<
Vec7
>
==
2
,
""
);
static_assert
(
Size_v
<
Vec8
>
==
2
,
""
);
using
Mat3
=
Eigen
::
Matrix2d
;
using
Mat4
=
Eigen
::
Matrix
<
double
,
2
,
2
>
;
static_assert
(
Rows_v
<
Mat3
>
==
2
,
""
);
static_assert
(
Cols_v
<
Mat3
>
==
2
,
""
);
static_assert
(
Rows_v
<
Mat4
>
==
2
,
""
);
static_assert
(
Cols_v
<
Mat4
>
==
2
,
""
);
#endif
return
0
;
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment