Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cwe_checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
cwe_checker
Commits
1e46589f
Unverified
Commit
1e46589f
authored
Jul 20, 2022
by
Enkelmann
Committed by
GitHub
Jul 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify more cases of trivial expressions (#346)
parent
44ec840b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
tests.rs
...r_lib/src/intermediate_representation/expression/tests.rs
+19
-0
trivial_operation_substitution.rs
...presentation/expression/trivial_operation_substitution.rs
+0
-0
No files found.
src/cwe_checker_lib/src/intermediate_representation/expression/tests.rs
View file @
1e46589f
...
...
@@ -268,6 +268,25 @@ fn trivial_expression_substitution() {
rhs
:
Box
::
new
(
setup
.rax_variable
.clone
()),
}
);
// Test (x - const_1) - const_2 = x - (const_1 + const_2)
let
mut
expr
=
Expression
::
BinOp
{
lhs
:
Box
::
new
(
Expression
::
BinOp
{
lhs
:
Box
::
new
(
setup
.rax_variable
.clone
()),
op
:
BinOpType
::
IntSub
,
rhs
:
Box
::
new
(
Expression
::
Const
(
Bitvector
::
from_i64
(
3
))),
}),
op
:
BinOpType
::
IntSub
,
rhs
:
Box
::
new
(
Expression
::
Const
(
Bitvector
::
from_i64
(
4
))),
};
expr
.substitute_trivial_operations
();
assert_eq!
(
expr
,
Expression
::
BinOp
{
lhs
:
Box
::
new
(
setup
.rax_variable
.clone
()),
op
:
BinOpType
::
IntSub
,
rhs
:
Box
::
new
(
Expression
::
Const
(
Bitvector
::
from_i64
(
7
)))
}
);
}
#[test]
...
...
src/cwe_checker_lib/src/intermediate_representation/expression/trivial_operation_substitution.rs
View file @
1e46589f
This diff is collapsed.
Click to expand it.
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