Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
PRRT
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
26
Issues
26
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LARN
PRRT
Commits
f39b2c61
Commit
f39b2c61
authored
Apr 26, 2019
by
Ashkan Taslimi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add three unittests for redundancy information function in PrrtCodingConfiguration class.
parent
3174ca5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
tests/prrt/prrt_coding_configuration_test.py
tests/prrt/prrt_coding_configuration_test.py
+38
-0
No files found.
tests/prrt/prrt_coding_configuration_test.py
0 → 100644
View file @
f39b2c61
import
unittest
import
math
# import os, sys
# import pyximport
# pyximport.install()
# sys.path.append(os.path.join(os.path.dirname(__file__), '/home/local/Documents/thesis/hecps/code/PRRT/prrt'))
import
prrt
# print(sys.path)
# print(dir(prrt.__path__))
# print(prrt.__file__)
class
TestStringMethods
(
unittest
.
TestCase
):
def
test_ri_01
(
self
):
print
(
"Begin test 01: n, k, p_e, n_p: 5, 2, 0.1, [0, 1, 2]"
)
prrt_cc_obj
=
prrt
.
PrrtCodingConfiguration
(
5
,
2
,
0.1
,
[
0
,
1
,
2
])
prrt_cc_obj
=
prrt_cc_obj
.
get_redundant_information
()
print
(
prrt_cc_obj
)
assert
math
.
isclose
(
prrt_cc_obj
,
0.01445
,
rel_tol
=
1e-03
)
def
test_ri_02
(
self
):
print
(
"Begin test 02: n, k, p_e, n_p: 5, 2, 0.01, [0, 1, 2]"
)
prrt_cc_obj
=
prrt
.
PrrtCodingConfiguration
(
5
,
2
,
0.01
,
[
0
,
1
,
2
])
prrt_cc_obj
=
prrt_cc_obj
.
get_redundant_information
()
print
(
prrt_cc_obj
)
assert
math
.
isclose
(
prrt_cc_obj
,
0.0001490496
,
rel_tol
=
1e-03
)
def
test_ri_03
(
self
):
print
(
"Begin test 03: n, k, p_e, n_p: 8, 2, 0.1, [1, 1, 2, 2]"
)
prrt_cc_obj
=
prrt
.
PrrtCodingConfiguration
(
8
,
2
,
0.1
,
[
1
,
1
,
2
,
2
])
prrt_cc_obj
=
prrt_cc_obj
.
get_redundant_information
()
print
(
prrt_cc_obj
)
assert
math
.
isclose
(
prrt_cc_obj
,
0.50190719
,
rel_tol
=
1e-03
)
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
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