Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CoPaR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Informatik 8
CoPaR
Commits
4ac6cc5b
Commit
4ac6cc5b
authored
6 years ago
by
Hans-Peter Deifel
Browse files
Options
Downloads
Patches
Plain Diff
tests: Ensure queue size is always positive
Queue.empty was being called with negative sizes
parent
182e88da
No related branches found
No related tags found
No related merge requests found
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/Data/BlockQueueSpec.hs
+2
-9
2 additions, 9 deletions
tests/Data/BlockQueueSpec.hs
with
2 additions
and
9 deletions
tests/Data/BlockQueueSpec.hs
+
2
−
9
View file @
4ac6cc5b
...
...
@@ -10,9 +10,6 @@ import Test.QuickCheck
import
Control.Monad.ST
import
qualified
Data.List
as
List
(
delete
)
import
Data.Vector
(
Vector
)
import
qualified
Data.Vector
as
V
import
Data.BlockQueue
import
Data.RefinablePartition
(
Block
(
..
))
...
...
@@ -24,10 +21,10 @@ spec = do
emptySpec
::
Spec
emptySpec
=
describe
"empty"
$
do
it
"creates an empty queue"
$
property
$
\
size
s
->
runST
$
empty
size
s
>>=
null
property
$
\
size
-
>
size
>=
0
==
>
runST
$
empty
size
>>=
null
it
"creates a queue where no block is present"
$
property
$
\
size
->
runST
$
do
property
$
\
size
->
size
>=
0
==>
runST
$
do
q
<-
empty
size
all
not
<$>
mapM
(
\
b
->
Block
b
`
elem
`
q
)
[
0
..
size
-
1
]
...
...
@@ -55,7 +52,3 @@ enqueueSpec = describe "enqueue" $ do
Just
0
<-
dequeue
q
null
q
in
runST
enqtwice
`
shouldBe
`
True
instance
Arbitrary
a
=>
Arbitrary
(
Vector
a
)
where
arbitrary
=
V
.
fromList
<$>
arbitrary
shrink
=
fmap
V
.
fromList
.
shrink
.
V
.
toList
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