packages feed

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

{-|
Description:    

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

Stability:      experimental
Portability:    portable
-}
module Test.Libcdio.Upstream.Foreign.FreeBsd (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.FreeBsd" ~: U.TestList tests'
  where tests' | haveDriver DriverFreeBsd =
                    [ open
                    , find DriverFreeBsd Nothing $ \(c, s) -> checkSource c [s]
                    ]
               | otherwise = []

open :: U.Test
open = "The driver opens devices correctly" ~: U.TestCase $ do
    c <- cdioOpen Nothing DriverFreeBsd
    cdio <- case c of
        Nothing -> U.assertFailure "Can't open the default device"
        Just c' -> return c'
    
    checkAccessMode cdio [Ioctl_, Cam]
    checkMmc cdio $ Just False