gopro-plus 0.5.0.0 → 0.6.0.0
raw patch · 3 files changed
+61/−39 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.File
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.FileInfo
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.FileStuff
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.Listing
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.Medium
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.MediumType
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.Moment
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.PageInfo
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.ReadyToViewType
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.SidecarFile
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.Sprite
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.SpriteFrame
+ GoPro.Plus.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary GoPro.Plus.Media.Variation
Files
- gopro-plus.cabal +7/−3
- src/GoPro/Plus/Arbitrary.hs +52/−0
- test/Spec.hs +2/−36
gopro-plus.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: a792185c3e5dd0c5412e961456957e6810fcbcd183932f7db7743034baa59650+-- hash: 68c1e9163a8057cb37b7d179377d24c7517b740d7730613114203d9aaa90fe1e name: gopro-plus-version: 0.5.0.0+version: 0.6.0.0 synopsis: GoPro Plus Client API. description: Please see the README on GitHub at <https://github.com/dustin/gopro-plus#readme> category: Web@@ -29,6 +29,7 @@ library exposed-modules:+ GoPro.Plus.Arbitrary GoPro.Plus.Auth GoPro.Plus.Internal.AuthHTTP GoPro.Plus.Internal.HTTP@@ -44,16 +45,19 @@ NamedFieldPuns ghc-options: -Wall build-depends:- aeson+ QuickCheck+ , aeson , base >=4.7 && <5 , bytestring , containers , exceptions , filepath , generic-deriving+ , generic-random , lens , lens-aeson , mtl+ , quickcheck-instances , random , retry , text
+ src/GoPro/Plus/Arbitrary.hs view
@@ -0,0 +1,52 @@+{-|+Module : GoPro.Plus.Arbitrary+Description : Arbitrary instances.+Copyright : (c) Dustin Sallings, 2020+License : BSD3+Maintainer : dustin@spy.net+Stability : experimental++Arbitrary instances for GoPro.Plus+-}++{-# OPTIONS_GHC -Wno-orphans #-}+module GoPro.Plus.Arbitrary where++import Generic.Random (genericArbitrary, uniform)+import Test.QuickCheck (Arbitrary(..), vector, choose, arbitraryBoundedEnum)+import Test.QuickCheck.Instances.Text ()+import Test.QuickCheck.Instances.Time ()++import GoPro.Plus.Media++instance Arbitrary FileInfo where arbitrary = genericArbitrary uniform++instance Arbitrary FileStuff where+ arbitrary = do+ _files <- vector =<< choose (0,3)+ _variations <- vector =<< choose (0,3)+ _sprites <- vector =<< choose (0,3)+ _sidecar_files <- vector =<< choose (0,3)+ pure FileStuff{..}++instance Arbitrary Variation where arbitrary = genericArbitrary uniform++instance Arbitrary SpriteFrame where arbitrary = genericArbitrary uniform++instance Arbitrary SidecarFile where arbitrary = genericArbitrary uniform++instance Arbitrary Sprite where arbitrary = genericArbitrary uniform++instance Arbitrary File where arbitrary = genericArbitrary uniform++instance Arbitrary Medium where arbitrary = genericArbitrary uniform++instance Arbitrary Moment where arbitrary = genericArbitrary uniform++instance Arbitrary ReadyToViewType where arbitrary = arbitraryBoundedEnum++instance Arbitrary MediumType where arbitrary = arbitraryBoundedEnum++instance Arbitrary PageInfo where arbitrary = genericArbitrary uniform++instance Arbitrary Listing where arbitrary = genericArbitrary uniform
test/Spec.hs view
@@ -7,15 +7,13 @@ import Data.Maybe (fromJust) import Text.RawString.QQ (r) -import Generic.Random (genericArbitrary, uniform)-import Test.QuickCheck (arbitraryBoundedEnum, (===))-import Test.QuickCheck.Instances.Text-import Test.QuickCheck.Instances.Time+import Test.QuickCheck ((===)) import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.QuickCheck as QC import GoPro.Plus.Media+import GoPro.Plus.Arbitrary () exampleMedia :: BL.ByteString exampleMedia = [r|@@ -55,38 +53,6 @@ ["proshake", "verizon"]] (fs ^.. variations . folded . var_transforms . _Just) assertEqual (show fs) "intoalightpost" (fs ^. files . folded . file_transforms . folded . folded)--instance Arbitrary FileInfo where arbitrary = genericArbitrary uniform--instance Arbitrary FileStuff where- arbitrary = do- _files <- vector =<< choose (0,3)- _variations <- vector =<< choose (0,3)- _sprites <- vector =<< choose (0,3)- _sidecar_files <- vector =<< choose (0,3)- pure FileStuff{..}--instance Arbitrary Variation where arbitrary = genericArbitrary uniform--instance Arbitrary SpriteFrame where arbitrary = genericArbitrary uniform--instance Arbitrary SidecarFile where arbitrary = genericArbitrary uniform--instance Arbitrary Sprite where arbitrary = genericArbitrary uniform--instance Arbitrary File where arbitrary = genericArbitrary uniform--instance Arbitrary Medium where arbitrary = genericArbitrary uniform--instance Arbitrary Moment where arbitrary = genericArbitrary uniform--instance Arbitrary ReadyToViewType where arbitrary = arbitraryBoundedEnum--instance Arbitrary MediumType where arbitrary = arbitraryBoundedEnum--instance Arbitrary PageInfo where arbitrary = genericArbitrary uniform--instance Arbitrary Listing where arbitrary = genericArbitrary uniform propRTJSON :: (J.FromJSON j, J.ToJSON j, Eq j, Show j) => j -> Property propRTJSON = fromJust . J.decode . J.encode >>= (===)