Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
a449113
Testing our own test method
samuvait Sep 15, 2017
13c771b
Added helper script for testing.
anttihaap Sep 15, 2017
afcd8c1
Refactoring testproject1.
anttihaap Sep 15, 2017
442ec44
Initialized the branch
aleksisv Sep 16, 2017
1937c0b
Merge branch 'real-exe' of github.com:RTMC/tmc-r into real-exe
Sep 16, 2017
d79cfa8
wrote first tests
Sep 16, 2017
bb7c741
Added further example tests
aleksisv Sep 16, 2017
dcedb32
Fixed conflicts
Sep 16, 2017
5b3b50b
helperTMC.R stores points to result.R
anttihaap Sep 16, 2017
878d703
Merge branch 'owntestmethod' of github.com:RTMC/tmc-r into owntestmethod
anttihaap Sep 16, 2017
5c9b794
Fixed problem with previous merge.
anttihaap Sep 16, 2017
dfa80da
Added comments and refactored code
aleksisv Sep 17, 2017
809033b
Completed example exercise.
aleksisv Sep 17, 2017
762ba82
Added nothing.
aleksisv Sep 17, 2017
d2d8d04
Merge branch 'real-exe' into owntestmethod
aleksisv Sep 17, 2017
fb04899
Merged two branches
aleksisv Sep 17, 2017
d3029bc
Changed the points-annotation to the new style
aleksisv Sep 17, 2017
7300ce5
Found a missing file.
aleksisv Sep 17, 2017
32d3ec4
result.R runs all tests from tests/testthat
samuvait Sep 17, 2017
c5847de
Merge branch 'owntestmethod' of github.com:RTMC/tmc-r into owntestmethod
samuvait Sep 18, 2017
9d883dd
Points are added for a file to the tests if all the tests pass
samuvait Sep 18, 2017
70b53c6
Fixed JSON vector/list issue.
anttihaap Sep 18, 2017
e555fc3
Added messages for json results.
anttihaap Sep 18, 2017
b6935fc
Fixed: forgotten variable name change.
anttihaap Sep 18, 2017
73c5093
Duplicate points corrected
samuvait Sep 19, 2017
3a4a462
Fixed exercise enumeration typo
aleksisv Sep 19, 2017
a3ef0da
Template for tmcRtestrunner package.
anttihaap Sep 20, 2017
523a812
Fixed: R CMD check failure.
anttihaap Sep 20, 2017
0a2cb50
refactoring result.R
samuvait Sep 20, 2017
d6dfd21
Create a function from creating results
samuvait Sep 20, 2017
393b7a0
Added old things.
aleksisv Sep 21, 2017
6dfc5f5
Merged Samu's changes to result.r with the new branch
aleksisv Sep 21, 2017
b6899ef
.travism.yml
aleksisv Sep 21, 2017
eb65a3d
Removed unnecessary file.
aleksisv Sep 21, 2017
0f034d7
Removed newline
aleksisv Sep 21, 2017
715c1ca
Merge branch 'owntestmethod' of github.com:RTMC/tmc-r into owntestmethod
aleksisv Sep 21, 2017
9130d14
Finished the merge
aleksisv Sep 21, 2017
51451bd
Merge pull request #4 from RTMC/tmcRtestrunner
anttihaap Sep 21, 2017
fcb5798
Integrated implementations from result.R to our testing package.
anttihaap Sep 21, 2017
88072fc
Fixed: tests.
anttihaap Sep 21, 2017
df7f9e9
Trying to fix travis (working directory problems maybe?)
anttihaap Sep 21, 2017
a76f602
Fixed function names.
anttihaap Sep 21, 2017
34d107d
Fixed more function naming.
anttihaap Sep 21, 2017
0b67a2c
Added a new test
Sep 21, 2017
55a137b
Added new dummy functions to check if coverage works as intended
Sep 21, 2017
2eece83
Changed the third dummy method to pass.
Sep 21, 2017
36e2d77
Added new test file.
aleksisv Sep 21, 2017
94ec7f0
Changed project structure
aleksisv Sep 21, 2017
bdc17e0
Changed .travis.yml to include new tests.
aleksisv Sep 21, 2017
8558880
Made the branch compatible with other branches
aleksisv Sep 22, 2017
cfcf32e
Made branch fully compatible with owntestmethod
aleksisv Sep 22, 2017
04960a8
Fixed comment on RunTests.R
aleksisv Sep 22, 2017
1c5c37b
Fixed namings of the functions. Test that checks if you can find hidd…
aleksisv Sep 22, 2017
ec424e1
Started writing tests to correct functions.
aleksisv Sep 22, 2017
3e8f011
Refactored runTests-class so that it would be easier to test.
aleksisv Sep 22, 2017
84c6ea0
Fixed travis build fail in runTests
aleksisv Sep 22, 2017
61263b0
Tried to fix travis issue.
aleksisv Sep 22, 2017
725357a
Refacored old runTests code and added tests
aleksisv Sep 22, 2017
82cf7a7
Changed test names.
aleksisv Sep 22, 2017
64c2b63
Fixing travis issues.
aleksisv Sep 22, 2017
0e56f73
Figuring out what causes the tests to fail on travis.
aleksisv Sep 22, 2017
97810ed
Figuring out what causes the tests to fail on travis.
aleksisv Sep 22, 2017
aa6546c
Figuring out what causes the tests to fail on travis.
aleksisv Sep 22, 2017
c240a35
Trying to fix travis
aleksisv Sep 22, 2017
d174a28
getAvailablePoints-script added
hyttijan Sep 22, 2017
0027098
Testing travis.
anttihaap Sep 22, 2017
186f8cf
Trying to fix travis again.
anttihaap Sep 22, 2017
d14c08e
Fixed travis (once more.)
aleksisv Sep 22, 2017
17524fd
Refactored code. Fixed an issue with JSON
aleksisv Sep 23, 2017
a81e631
Added test to test printing
aleksisv Sep 23, 2017
d718d91
Changed .travis.yml-file
aleksisv Sep 23, 2017
2b0aa80
Changed .travis.yml-file
aleksisv Sep 23, 2017
a3c60f3
Trying to wake up coveralls
aleksisv Sep 23, 2017
d823de7
Changed .travis.yml files to include coveralls
aleksisv Sep 23, 2017
f4ccb74
Added support to parallel builds.
aleksisv Sep 23, 2017
4d01620
Added support to parallel builds.
aleksisv Sep 23, 2017
3d7e505
Configuring travis
aleksisv Sep 23, 2017
3450a3d
Fixing travis.
aleksisv Sep 23, 2017
0757db0
Fixing travis.
aleksisv Sep 23, 2017
bb09f1f
Trying to fix travis.
aleksisv Sep 23, 2017
b8e7419
Added resources for testrunner, some refactoring and test modifications.
anttihaap Sep 23, 2017
840edc0
Fixed typos...
anttihaap Sep 23, 2017
7098298
A lot of refactoring.
anttihaap Sep 23, 2017
415ef74
Added comments to the newly refactored source-files
aleksisv Sep 24, 2017
aad55b6
Added tests that test tmcRtestrunner
aleksisv Sep 25, 2017
4f39b6a
Added tests to test that points are added correctly to the result dat…
aleksisv Sep 25, 2017
3b0e46d
Testing that file is created correctly when runTests is called.
aleksisv Sep 25, 2017
d8e08b2
Added a second small resource project that includes files with failin…
aleksisv Sep 25, 2017
afc4e74
Added more tests.
aleksisv Sep 25, 2017
eb0a250
Added a printing test.
aleksisv Sep 25, 2017
70cfac8
Modified README
aleksisv Sep 25, 2017
9f858ff
Modified example project description files
aleksisv Sep 25, 2017
fbf25f9
Modified .travis.yml
aleksisv Sep 25, 2017
023f564
Modified README.md
aleksisv Sep 25, 2017
a79dffe
Merge branch 'tmcRtestrunner' into metatests
aleksisv Sep 25, 2017
4338285
Merge pull request #5 from RTMC/metatests
samuvait Sep 25, 2017
cd7ea13
Merge branch 'owntestmethod' into tmcRtestrunner
aleksisv Sep 25, 2017
169776c
Modified example project description file
aleksisv Sep 25, 2017
880c814
Added files to collate
aleksisv Sep 25, 2017
95c10c3
Merge pull request #7 from RTMC/metatests
tmoo Sep 25, 2017
13d2f5b
Merge pull request #8 from RTMC/tmcRtestrunner
tmoo Sep 25, 2017
06cf358
merged owntestmethod to master
aleksisv Sep 25, 2017
4865e2a
Fixed description file
aleksisv Sep 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ env:
- REPO_TO_TEST=tmcRtestrunner
- REPO_TO_TEST=tmcrstudioaddin


