packages feed

elynx-tree-0.5.0: test/ELynx/Tree/Export/NexusSpec.hs

{-# LANGUAGE OverloadedStrings #-}

-- |
-- Module      :  ELynx.Tree.Export.NexusSpec
-- Description :  Test export of trees in Nexus files
-- Copyright   :  (c) Dominik Schrempf 2020
-- License     :  GPL-3
--
-- Maintainer  :  dominik.schrempf@gmail.com
-- Stability   :  unstable
-- Portability :  portable
--
-- Creation date: Tue Apr 28 18:08:14 2020.
module ELynx.Tree.Export.NexusSpec
  ( spec,
  )
where

import ELynx.Tools
import ELynx.Tree
import Test.Hspec

tree :: Tree Phylo Name
tree =
  Node
    (Phylo Nothing Nothing)
    ""
    [ Node
        (Phylo Nothing Nothing)
        ""
        [ Node (Phylo Nothing Nothing) "A" [],
          Node (Phylo Nothing Nothing) "B" []
        ],
      Node (Phylo Nothing Nothing) "C" []
    ]

spec :: Spec
spec = describe "toNexusTrees" $
  it "exports a nexus file with a TREES block" $
    do
      let ts = parseByteStringWith (nexusTrees Standard) (toNexusTrees [("tree1", tree)])
      head ts `shouldBe` ("tree1", tree)