Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dr. Michael Petter
LLVM-abstractinterpretation
Commits
68f025d9
Verified
Commit
68f025d9
authored
Mar 16, 2020
by
Tim Gymnich
Browse files
added some tests
parent
7eb7a208
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/affine_relation_test.cpp
View file @
68f025d9
...
...
@@ -9,16 +9,81 @@
using
namespace
std
;
using
namespace
pcpo
;
template
<
typename
T
>
class
AffineRelationTest
:
AffineRelation
<
T
>
{
class
AffineRelationTest
:
AffineRelation
{
public:
static
bool
runTestLeastUpperBound1
();
static
bool
runTestLeastUpperBound2
();
};
bool
AffineRelationTest
::
runTestLeastUpperBound1
()
{
std
::
cout
<<
"Testing least upper bound 1: "
;
bool
result
=
false
;
AffineRelation
r1
=
AffineRelation
();
r1
.
isBottom
=
false
;
r1
.
basis
=
{
Matrix
<
T
>
(
4
)};
AffineRelation
r2
=
AffineRelation
();
r2
.
isBottom
=
false
;
r2
.
basis
=
{
Matrix
<
T
>
(
4
)};
AffineRelation
expected
=
AffineRelation
();
expected
.
basis
=
{
Matrix
<
T
>
(
4
)};
auto
actual
=
r1
.
leastUpperBound
(
r2
);
result
=
r1
.
basis
==
expected
.
basis
&&
!
actual
&&
!
r1
.
isBottom
;
std
::
cout
<<
(
result
?
"success"
:
"failed"
)
<<
"
\n
"
;
return
result
;
}
bool
AffineRelationTest
::
runTestLeastUpperBound2
()
{
std
::
cout
<<
"Testing least upper bound 2: "
;
bool
result
=
false
;
AffineRelation
r1
=
AffineRelation
();
r1
.
isBottom
=
false
;
Matrix
<
T
>
b1
=
Matrix
<
T
>
(
4
);
b1
(
0
,
1
)
=
1
;
b1
(
2
,
1
)
=
1
;
r1
.
basis
=
{
b1
};
AffineRelation
r2
=
AffineRelation
();
r2
.
isBottom
=
false
;
Matrix
<
T
>
b2
=
Matrix
<
T
>
(
4
);
b2
(
0
,
3
)
=
1
;
r2
.
basis
=
{
b2
};
AffineRelation
expected
=
AffineRelation
();
Matrix
<
T
>
e1
=
Matrix
<
T
>
(
4
);
e1
(
0
,
3
)
=
1
;
Matrix
<
T
>
e2
=
Matrix
<
T
>
(
4
);
e2
(
0
,
0
)
=
0
;
e2
(
1
,
1
)
=
0
;
e2
(
2
,
2
)
=
0
;
e2
(
3
,
3
)
=
0
;
e2
(
0
,
1
)
=
1
;
e2
(
2
,
1
)
=
1
;
e2
(
0
,
3
)
=
-
1
;
expected
.
basis
=
{
e1
,
e2
};
auto
actual
=
r1
.
leastUpperBound
(
r2
);
result
=
r1
.
basis
==
expected
.
basis
&&
actual
&&
!
r1
.
isBottom
;
std
::
cout
<<
(
result
?
"success"
:
"failed"
)
<<
"
\n
"
;
return
result
;
}
int
main
()
{
return
true
;
return
!
(
AffineRelationTest
::
runTestLeastUpperBound1
()
&&
AffineRelationTest
::
runTestLeastUpperBound2
()
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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