HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleabstract-deque-tests-0.3Haskell98

Data.Concurrent.Deque.Tests

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

  • 1 type
  • 18 values

Tests for simple FIFOs.

3 declarations
valuetest_fifo_OneBottleneck :: DequeClass d => Bool -> Int -> d Elt -> 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).

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

4 declarations
valuetests_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.

1 declaration
valuetests_all :: PopL d => (forall elt. IO (d elt)) -> Test
#

This requires double ended queues that are threadsafe on BOTH ends.

Testing parameters

3 declarations
valuegetNumAgents :: IO Int
#

How many communicating agents are there? By default one per thread used by the RTS.

valueproducerRatio :: Double
#

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

Utility for tweaking test suites

3 declarations
valuesetTestThreads :: Int -> Test -> Test
#

Dig through the test constructors to find the leaf IO actions and bracket them with a thread-setting action.

valueappendLabels :: String -> [Test] -> Test
#

This version has the option of being smarter about how it handles uniformly labeling many tests.

valueappendLabel :: String -> Test -> Test
#

Dig through the test constructors and add a new string to the first label found. If no such label exists, add one.

Test initialization, reading common configs

2 declarations

Misc helpers

3 declarations