packages feed

bytestring-tree-builder-0.2.2.1: tasty/Main.hs

module Main where

import BasePrelude hiding (assert)
import Test.QuickCheck.Instances
import Test.Tasty
import Test.Tasty.HUnit
import Test.Tasty.QuickCheck
import ByteString.TreeBuilder
import qualified Data.ByteString.Lazy


main =
  defaultMain tree

tree =
  testGroup "All tests"
  [
    testProperty "Concatting a list of bytestrings is isomorphic to appending a list of builders (strict)" $
    \bytestrings ->
      mconcat bytestrings ===
      toByteString (foldMap byteString bytestrings)
    ,
    testProperty "Concatting a list of bytestrings is isomorphic to appending a list of builders (lazy)" $
    \bytestrings ->
      mconcat bytestrings ===
      Data.ByteString.Lazy.toStrict (toLazyByteString (foldMap byteString bytestrings))
  ]