Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
eddelbuettel merged 14 commits intoRcppCore:masterfromfplazaonate:at-accessors-patch
Aug 25, 2015
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
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
PrevPrevious commit
Enable unit tests with negative indices
  • Loading branch information
Florian Plaza Oñate committedAug 20, 2015
commit62018cc2908c156c320822f8a4f394cc10adb5b6
6 changes: 3 additions & 3 deletionsinst/unitTests/runit.Matrix.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -178,9 +178,9 @@ if (.runThisTest) {
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" )
Copy link
Member

Choose a reason for hiding this comment

The 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 yourthrow went into effect?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The 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)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I guess you are correct -- if it passes we just getTRUE. But if you look at our code the msg field, when we set it all :), mostly just states where this came from. So "matrix bounds check" would be fine, and s/matrix/vector/ for the other one.

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" )
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" )
}

}
2 changes: 1 addition & 1 deletioninst/unitTests/runit.Vector.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -688,7 +688,7 @@ if (.runThisTest) {
x <- seq(1L, 5L, by=1L)
checkEquals(vec_access_with_bounds_checking(x, 3), 4)
checkException(vec_access_with_bounds_checking(x, 5) , msg = "index out of bounds not detected" )
#checkException(vec_access_with_bounds_checking(x, -1) , msg = "index out of bounds not detected" )
checkException(vec_access_with_bounds_checking(x, -1) , msg = "index out of bounds not detected" )
}
}


[8]ページ先頭

©2009-2025 Movatter.jp