Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
soitool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bachelor-paa-bittet
soitool
Commits
6f0caef4
Commit
6f0caef4
authored
5 years ago
by
morkolai
Browse files
Options
Downloads
Patches
Plain Diff
#29 Test for vurdering av kodelengde
parent
4edf66b7
No related branches found
Branches containing commit
No related tags found
1 merge request
!15
Kodebok-koder
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_coder.py
+7
-2
7 additions, 2 deletions
test/test_coder.py
with
7 additions
and
2 deletions
test/test_coder.py
+
7
−
2
View file @
6f0caef4
...
...
@@ -7,7 +7,7 @@ from soitool import coder
class
CoderTest
(
unittest
.
TestCase
):
"""
Test Coder.py.
"""
LEN
=
2
COMBINATIONS
=
len
(
ascii_uppercase
)
**
LEN
...
...
@@ -19,7 +19,7 @@ class CoderTest(unittest.TestCase):
def
test_get_code_set
(
self
):
"""
Test all codes are unique.
"""
codes
=
coder
.
get_code_set
(
self
.
COMBINATIONS
,
self
.
LEN
)
self
.
assert
Almost
Equal
(
self
.
COMBINATIONS
,
len
(
codes
))
self
.
assertEqual
(
self
.
COMBINATIONS
,
len
(
codes
))
# All possible permutations need to be inn codes
permutations_li
=
list
(
permutations
(
ascii_uppercase
,
self
.
LEN
))
...
...
@@ -32,6 +32,11 @@ class CoderTest(unittest.TestCase):
self
.
assertFalse
(
flag
)
def
test_get_code_lenght
(
self
):
"
Test return correct codelenght.
"
self
.
assertEqual
(
self
.
LEN
,
coder
.
get_code_lenght
(
self
.
COMBINATIONS
))
self
.
assertEqual
(
3
,
coder
.
get_code_lenght
(
len
(
ascii_uppercase
)
**
3
))
if
__name__
==
'
__main__
'
:
unittest
.
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment