Skip to content

Commit

Permalink
Add tests for get.author.names.from.data
Browse files Browse the repository at this point in the history
Signed-off by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
  • Loading branch information
Leo-Send committed Jan 9, 2024
1 parent f3202a6 commit 030574b
Showing 1 changed file with 138 additions and 0 deletions.
138 changes: 138 additions & 0 deletions tests/test-util-networks-misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,143 @@ test_that("getting all authors of a list of networks, list length 2, not global"
## Assert
expected = list(c("Dieter", "Heinz", "Klaus"), c("Detlef", "Dieter"))

expect_equal(expected, result)
})

test_that("getting all authors of a list of data ranges, list length 0", {

## Act
result = get.author.names.from.data(data.ranges = list())

## Assert
expected = list(c())

expect_equal(expected, result)
})

test_that("getting all authors of a list of data ranges, list length 1", {

## Arrange
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.data.base = ProjectData$new(project.conf = proj.conf)
range.data = proj.data.base$get.data.cut.to.same.date("mails")

## Act
result = get.author.names.from.data(data.ranges = list(range.data))

## Assert
expected = list(c("Björn", "Fritz fritz@example.org","georg", "Hans",
"Karl", "Olaf", "Thomas", "udo"))

expect_equal(expected, result)
})

test_that("getting all authors of a list of data ranges, list length 1, not global", {

## Arrange
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.data.base = ProjectData$new(project.conf = proj.conf)
range.data = proj.data.base$get.data.cut.to.same.date("mails")

## Act
result = get.author.names.from.data(data.ranges = list(range.data), globally = FALSE)

## Assert
expected = list(c("Björn", "Fritz fritz@example.org","georg", "Hans",
"Karl", "Olaf", "Thomas", "udo"))

expect_equal(expected, result)
})

test_that("getting all authors of a list of data ranges, list length 2", {

## Arrange
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.data.base = ProjectData$new(project.conf = proj.conf)
range.data.one = proj.data.base$get.data.cut.to.same.date("mails")
range.data.two = proj.data.base$get.data.cut.to.same.date("issues")

## Act
result = get.author.names.from.data(data.ranges = list(range.data.one, range.data.two))

## Assert
expected = list(c("Björn", "Fritz fritz@example.org","georg", "Hans",
"Karl", "Max", "Olaf", "Thomas", "udo"))

expect_equal(expected, result)
})

test_that("getting all authors of a list of data ranges, list length 2, not global", {

## Arrange
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.data.base = ProjectData$new(project.conf = proj.conf)
range.data.one = proj.data.base$get.data.cut.to.same.date("mails")
range.data.two = proj.data.base$get.data.cut.to.same.date("issues")

## Act
result = get.author.names.from.data(data.ranges = list(range.data.one, range.data.two), globally = FALSE)

## Assert
expected = list(c("Björn", "Fritz fritz@example.org","georg", "Hans", "Karl", "Olaf",
"Thomas", "udo"), c("Björn", "Karl", "Max", "Olaf", "Thomas"))

expect_equal(expected, result)
})

test_that("getting all authors of a list of data ranges by data source 'mails', list length 2, not global", {

## Arrange
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.data.base = ProjectData$new(project.conf = proj.conf)
range.data.one = proj.data.base$get.data.cut.to.same.date("mails")
range.data.two = proj.data.base$get.data.cut.to.same.date("issues")

## Act
result = get.author.names.from.data(data.ranges = list(range.data.one, range.data.two),
data.sources = "mails", globally = FALSE)

## Assert

expected = list(c("Björn", "Fritz fritz@example.org","georg", "Hans", "Olaf",
"Thomas", "udo"), c("Björn", "Olaf", "Thomas"))

expect_equal(expected, result)
})

test_that("getting all authors of a list of data ranges by data source 'issues', list length 2, not global", {

## Arrange
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.data.base = ProjectData$new(project.conf = proj.conf)
range.data.one = proj.data.base$get.data.cut.to.same.date("mails")
range.data.two = proj.data.base$get.data.cut.to.same.date("issues")

## Act
result = get.author.names.from.data(data.ranges = list(range.data.one, range.data.two),
data.sources = "issues", globally = FALSE)

## Assert
expected = list(c("Björn", "Karl", "Olaf", "Thomas"), c("Björn","Karl", "Max", "Olaf", "Thomas"))

expect_equal(expected, result)
})

test_that("getting all authors of a list of data ranges by data source 'commits', list length 2, not global", {

## Arrange
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT)
proj.data.base = ProjectData$new(project.conf = proj.conf)
range.data.one = proj.data.base$get.data.cut.to.same.date("mails")
range.data.two = proj.data.base$get.data.cut.to.same.date("issues")

## Act
result = get.author.names.from.data(data.ranges = list(range.data.one, range.data.two),
data.sources = "commits", globally = FALSE)

## Assert

expected = list(c("Björn", "Olaf"), c("Björn", "Olaf", "Thomas"))

expect_equal(expected, result)
})

0 comments on commit 030574b

Please sign in to comment.