Skip to content

Commit

Permalink
Simplify the test suite
Browse files Browse the repository at this point in the history
The tasty stuff results in a more complicated eventlog, which is distracting.
  • Loading branch information
edsko committed Jan 14, 2025
1 parent e6b2dee commit 3563300
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
37 changes: 10 additions & 27 deletions trace-foreign-calls/test/Main.hs
Original file line number Diff line number Diff line change
@@ -1,34 +1,17 @@
module Main (main) where

import Control.Concurrent.Async (concurrently)
import Test.Tasty
import Test.Tasty.HUnit
import Test.Tasty.Runners (NumThreads(..))

import Test.TraceForeignCalls.UsePlugin

main :: IO ()
main = defaultMain $ localOption (NumThreads 1) $
testGroup "trace-foreign-calls" [
testCase "answerIO" $ do
answer <- answerIO
assertEqual "" 42 $ answer
, testCase "answerPure" $ do
let answer = answerPure
assertEqual "" 42 $ answer
, testCase "slowAddIO" $ do
let a = 1_000_000_000
b = 2_000_000_000
result <- slowAddIO a b
assertEqual "" (a + b) $ result
, testCase "slowAddPure" $ do
let a = 1_000_000_000
b = 2_000_000_000
let result = slowAddPure a b
assertEqual "" (a + b) $ result
, testCase "slowAddConcurrent" $ do
let a = 1_000_000_000
b = 2_000_000_000
(ab, ba) <- concurrently (slowAddIO a b) (slowAddIO b a)
assertEqual "" ab ba
]
main = do
print =<< answerIO
print $ answerPure
print =<< slowAddIO a b
print $ slowAddPure a b
(ab, ba) <- concurrently (slowAddIO a b) (slowAddIO b a)
print (ab, ba)
where
a = 1_000_000_000
b = 2_000_000_000
2 changes: 0 additions & 2 deletions trace-foreign-calls/trace-foreign-calls.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,5 @@ test-suite test-trace-foreign-calls
build-depends:
-- external dependencies
, async
, tasty
, tasty-hunit


0 comments on commit 3563300

Please sign in to comment.