Commit 1aa22af1 authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Add basic test coverage

parent 84a72ddc
......@@ -19,6 +19,9 @@ extra-source-files:
README.md
ChangeLog.md
data-files:
test/test-corpus/pubmed-29768149.xml
source-repository head
type: git
location: https://github.com/gitlab/crawlerPubMed
......@@ -130,6 +133,8 @@ test-suite crawlerPubMed-test
, optparse-applicative
, servant
, servant-client
, tasty
, tasty-hunit
, taggy
, taggy-lens
, text
......
......@@ -39,7 +39,7 @@ data PubMed =
PubMed { pubmed_id :: Int
, pubmed_article :: PubMedArticle
, pubmed_date :: PubMedDate
} deriving Show
} deriving (Show, Eq)
data PubMedArticle =
PubMedArticle { pubmed_title :: Maybe T.Text
......@@ -47,23 +47,24 @@ data PubMedArticle =
, pubmed_abstract :: [T.Text]
, pubmed_authors :: [Author]
}
deriving (Show)
deriving (Show, Eq)
data Author =
Author { lastName :: Maybe T.Text
, foreName :: Maybe T.Text
, affiliation :: Maybe T.Text
}
deriving (Show)
deriving (Show, Eq)
data PubMedDate =
PubMedDate { pubmedDate_date :: UTCTime
, pubmedDate_year :: Integer
, pubmedDate_month :: Int
, pubmedDate_day :: Int
} deriving (Show)
} deriving (Show, Eq)
parsePubMedFile :: FilePath -> IO [PubMed]
parsePubMedFile fp = do
input <- TLIO.readFile fp
pure $ parsePubMed input
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment