Data.Concurrent.Deque.Tests

abstract-deque-0.1.6: Abstract, parameterized interface to mutable Deques.

Safe Haskell | None
Language | Haskell98

Data.Concurrent.Deque.Tests

Contents

- Tests for simple FIFOs.
- Tests for Work-stealing queues.
- All deque tests, aggregated.

Description

This module contains a battery of simple tests for queues implementing the interface defined in ` Data.Concurrent.Deque.Class`.

Synopsis

- test_fifo_filldrain :: DequeClass d => d Int -> IO ()
- test_fifo_OneBottleneck :: DequeClass d => Bool -> Int -> d Int -> IO ()
- test_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 ()
- test_wsqueue :: PopL d => (forall elt. IO (d elt)) -> Test
- test_all :: PopL d => (forall elt. IO (d elt)) -> Test

# 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 ()

This test splits the `numAgents` threads into producers and consumers which all communicate through a SINGLE queue. Each thread performs its designated operation as fast as possible. The `Int` argument `total` designates how many total items should be communicated (irrespective of `numAgents`).

test_fifo :: DequeClass d => (forall elt. IO (d elt)) -> Test

This test uses a separate queue per consumer thread. The queues are used in a single-writer multiple-reader fashion (mailboxes).

This creates an HUnit test list to perform all the tests above.

# 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.

test_wsqueue :: PopL d => (forall elt. IO (d elt)) -> Test

Aggregate tests for work stealing queues.

# All deque tests, aggregated.

test_all :: PopL d => (forall elt. IO (d elt)) -> Test