Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Software
CoPaR
Commits
4ac6cc5b
Commit
4ac6cc5b
authored
Dec 23, 2018
by
Hans-Peter Deifel
🐢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: Ensure queue size is always positive
Queue.empty was being called with negative sizes
parent
182e88da
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
9 deletions
+2
-9
tests/Data/BlockQueueSpec.hs
tests/Data/BlockQueueSpec.hs
+2
-9
No files found.
tests/Data/BlockQueueSpec.hs
View file @
4ac6cc5b
...
@@ -10,9 +10,6 @@ import Test.QuickCheck
...
@@ -10,9 +10,6 @@ import Test.QuickCheck
import
Control.Monad.ST
import
Control.Monad.ST
import
qualified
Data.List
as
List
(
delete
)
import
qualified
Data.List
as
List
(
delete
)
import
Data.Vector
(
Vector
)
import
qualified
Data.Vector
as
V
import
Data.BlockQueue
import
Data.BlockQueue
import
Data.RefinablePartition
(
Block
(
..
))
import
Data.RefinablePartition
(
Block
(
..
))
...
@@ -24,10 +21,10 @@ spec = do
...
@@ -24,10 +21,10 @@ spec = do
emptySpec
::
Spec
emptySpec
::
Spec
emptySpec
=
describe
"empty"
$
do
emptySpec
=
describe
"empty"
$
do
it
"creates an empty queue"
$
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"
$
it
"creates a queue where no block is present"
$
property
$
\
size
->
runST
$
do
property
$
\
size
->
size
>=
0
==>
runST
$
do
q
<-
empty
size
q
<-
empty
size
all
not
<$>
mapM
(
\
b
->
Block
b
`
elem
`
q
)
[
0
..
size
-
1
]
all
not
<$>
mapM
(
\
b
->
Block
b
`
elem
`
q
)
[
0
..
size
-
1
]
...
@@ -55,7 +52,3 @@ enqueueSpec = describe "enqueue" $ do
...
@@ -55,7 +52,3 @@ enqueueSpec = describe "enqueue" $ do
Just
0
<-
dequeue
q
Just
0
<-
dequeue
q
null
q
null
q
in
runST
enqtwice
`
shouldBe
`
True
in
runST
enqtwice
`
shouldBe
`
True
instance
Arbitrary
a
=>
Arbitrary
(
Vector
a
)
where
arbitrary
=
V
.
fromList
<$>
arbitrary
shrink
=
fmap
V
.
fromList
.
shrink
.
V
.
toList
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