Safe Haskell | None |
---|
Data.Concurrent.Deque.Tests
Contents
Description
This module contains a battery of simple tests for queues implementing the interface defined in ` Data.Concurrent.Deque.Class`.
- test_fifo_filldrain :: DequeClass d => d Int -> IO ()
- test_fifo_OneBottleneck :: DequeClass d => Bool -> Int -> d Int -> IO ()
- tests_fifo :: DequeClass d => (forall elt. IO (d elt)) -> Test
- test_ws_triv1 :: PopL d => d [Char] -> IO ()
- test_ws_triv2 :: PopL d => d [Char] -> IO ()
- tests_wsqueue :: PopL d => (forall elt. IO (d elt)) -> Test
- tests_all :: PopL d => (forall elt. IO (d elt)) -> Test
- numElems :: Int
- numAgents :: Int
- producerRatio :: Double
Tests for simple FIFOs.
test_fifo_filldrain :: DequeClass d => d Int -> IO ()
This test serially fills up a queue and then drains it.
test_fifo_OneBottleneck :: DequeClass d => Bool -> Int -> d Int -> IO ()
tests_fifo :: DequeClass d => (forall elt. IO (d elt)) -> Test
This creates an HUnit test list to perform all the tests that apply to a single-ended (threadsafe) queue. It requires thread safety at both ends.
Tests for Work-stealing queues.
test_ws_triv1 :: PopL d => d [Char] -> IO ()
Trivial test: push then pop.
test_ws_triv2 :: PopL d => d [Char] -> IO ()
Trivial test: push left, pop left and right.
tests_wsqueue :: PopL d => (forall elt. IO (d elt)) -> Test
Aggregate tests for work stealing queues. None of these require thread-safety on the left end. There is some duplication with tests_fifo.
All deque tests, aggregated.
tests_all :: PopL d => (forall elt. IO (d elt)) -> Test
This requires double ended queues that are threadsafe on BOTH ends.
Testing parameters
It is possible to have imbalanced concurrency where there is more contention on the producing or consuming side (which corresponds to settings of this parameter less than or greater than 1).