after_success:
- Rscript -e 'library(covr);coveralls()'
1 change: 0 additions & 1 deletion example_projects/example_project1/.Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
^\.travis\.yml$
^.*\.Rproj$
^\.Rproj\.user$

1 change: 1 addition & 0 deletions example_projects/example_project1/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.Rdata
.Rhistory
.results.json
84 changes: 0 additions & 84 deletions example_projects/example_project1/.results.json

This file was deleted.

2 changes: 1 addition & 1 deletion example_projects/example_project1/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Title: What the Package Does (one line, title case)
Version: 0.0.0.9000
Authors@R: person("First", "Last", email = "first.last@example.com", role = c("aut", "cre"))
Description: What the package does (one paragraph).
Depends: R (>= 3.3.2)
Depends: R (>= 3.2.3)
License: What license is it under?
Encoding: UTF-8
LazyData: true
2 changes: 2 additions & 0 deletions example_projects/example_project1/NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by roxygen2: fake comment so roxygen2 overwrites silently.
exportPattern("^[^\\.]")
73 changes: 73 additions & 0 deletions example_projects/example_project1/R/week1.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
##These exercises are taken from the course "Data-analyysi R-ohjelmistolla"
#(https://wiki.helsinki.fi/pages/viewpage.action?pageId=135074576).
##

