packages feed

hscdio-0.1.0.0: test/Test/Libcdio/Unit/Sound/DeeperDance.hs

{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}

{-|
Description:    

Copyright:      (c) 2020-2021 Sam May
License:        GPL-3.0-or-later
Maintainer:     ag@eitilt.life

Stability:      experimental
Portability:    portable

The CDTEXT file used in this module comes via James Olin Oden at
<https://bugzilla.redhat.com/show_bug.cgi?id=1321677#c3>.
-}
module Test.Libcdio.Unit.Sound.DeeperDance (tests) where


import qualified Test.HUnit as U
import Test.HUnit ( (~:) )

import qualified Data.ByteString as BS
import qualified Data.Either.Compat as E
import qualified Data.Text as T

import Sound.Libcdio.Read.CdText

import Test.Libcdio.Unit.Sound.Common


testFile :: FilePath
testFile = dataFile "deeper-dance.cdtext"


tests :: U.Test
tests = "Sound.Libcdio.Test.DeeperDance" ~: U.TestList
    [ binary
    ]

binary :: U.Test
binary = "Binary CDTEXT is read properly" ~: U.TestCase $ do
    bs <- BS.readFile testFile
    x <- parseCdText bs $ checkLanguage [(English, infos)]
    E.fromRight (U.assertFailure "Could not parse binary data") x


performer' :: Maybe T.Text
performer' = Just $ T.pack "James Olin Oden"

infos :: [Info]
infos = map (\t -> emptyInfo
    { title = Just $ T.pack t
    , performer = performer'
    })
    [ "Deeper Dance"
    , "Deeper Dance"
    , "The Hunt"
    , "Harold's Dream"
    , "Jazz Fusion No. 9"
    , "Love's Tattoo"
    , "The Day I Told Her Micheal Domhnaill Died"
    , "The Fool Amongst the Keeners"
    , "Love Is Not Tame"
    , "Dear John and the Big Red Pickup Truck"
    , "Dance Right Out of My Grave"
    ]