Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test suite error? #16

Open
MansMeg opened this issue Dec 27, 2017 · 0 comments
Open

Test suite error? #16

MansMeg opened this issue Dec 27, 2017 · 0 comments

Comments

@MansMeg
Copy link
Collaborator

MansMeg commented Dec 27, 2017

This should probably not give an warning and this should be fixed in the test suite instead?.

Hi Mans,
So the problem was noticed by the students in lab2 with the function
while_mult_table()

Example code:
while_mult_table <- function(from, to) {
i <- 0
vect <- from:to
temp <- c()
range <- length(vect)
while (i < range) {
i <- i + 1
start_pos <- range * (i - 1) + 1
end_pos <- range * i
temp[start_pos:end_pos] <-
vect * sort(vect[i], decreasing = FALSE)
}
mat_final <- matrix(temp, nrow = range, ncol = range)
colnames(mat_final) <- sort(vect, decreasing = FALSE)
rownames(mat_final) <- sort(vect, decreasing = FALSE)
return(mat_final)
}
When I run mark_my_assignment on this I get the warnings:
Warnings

  1. Assignment: while_mult_table() (@test-while_mult_table-1.R#39) -
    numerical expression has 3 elements: only the first used
  2. Assignment: while_mult_table() (@test-while_mult_table-1.R#39) - NAs
    introduced by coercion
    Failed

as it should. Students who installed the latest version (next to me by
install.packages(), so I guess from CRAN) do not observe this warning at
all.

What is also interesting is that if from:to is replaced by seq(from,to)
then students' code throws an error that markmyassignment correctly
considers as an error thrown (but I do not know if there is any way of
automatically making sure input is checked)?

Cheers
Krzysztof

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant