-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from se-sic/dev
Version 4.3 Merged-by: Christian Hechtl <[email protected]>
- Loading branch information
Showing
26 changed files
with
665 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
## This file is part of coronet, which is free software: you | ||
## can redistribute it and/or modify it under the terms of the GNU General | ||
## Public License as published by the Free Software Foundation, version 2. | ||
## | ||
## This program is distributed in the hope that it will be useful, | ||
## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License along | ||
## with this program; if not, write to the Free Software Foundation, Inc., | ||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
## | ||
## Copyright 2023 by Maximilian Löffler <[email protected]> | ||
## All Rights Reserved. | ||
|
||
name: Build Status | ||
|
||
on: | ||
pull_request: | ||
branches: [ master, dev ] | ||
types: [ opened, reopened, synchronize ] | ||
push: | ||
branches: [ master, dev ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
|
||
# change to 'runs-on: self-hosted' to run on self-hosted runners (https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job) | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
r-version: ['3.6', '4.0', '4.1', '4.2', 'latest'] | ||
|
||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Update system | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install --assume-yes libxml2 | ||
sudo apt-get install --assume-yes libxml2-dev | ||
sudo apt-get install --assume-yes libglpk-dev | ||
sudo apt-get install --assume-yes libfontconfig1-dev | ||
sudo su -c "echo 'deb https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/' >> /etc/apt/sources.list" | ||
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc | ||
- name: Set up R ${{ matrix.r-version }} | ||
uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.r-version }} | ||
|
||
- name: Install dependencies | ||
run: Rscript install.R | ||
|
||
- name: Run Tests | ||
run: Rscript tests.R | ||
|
||
- name: Run Showcase | ||
run: Rscript showcase.R | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,7 @@ | |
## Copyright 2015 by Wolfgang Mauerer <[email protected]> | ||
## Copyright 2015-2017 by Claus Hunsen <[email protected]> | ||
## Copyright 2017 by Thomas Bock <[email protected]> | ||
## Copyright 2022 by Thomas Bock <[email protected]> | ||
## Copyright 2020-2021 by Thomas Bock <[email protected]> | ||
## Copyright 2020-2023 by Thomas Bock <[email protected]> | ||
## Copyright 2019 by Anselm Fehnker <[email protected]> | ||
## Copyright 2021 by Christian Hechtl <[email protected]> | ||
## All Rights Reserved. | ||
|
@@ -69,4 +68,14 @@ if (length(p) > 0) { | |
if (compareVersion(igraph.version, "1.3.0") == -1) { | ||
print("WARNING: igraph version 1.3.0 or higher is recommended for using coronet.") | ||
} | ||
|
||
Matrix.version = installed.packages()[rownames(installed.packages()) == "Matrix", "Version"] | ||
if (compareVersion(Matrix.version, "1.3.0") == -1) { | ||
print("WARNING: Matrix version 1.3.0 or higher is necessary for using coronet. Re-install package Matrix...") | ||
install.packages("Matrix", dependencies = NA, verbose = TRUE, quiet = TRUE) | ||
Matrix.version = installed.packages()[rownames(installed.packages()) == "Matrix", "Version"] | ||
if (compareVersion(Matrix.version, "1.3.0") == -1) { | ||
print("WARNING: Re-installation of package Matrix did not end up in the necessary packge version.") | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ | |
32716;"2016-07-12 16:06:30";"Thomas";"[email protected]";"2016-07-12 16:06:30";"Thomas";"[email protected]";"d01921773fae4bed8186b0aa411d6a2f7a6626e6";1;1;0;1;"";"";"";0 | ||
32711;"2016-07-12 16:06:32";"Thomas";"[email protected]";"2016-07-12 16:06:32";"Thomas";"[email protected]";"0a1a5c523d835459c42f33e863623138555e2526";1;1;0;1;"test2.c";"Base_Feature";"Feature";1 | ||
32711;"2016-07-12 16:06:32";"Thomas";"[email protected]";"2016-07-12 16:06:32";"Thomas";"[email protected]";"0a1a5c523d835459c42f33e863623138555e2526";1;1;0;1;"test2.c";"foo";"Feature";1 | ||
31711;"2016-07-12 16:06:33";"Thomas";"[email protected]";"2016-07-12 16:06:33";"";"[email protected]";"2ef7bde608ce5404e97d5f042f95f89f1c232871";1;1;0;1;"test2.c";"foo";"Feature";1 | ||
30711;"2016-07-12 16:06:34";"Thomas";"[email protected]";"2016-07-12 16:06:34";"deleted user";"[email protected]";"c6954cb75e3eeec5b827f64e97b6a4ba187c0d55";1;1;0;1;"test2.c";"foo";"Feature";1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ | |
32715;"2016-07-12 16:06:32";"Thomas";"[email protected]";"2016-07-12 16:06:32";"Thomas";"[email protected]";"0a1a5c523d835459c42f33e863623138555e2526";1;1;0;1;"test2.c";"File_Level";"Function";1 | ||
32720;"2016-07-12 16:06:20";"Karl";"[email protected]";"2016-07-12 16:06:20";"Karl";"[email protected]";"418d1dc4929ad1df251d2aeb833dd45757b04a6f";1;1;0;1;"";"";"";0 | ||
32721;"2016-07-12 16:06:30";"Thomas";"[email protected]";"2016-07-12 16:06:30";"Thomas";"[email protected]";"d01921773fae4bed8186b0aa411d6a2f7a6626e6";1;1;0;1;"";"";"";0 | ||
32811;"2016-07-12 16:06:33";"Thomas";"[email protected]";"2016-07-12 16:06:33";"";"[email protected]";"2ef7bde608ce5404e97d5f042f95f89f1c232871";1;1;0;1;"test2.c";"foo";"Feature";1 | ||
32911;"2016-07-12 16:06:34";"Thomas";"[email protected]";"2016-07-12 16:06:34";"deleted user";"[email protected]";"c6954cb75e3eeec5b827f64e97b6a4ba187c0d55";1;1;0;1;"test2.c";"foo";"Feature";1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
## Copyright 2017 by Felix Prasse <[email protected]> | ||
## Copyright 2017-2018 by Claus Hunsen <[email protected]> | ||
## Copyright 2017-2018 by Thomas Bock <[email protected]> | ||
## Copyright 2023 by Thomas Bock <[email protected]> | ||
## Copyright 2022-2023 by Maximilian Löffler <[email protected]> | ||
## All Rights Reserved. | ||
|
||
|
||
|
@@ -107,6 +109,109 @@ test_that("Match argument or take default.", { | |
expect_equal(actual.result, expected.result, info = "Multiple choices with ignored default, two choices") | ||
}) | ||
|
||
## | ||
## Check presence and datatype of data frame columns. | ||
## | ||
|
||
test_that("Check presence and datatype of data frame columns.", { | ||
|
||
user.names = c("John", "Peter", "Maria", "Susanne") | ||
|
||
## contains NaN to verify functionality does not break | ||
age = c(42, 50, NaN, 66) | ||
|
||
## contains NA to verify functionality does not break | ||
is.male = c(TRUE, TRUE, FALSE, NA) | ||
|
||
## construct simple testing dataframe | ||
data.frame = data.frame(user.names, age, is.male) | ||
|
||
## 1) Check base functionality (benign use-case) | ||
expect_error(verify.data.frame.columns( | ||
data.frame, c("user.names", "age", "is.male"), c("character", "numeric", "logical")), | ||
NA, | ||
message = "All columns present and well-typed.") | ||
## Expect no error | ||
|
||
## 2) Base test with reordered columns | ||
expect_error(verify.data.frame.columns( | ||
data.frame, c("is.male", "age", "user.names"), c("logical", "numeric", "character")), | ||
NA, | ||
message = "Order of columns does not matter.") | ||
## Expect no error | ||
|
||
## 3) Specify less columns than present (Allow optional columns) | ||
expect_error(verify.data.frame.columns( | ||
data.frame, c("user.names", "age"), c("character", "numeric")), | ||
NA, | ||
message = "Optional columns are allowed.") | ||
## Expect no error | ||
|
||
## 4) Unequal amount of column names and datatypes | ||
expect_error(verify.data.frame.columns( | ||
data.frame, c("user.names", "age", "is.male"), c("character", "numeric")), | ||
message = "More column names specified than datatypes.") | ||
expect_error(verify.data.frame.columns( | ||
data.frame, c("user.names", "age"), c("character", "numeric", "logical")), | ||
message = "More column names specified than datatypes.") | ||
|
||
## 5) Datatypes do not match column names | ||
expect_error(verify.data.frame.columns( | ||
data.frame, c("user.names", "age", "is.male"), c("logical", "character", "numeric")), | ||
message = "Column names do not match datatypes.") | ||
|
||
## 6) Invalid column / Column not present in dataframe (Typo) | ||
expect_error(verify.data.frame.columns( | ||
data.frame, c("user.name"), c("character")), | ||
message = "Column name 'user.name' should not be in dataframe.") | ||
|
||
## 7) No datatypes specified and column names are present | ||
expect_error(verify.data.frame.columns( | ||
data.frame, c("user.names", "age", "is.male")), | ||
NA, | ||
message = "Column names do not match datatypes.") | ||
## Expect no error | ||
|
||
## 8) No datatypes specified and column names are not specified correctly (Typo) | ||
expect_error(verify.data.frame.columns( | ||
data.frame, c("user.name")), | ||
message = "Column name 'user.name' should not be in dataframe.") | ||
|
||
## 9) Too many column names and no datatypes specified | ||
expect_error(verify.data.frame.columns( | ||
data.frame, c("user.names", "age", "is.male", "job.orientation")), | ||
message = "More column names specififed than present in the dataframe.") | ||
|
||
}) | ||
|
||
|
||
## / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / | ||
## Vector misc-------------------------------------------------------------- | ||
|
||
## | ||
## Check if a value is a single NA value. | ||
## | ||
|
||
test_that("Check if a value is a single NA value", { | ||
|
||
## 1) Tests for single NA | ||
expect_true(is.single.na(NA)) | ||
expect_true(is.single.na(list(NA))) | ||
expect_true(is.single.na(data.frame(NA))) | ||
|
||
## 2) Tests for values other than a single NA | ||
expect_false(is.single.na(0)) | ||
expect_false(is.single.na("na")) | ||
expect_false(is.single.na(NULL)) | ||
expect_false(is.single.na(logical(0))) | ||
expect_false(is.single.na(FALSE)) | ||
expect_false(is.single.na(c(NA, NA))) | ||
expect_false(is.single.na(c(3, NA))) | ||
expect_false(is.single.na(list(NA, NA))) | ||
expect_false(is.single.na(data.frame(NA, NA))) | ||
}) | ||
|
||
|
||
## / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / | ||
## Date handling ----------------------------------------------------------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
## Copyright 2017-2019 by Claus Hunsen <[email protected]> | ||
## Copyright 2018 by Barbara Eckl <[email protected]> | ||
## Copyright 2018 by Jakob Kronawitter <[email protected]> | ||
## Copyright 2023 by Maximilian Löffler <[email protected]> | ||
## All Rights Reserved. | ||
|
||
|
||
|
@@ -42,13 +43,13 @@ test_that("Network construction of the undirected artifact-cochange network", { | |
type = TYPE.ARTIFACT) | ||
## 2) edges | ||
edges = data.frame( | ||
from = c("Base_Feature", "Base_Feature"), | ||
to = c("foo", "foo"), | ||
date = get.date.from.string(c("2016-07-12 16:06:32", "2016-07-12 16:06:32")), | ||
artifact.type = c("Feature", "Feature"), | ||
hash = c("0a1a5c523d835459c42f33e863623138555e2526", "0a1a5c523d835459c42f33e863623138555e2526"), | ||
file = c("test2.c", "test2.c"), | ||
artifact = c("Base_Feature", "foo"), | ||
from = "Base_Feature", | ||
to = "foo", | ||
date = get.date.from.string("2016-07-12 16:06:32"), | ||
artifact.type = "Feature", | ||
hash = "0a1a5c523d835459c42f33e863623138555e2526", | ||
file = "test2.c", | ||
author.name = "Thomas", | ||
weight = 1, | ||
type = TYPE.EDGES.INTRA, | ||
relation = "cochange" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,11 @@ | |
## | ||
## Copyright 2017, 2019 by Claus Hunsen <[email protected]> | ||
## Copyright 2017 by Christian Hechtl <[email protected]> | ||
## Copyright 2023 by Christian Hechtl <[email protected]> | ||
## Copyright 2017 by Felix Prasse <[email protected]> | ||
## Copyright 2018 by Barbara Eckl <[email protected]> | ||
## Copyright 2018 by Thomas Bock <[email protected]> | ||
## Copyright 2023 by Thomas Bock <[email protected]> | ||
## Copyright 2018 by Jakob Kronawitter <[email protected]> | ||
## Copyright 2018-2019 by Anselm Fehnker <[email protected]> | ||
## Copyright 2021 by Johannes Hostert <[email protected]> | ||
|
@@ -421,12 +423,19 @@ test_that("Network construction of the undirected simplified author-cochange net | |
kind = TYPE.AUTHOR, | ||
type = TYPE.AUTHOR) | ||
|
||
## make test independent of igraph version | ||
date.attr = igraph::get.edge.attribute(network.built, "date") | ||
date.conversion.function = ifelse(all(sapply(date.attr, lubridate::is.POSIXct)), | ||
get.date.from.unix.timestamp, identity) | ||
|
||
## edge attributes | ||
data = data.frame( | ||
from = c("Björn", "Olaf", "Olaf", "Karl"), | ||
to = c("Olaf", "Karl", "Thomas", "Thomas"), | ||
date = I(list(c(1468339139, 1468339245), c(1468339541, 1468339570), c(1468339541, 1468339592), | ||
c(1468339570, 1468339592))), | ||
date = I(list(date.conversion.function(c(1468339139, 1468339245)), | ||
date.conversion.function(c(1468339541, 1468339570)), | ||
date.conversion.function(c(1468339541, 1468339592)), | ||
date.conversion.function(c(1468339570, 1468339592)))), | ||
artifact.type = I(list(c("Feature", "Feature"), c("Feature", "Feature"), c("Feature", "Feature"), | ||
c("Feature", "Feature"))), | ||
hash = I(list( | ||
|
@@ -442,6 +451,13 @@ test_that("Network construction of the undirected simplified author-cochange net | |
relation = "cochange" | ||
) | ||
|
||
## remove the 'AsIs' class from the edge attributes that have been inserted via `I(...)` | ||
data[["date"]] = unclass(data[["date"]]) | ||
data[["artifact.type"]] = unclass(data[["artifact.type"]]) | ||
data[["hash"]] = unclass(data[["hash"]]) | ||
data[["file"]] = unclass(data[["file"]]) | ||
data[["artifact"]] = unclass(data[["artifact"]]) | ||
|
||
## build expected network | ||
network.expected = igraph::graph.data.frame(data, directed = FALSE, vertices = authors) | ||
|
||
|
Oops, something went wrong.