NMWWP4ZNOKHZKSJ6F5KYEREWXXR5F4UD35WOKI3EH42AZWVCTCJAC
TJEUE7TYDFZQL4E5LUVEEIPOIM3AN3PCV4NWODGDCOXSN4KON74QC
ADMKQQGCGVSHHIMVQ4XFRDCG544SBJCYALSKZV45CQQBZ4ACUH2AC
EQXRXRZDYCM7BDAVBOXQYPG6C7IJT3OFGNIXCDAHJJBRKAXNGL7AC
Y35QCWYW2OTZ27ZVTH2BA3XJTUCJ2WMLKU32ZCOCDY3AW7TIZXRAC
2KZPOGRBY6KBMO76F55ZKIVOLSG3O63VP3RHRZVANXYT3OLZ3OWQC
NVOCQVASZWTKQJG7GPH7KHKZZR7NUG4WLV5YY4KAIRPCJRWCZPIAC
N4NDAZYTLSI2W22KT3SYXL257DBMSH3UT2BXOYM7LH7FSZAY4RLAC
import Control.Monad
import Control.Arrow
import Ananke
import Ananke.TimeLog as L
import Ananke.Interval as I
import Data.Time.ISO8601
deriveIntervalsTest :: Assertion
deriveIntervalsTest = let
testAddrs = catMaybes [ parseBtcAddr "123"
, parseBtcAddr "456"
, parseBtcAddr "789" ]
spec :: Spec
spec = do
describe "log reduction" $ do
it "reduces a log to a work index" $ do
let testAddrs = catMaybes [ parseBtcAddr "123"
, parseBtcAddr "456"
, parseBtcAddr "789" ]
testLogEntries :: [LogEntry]
testLogEntries = do
addr <- testAddrs
(start, end) <- zip starts ends
[ LogEntry addr (StartWork start), LogEntry addr (StopWork end) ]
testLogEntries :: [LogEntry]
testLogEntries = do
addr <- testAddrs
(start, end) <- zip starts ends
[ LogEntry addr (StartWork start), LogEntry addr (StopWork end) ]
testIntervals :: [LogInterval]
testIntervals = do
addr <- testAddrs
(start, end) <- zip starts ends
return $ LogInterval addr (I.interval start end)
testIntervals :: [LogInterval]
testIntervals = do
addr <- testAddrs
(start, end) <- zip starts ends
return $ LogInterval addr (I.interval start end)
expected0 :: Map BtcAddr ([LogEntry], [LogInterval])
expected0 = M.map (const [] &&& id) . fromListWith (++) . fmap (intervalBtcAddr &&& return) $ testIntervals
expected0 :: Map BtcAddr ([LogEntry], [LogInterval])
expected0 = M.map (const [] &&& id) . fromListWith (++) . fmap (intervalBtcAddr &&& return) $ testIntervals
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}