Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork219
Add at accessors with bounds checking#342
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
c5554a6823a4cd05ae762c9651e5bf34e7b482b19b29665959c4f98cc9df1173337a122338944434b9402eab5d862018ccFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -171,4 +171,16 @@ if (.runThisTest) { | ||
| checkEquals( m[,1], m[,2] ) | ||
| } | ||
| test.IntegerMatrix.accessor.with.bounds.checking <- function() { | ||
| m <- matrix(seq(1L, 12, by=1L), nrow=4L, ncol=3L) | ||
| checkEquals(mat_access_with_bounds_checking(m, 0, 0), 1) | ||
| checkEquals(mat_access_with_bounds_checking(m, 1, 2), 10) | ||
| checkEquals(mat_access_with_bounds_checking(m, 3, 2), 12) | ||
| checkException(mat_access_with_bounds_checking(m, 4, 2) , msg = "index out of bounds not detected" ) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Am I missing something or should the msg be "index out of bounds" because the fact that we have an exception means your ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Actually, the error message is written if there is no error generated (c.f. RUnit documentation) Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I guess you are correct -- if it passes we just get Not that important. I'll try merge this maybe late this evening if I get to it. It now needs a manual intervention because ChangeLog changed in the meantime ... | ||
| checkException(mat_access_with_bounds_checking(m, 3, 3) , msg = "index out of bounds not detected" ) | ||
| checkException(mat_access_with_bounds_checking(m, 3, -1) , msg = "index out of bounds not detected" ) | ||
| checkException(mat_access_with_bounds_checking(m, -1, 2) , msg = "index out of bounds not detected" ) | ||
| checkException(mat_access_with_bounds_checking(m, -1, -1) , msg = "index out of bounds not detected" ) | ||
| } | ||
| } | ||