packages feed

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

{-|
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 Pigeon at
<https://pigeonsnest.co.uk/stuff/cdtext.html> (warning for a /lot/ of
swearing).  The encoding was later manually set to ASCII.
-}
module Test.Libcdio.Unit.Sound.RevolutionDays (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 "revolution-days.cdtext"


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

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


infos :: [Info]
infos = emptyInfo
    { title = Just $ T.pack "REVOLUTION DAYS"
    , performer = Just $ T.pack "BARCLAY JAMES HARVEST FEATURING LES HOLROYD"
    } : map (\t -> emptyInfo { title = Just $ T.pack t })
        [ "IT'S MY LIFE"
        , "MISSING YOU"
        , "THAT WAS THEN... THIS IS NOW"
        , "PRELUDE"
        , "JANUARY MORNING"
        , "LOVE ON THE LINE"
        , "QUIERO EL SOL"
        , "TOTALLY COOL"
        , "LIFE IS FOR LIVING"
        , "SLEEPY SUNDAY"
        , "REVOLUTION DAY"
        , "MARLENE (from the BERLIN SUITE)"
        ]