hscdio-0.1.0.0: test/Test/Libcdio/Unit/Sound/Common.hs
{-|
Description:
Copyright: (c) 2020-2021 Sam May
License: GPL-3.0-or-later
Maintainer: ag@eitilt.life
Stability: experimental
Portability: portable
-}
module Test.Libcdio.Unit.Sound.Common
( module Test.Libcdio.Unit.Common
, checkLanguage
) where
import qualified Test.HUnit as U
import Test.HUnit ( (@?=) )
import Sound.Libcdio.Read.CdText
import Test.Libcdio.Unit.Common
checkLanguage :: [(Language, [Info])] -> CdText U.Assertion
checkLanguage ls = do
l <- language
let is' = lookup l ls
t1 <- firstTrack
tl <- lastTrack
i <- info Nothing
is <- mapM (info . Just) [t1..tl]
return $ case is' of
Just is'' -> do
t1 @?= 1
tl @?= fromIntegral (length is)
i : is @?= is''
Nothing -> U.assertFailure "Unexpected language in CdText"