packages feed

hscdio-0.1.0.0: test/Test/Libcdio/Upstream/Foreign/Linux.hs

{-|
Description:    

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

Stability:      experimental
Portability:    portable
-}
module Test.Libcdio.Upstream.Foreign.Linux (tests) where


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

import Foreign.Libcdio.Device

import Test.Libcdio.Upstream.Foreign.Common


tests :: U.Test
tests = "Foreign.Libcdio.Test.Linux" ~: U.TestList tests'
  where tests' | haveDriver DriverLinux =
                  [ find DriverLinux (Just MmcReadWrite) check
                  ]
               | otherwise = []

check :: (Cdio, String) -> U.Assertion
check (cdio, source) = do
    {- Exact behaviour dependant on whether there's a disc in the drive
    tc <- lastTrackNum cdio
    if Y.fromMaybe maxTrack tc >= maxTrack - 1
    then mempty
    else do
        l <- trackLsn cdio maxTrack
        Y.isNothing l @? "Overlarge track not detected"
    -}
    
    checkSource cdio [source]
    checkMmc cdio Nothing
    
    checkArg ScsiTuple cdio []
    
    {- Access mode doesn't seem implemented
    checkAccessMode cdio [MmcReadWrite]
    -}