##Exercise 1

a1 <- 4 + 10
b1 <- 5*a1
c1 <- b1^3
d1 <- exp(b1)
e1 <- d1^(1/10)
f1 <- sin(c1)
res1 <- (b1 + c1 + e1 + f1)

##Exercise 2

a2 <- 51%%7

##Excercise 3
a3 <- 51%%7 + 51%/%7

##Excercise 4
v4_1 <- c(20, 5, -2, 3, 47)
v4_2 <- seq(0, 100, 5)
v4_3 <- c(v4_1, v4_2)
v4_4 <- v4_3[(v4_3 > 3) & (v4_3 < 50)]
v4_5 <- v4_4[(v4_4 %% 10) == 0]

##Exercise 5
v5_1 <- rep(0, 1, 50)
v5_1[c(F, T)] <- 2

sum5_1 <- sum(v5_1)
v5_1
v5_2 <- v5_1
v5_2[c(T, F)] <- 1.2
sum5_2 <- sum(v5_2)

##Excerice 6

A <- matrix(c(3, 5, 6, 1/2, sqrt(5), 16, 0, 2, 0),nrow = 3, ncol = 3, byrow = TRUE)


##Excercise 7
B <- c(1, 1, 0)%*% solve(A)

##Excercise 8
I_3 <- diag(c(1, 1, 1))
A_8 <- A %*%I_3

##Excercise 9
is_eq_matrix <- t(A) == A
is_eq_matrix <- F

##Excercise 10
C_10 <- matrix(c(runif(20, min = 1, max=20)), ncol=4)
v10_1 <- C_10[C_10 < 5]
number10 <- length(v10_1)

D_10 <- C_10
D_10[D_10 < 5] <- 10

E_10 <- D_10
E_10 <- D_10[c(T, T, T, T, F),c(F,T,T, T)]


##Excercise 11
C_11 <- matrix(1:100, ncol=2)
C_11[c(F, T)] <- NA

##Excercise 12
C_12 <- C_11
C_12[is.na(C_12)] <- 0
4 changes: 4 additions & 0 deletions example_projects/example_project1/example_project1.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
13 changes: 13 additions & 0 deletions example_projects/example_project1/tests/testthat/helperTMC.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

#Sets the points for all tests to global environment, wherefrom they can
#be retrieved.
pointsForAllTests <- function(points) {
.GlobalEnv$points_for_all_tests <- points
}

#The test that wraps around test_that()-method and stores the points
#to global environment.
test <- function(desc, points, code) {
.GlobalEnv$points[[desc]] <- points
test_that(desc, code)
}
33 changes: 22 additions & 11 deletions example_projects/example_project1/tests/testthat/testArithmetics.R
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
library('testthat')
source('../../R/arithmetics.R')

