Fix out-of-date test code, add skeleton for payments spec.

[?]
Feb 22, 2017, 8:43 PM
3GBSDS5PDSTTJTJOLEKZRRTAONS3T3JFZ3FQGFGS3AOXDBZ6SPLAC

Dependencies

  • [2] DFOBMSAO Initial work on payments API
  • [3] LHJ2HFXV Add property test for auction algorithm.
  • [4] SCXG6TJW Make log reduction safer in presence of overlapping events.
  • [5] FD7SV5I6 Fix handling of event_t columns.
  • [6] NEDDHXUK Reformat via stylish-haskell
  • [7] RSEB2NFG Replacing Snap with Scotty.
  • [8] 5DRIWGLU Improving TimeLog specs
  • [9] KNSI575V Cleanup of EventLog types.
  • [10] OBFPJS2G Project successfully builds and tests under nix.
  • [11] 7KZP4RHZ Switch from Data.Time to Data.Thyme
  • [12] EQXRXRZD Changed to use tasty instead of test-framework
  • [13] OV5AKJHA Remove unused LogInterval type.
  • [14] HBULCDN6 Add tests for auction winner determination algorithm.
  • [15] NMWWP4ZN Trying out Hspec
  • [16] JV3UEPNC Fix Aeson constructors.
  • [17] NVOCQVAS Initial failing tests.
  • [18] Y35QCWYW Minor improvement in WorkIndex type to eliminate duplicated information.
  • [19] UUR6SMCA Add start of specs for auctions.
  • [20] 2KZPOGRB Once you get Haskell to compile, the tests pass!
  • [*] 64C6AWH6 Rename Ananke -> Quixotic, project reboot.
  • [*] WO2MINIF Auctions now compile!
  • [*] 4U7F3CPI THE GREAT RENAMING OF THINGS!

Change contents

  • edit in aftok.cabal at line 89
    [2.413]
    [23.2112]
    other-modules: Aftok.AuctionSpec
    , Aftok.Generators
    , Aftok.PaymentsSpec
    , Aftok.TimeLogSpec
    , Aftok.Util.HttpSpec
  • edit in aftok.cabal at line 105
    [3.13]
    [3.36]
    , haskoin-core
  • edit in test/Aftok/AuctionSpec.hs at line 1
    [3.89][3.658:704]()
    {-# OPTIONS_GHC -Wwarn -fno-warn-orphans #-}
  • edit in test/Aftok/AuctionSpec.hs at line 4
    [3.193][3.193:277]()
    import Aftok
    import Aftok.Auction
    import Aftok.Types
  • edit in test/Aftok/AuctionSpec.hs at line 10
    [3.784]
    [3.336]
    import Aftok
    import Aftok.Auction
    import Aftok.Generators
    import Aftok.Types
  • edit in test/Aftok/AuctionSpec.hs at line 20
    [3.868][3.868:965]()
    uuidGen :: Gen UUID
    uuidGen = fromWords <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
  • edit in test/Aftok/AuctionSpec.hs at line 21
    [3.966][3.966:1028]()
    genSatoshi :: Gen Satoshi
    genSatoshi = Satoshi <$> arbitrary
  • replacement in test/Aftok/AuctionSpec.hs at line 22
    [3.1046][3.1046:1084]()
    genBid = Bid <$> (UserId <$> uuidGen)
    [3.1046]
    [3.1084]
    genBid = Bid <$> (UserId <$> genUUID)
  • replacement in test/Aftok/AuctionSpec.hs at line 53
    [3.1606][3.1606:1639]()
    InsufficientBids t ->
    [3.1606]
    [3.1639]
    InsufficientBids _ ->
  • file addition: Generators.hs (----------)
    [24.3462]
    module Aftok.Generators where
    import ClassyPrelude
    import Data.UUID
    import Network.Haskoin.Test (ArbitraryAddress(..))
    import Aftok (BtcAddr(..))
    import Aftok.Types (Satoshi(..))
    import Test.QuickCheck
    genUUID :: Gen UUID
    genUUID = fromWords <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
    genSatoshi :: Gen Satoshi
    genSatoshi = Satoshi <$> arbitrary
    genBtcAddr :: Gen BtcAddr
    genBtcAddr = fmap (\(ArbitraryAddress addr) -> BtcAddr addr) arbitrary
  • file addition: PaymentsSpec.hs (----------)
    [24.3462]
    {-# OPTIONS_GHC -Wwarn -fno-warn-orphans #-}
    module Aftok.PaymentsSpec (main, spec) where
    import ClassyPrelude
    import Test.Hspec
    spec :: Spec
    spec = do
    describe "finding unbilled dates" $ do
    pure ()
    --it "returns the billing date in the presence of an expired payment request" $
    -- forAll ((,) <$> genSatoshi <*> listOf genBid) $
    -- \(raiseAmount', bids) ->
    -- case runAuction' raiseAmount' bids of
    -- WinningBids xs -> bidsTotal xs == raiseAmount'
    -- InsufficientBids t -> t == (raiseAmount' - bidsTotal bids)
    main :: IO ()
    main = hspec spec
  • edit in test/Aftok/TimeLogSpec.hs at line 18
    [3.12426]
    [3.12426]
    import Aftok.Generators
  • edit in test/Aftok/TimeLogSpec.hs at line 24
    [3.1906][3.3279:3280](),[3.12560][3.3279:3280](),[3.3279][3.3279:3280](),[3.3280][3.2106:2188]()
    genBtcAddr :: Gen BtcAddr
    genBtcAddr =
    BtcAddr . pack <$> vectorOf 34 arbitrary
  • replacement in test/Aftok/TimeLogSpec.hs at line 49
    [3.2944][3.2944:2981]()
    pure (addr, ivals)
    [3.2944]
    [3.2981]
    pure (CreditToAddress addr, ivals)
  • replacement in test/Aftok/TimeLogSpec.hs at line 69
    [3.418][3.126:175]()
    testIntervals :: [(BtcAddr, Interval)]
    [3.418]
    [3.1422]
    testIntervals :: [(CreditTo, Interval)]
  • replacement in test/Aftok/TimeLogSpec.hs at line 73
    [3.236][3.236:286]()
    pure $ (addr, I.interval start' end')
    [3.236]
    [3.1452]
    pure $ (CreditToAddress addr, I.interval start' end')