FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pyt/tests/liveness_test.py at 8githubScanRefactor · python-security/pyt · GitHub
python-security
pyt
Repository navigation
Code
Issues
26
(26)
Pull requests
2
(2)
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
pyt
/
tests
/
liveness_test.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (28 loc) · 1.37 KB
Breadcrumbs
pyt
/
tests
/
liveness_test.py
Copy path
File metadata and controls
34 lines (28 loc) · 1.37 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from
.
analysis_base_test_case
import
AnalysisBaseTestCase
from
pyt
.
constraint_table
import
constraint_table
from
pyt
.
liveness
import
LivenessAnalysis
class
LivenessTest
(
AnalysisBaseTestCase
):
def
test_example
(
self
):
lattice
=
self
.
run_analysis
(
'example/example_inputs/example.py'
,
LivenessAnalysis
)
x
=
0b1
y
=
0b10
z
=
0b100
lattice
.
el2bv
[
'x'
]
=
x
lattice
.
el2bv
[
'y'
]
=
y
lattice
.
el2bv
[
'z'
]
=
z
"""
self.assertEqual(constraint_table[self.cfg.nodes[0]], 0)
self.assertEqual(constraint_table[self.cfg.nodes[1]], 0)
self.assertEqual(constraint_table[self.cfg.nodes[2]], x)
self.assertEqual(constraint_table[self.cfg.nodes[3]], x)
self.assertEqual(constraint_table[self.cfg.nodes[4]], x)
self.assertEqual(constraint_table[self.cfg.nodes[5]], x | y)
self.assertEqual(constraint_table[self.cfg.nodes[6]], x | y)
self.assertEqual(constraint_table[self.cfg.nodes[7]], x)
self.assertEqual(constraint_table[self.cfg.nodes[8]], x | z)
self.assertEqual(constraint_table[self.cfg.nodes[9]], x | z)
self.assertEqual(constraint_table[self.cfg.nodes[10]], x | z)
self.assertEqual(constraint_table[self.cfg.nodes[11]], x)
self.assertEqual(constraint_table[self.cfg.nodes[12]], 0)
self.assertEqual(len(lattice.el2bv), 3)
"""
Back
|
FazBrowse Home
|
New Git URL