#Testing whether addition works.
test_that("Addition works#[point1]", {
source("../../R/arithmetics.R")

pointsForAllTests(c("r1"))

test("Addition works", c("r1.1", "r1.2"), {
expect_equal(add(1, 2), 3)
expect_equal(add(1, 2), 3.0)
expect_equal(add(1, 4), 5)
})

test_that("Multiplication works#[point1, point2]", {
test("Multiplication works", c("r1.3", "r1.4"), {
expect_equal(multiply(1, 2), 2)
expect_equal(multiply(2, 10), 20)
})

test_that("Subtraction works#[point1, point2]", {
expect_equal(subtract(10, 2), 8)
expect_equal(subtract(0, 0), 0)
expect_equal(subtract(0, 4), -4)
test("Subtraction works", c("r1.5"), {
expect_equal(subtract(10, 2), 8)
expect_equal(subtract(0, 0), 0)
expect_equal(subtract(0, 4), -4)
})

test("Division works", c("r1.6"), {
expect_equal(divide(10, 2), 5)
expect_equal(divide(1, 2), 0.5)
})

test("Test with no points", c(), {
expect_equal(1,1)
})

test_that("Division works#[point1, point2]", {
expect_equal(divide(10, 2), 5)
expect_equal(divide(1, 2), 0.5)
test("Dummy test set to fail", c(), {
expect_true(FALSE)
expect_equal(1,2)
})
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
library('testthat')
source('../../R/matrices.R')

test_that("Matrix transpose with [[1,2]] works#[point1]", {
pointsForAllTests(c("r2"))

test("Matrix transpose with [[1,2]] works", c("r2.1"), {
A<- matrix(c(1,2),nrow=1)
expect_equal(transposeMatrix(A),matrix(c(1,2),nrow=2))
})
test_that("Matrix transpose with [[1,2],[3,4]] works#[point1]", {

test("Matrix transpose with [[1,2],[3,4]] works", c("r2.2"), {
A<- matrix(c(1,2,3,4),nrow=2)
expect_equal(transposeMatrix(A),matrix(c(1,3,2,4),nrow=2))
})
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
library('testthat')
source('../../R/strings.R')

test_that("Constant string works#[point1, point2]", {
pointsForAllTests(c("r3"))

test("Constant string works", c("r3.1"), {
expect_equal(constant_string(), "jono")
})
79 changes: 79 additions & 0 deletions example_projects/example_project1/tests/testthat/testWeek1.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
library('testthat')
source('../../R/week1.R')

pointsForAllTests(c("r4"))

help_A <- matrix(c(3, 5, 6, 1/2, sqrt(5), 16, 0, 2, 0),nrow = 3, ncol = 3, byrow = TRUE)

test("Exercise 1 is correct", c("r4.1"), {
expect_equal(a1, 14)
expect_equal(b1, 70)
expect_equal(c1, 343000)
expect_true(abs(e1-1096.63) < 0.1)
expect_true(abs(f1 - 0.7920019) < 0.1)
expect_true(abs(res1 - 344167.4) < 0.1)
})

test("Exercise 2 is correct", c("r4.2"), {
expect_equal(a2, 2)
})

test("Exercise 3 is correct", c("r4.3", "r4.4"), {
expect_equal(a3, 9)
})

test("Exercise 4 is correct", c("r4.5"), {
expect_equal(v4_1, c(20, 5, -2, 3, 47))
expect_equal(v4_2, c(0:20)*5)
expect_equal(v4_3, c(c(20, 5, -2, 3, 47), seq(0, 100, 5)))
expect_equal(v4_4, c(20, 5, 47, 5, 10, 15, 20, 25, 30, 35, 40, 45))
expect_equal(v4_5, c(20, 10, 20, 30, 40))
})

test("Exercise 5 is correct", c("r4.6"), {
t1 <- rep(0, 1, 50)
t1[c(F, T)] <- 2
expect_equal(v5_1, t1)
expect_equal(sum5_1, 50)
expect_equal(sum5_2, 80)
})

test("Exercise 6 is correct", c("r4.7"), {
expect_equal(A, matrix(c(3, 5, 6, 1/2, sqrt(5), 16, 0, 2, 0),nrow = 3, ncol = 3, byrow = TRUE))
})

test("Exercise 7 is correct", c("r4.8"), {
expect_equal(A, help_A)
})

test("Exercise 8 is correct", c("r4.9"), {
expect_equal(B, c(1, 1, 0)%*%solve(help_A))
})

test("Exercise 9 is correct", c("r4.10"), {
expect_equal(I_3, diag(c(1, 1, 1)))
expect_equal(A_8, help_A)
})

test("Exercise 10 is correct", c("r4.11"), {
expect_false(is_eq_matrix)
})

test("Exercise 11 is correct", c("r4.12"), {
expect_true(number10 < 10)

expect_true(dim(E_10)[1] == 4)
expect_true(dim(E_10)[2] == 3)
})

test("Exercise 12 is correct", c("r4.13"), {
M <- matrix(1:100, ncol=2)
M[c(F, T)] <- NA
expect_equal(C_11, M)
})

test("Exercise 13 is correct", c("r4.14"), {
M <- matrix(1:100, ncol=2)
M[c(F, T)] <- 0
expect_equal(C_12, M)
})
Loading