Skip to content

Commit

Permalink
refactor: [#129] Add (disabled) integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
ursjoss committed Feb 26, 2023
1 parent d3601a2 commit fbad049
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,45 @@ import ch.difty.kris.domain.RisRecord
import ch.difty.kris.domain.RisType
import org.amshove.kluent.shouldContainAll
import org.amshove.kluent.shouldHaveSize
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import java.io.File

private const val FILE_PATH = "src/integrationTest/resources/sample.ris"
private const val PAPER_COUNT = 3
private const val PAPER_COUNT = 4

@Suppress("FunctionName", "S100", "SpellCheckingInspection")
@Suppress("FunctionName", "S100", "SpellCheckingInspection", "MaxLineLength")
internal class KRisIOIntegrationTest {

//region Importing
@Test
@Disabled // TODO enable after implementation
fun `can read from reader`() {
val parsed = File(FILE_PATH).bufferedReader().process()
parsed shouldHaveSize PAPER_COUNT

parsed.map { it.title } shouldContainAll setOf(
"Exposure to traffic noise and air pollution and risk for febrile seizure: a cohort study.",
"Impact of Road Traffic Pollution on Pre-eclampsia and Pregnancy-induced Hypertensive Disorders.",
"Exposure to long-term air pollution and road traffic noise in relation to cholesterol: A cross-sectional study."
"Exposure to long-term air pollution and road traffic noise in relation to cholesterol: A cross-sectional study.",
"∂ for Data: Differentiating Data Structures",
)
}

@Test
@Disabled // TODO enable after implementation
fun `can read from file`() {
File(FILE_PATH).process() shouldHaveSize PAPER_COUNT
}

@Test
@Disabled // TODO enable after implementation
fun `can read from file path`() {
FILE_PATH.process() shouldHaveSize PAPER_COUNT
}

@Test
@Disabled // TODO enable after implementation
fun `can read from file stream`() {
File(FILE_PATH).inputStream().process() shouldHaveSize PAPER_COUNT
}
Expand All @@ -48,7 +54,7 @@ internal class KRisIOIntegrationTest {
private val records = listOf(
RisRecord(type = RisType.JOUR, authors = mutableListOf("Author, A"), title = "Some title"),
RisRecord(type = RisType.JOUR, authors = mutableListOf("Other-Author, B"), title = "Some other title"),
RisRecord(type = RisType.JOUR, authors = mutableListOf("Third-Author, C"), title = "Some other title")
RisRecord(type = RisType.JOUR, authors = mutableListOf("Third-Author, C"), title = "Some other title"),
)

@Test
Expand Down
16 changes: 16 additions & 0 deletions subprojects/kris-io/src/integrationTest/resources/sample.ris
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,19 @@ DO - 10.1016/j.envint.2015.09.021
M1 - 8657
L2 - https://www.ncbi.nlm.nih.gov/pubmed/26425807
ER -

TY - JOUR
AU - Abbott, Michael
AU - Altenkirch, Thorsten
AU - McBride, Conor
AU - Ghani, Neil
EP - 28
AB - This paper and our conference paper (Abbott, Altenkirch, Ghani, and McBride, 2003b) explain and analyse the notion of the derivative of a data structure as the type of its one-hole contexts based on the central observation made by McBride (2001). To make the idea precise we need a generic notion of a data type, which leads to the notion of a container, introduced in (Abbott, Altenkirch, and Ghani, 2003a) and investigated extensively in (Abbott, 2003). Using containers we can provide a notion of linear map which is the concept missing from McBride's first analysis. We verify the usual laws of differential calculus including the chain rule and establish laws for initial algebras and terminal coalgebras.
SP - 1
TI - ∂ for Data: Differentiating Data Structures
T2 - Fundamenta Informaticae
VL - 65
M1 - 1-2
PY - 2005
PB - IOS Press
ER -

0 comments on commit fbad049

Please sign in to comment.