Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5033498

Browse files
committed
added a test for cacheMatrix$set() function
1 parent ac151dc commit 5033498

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cachematrix.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ cacheSolve(cacheMatrix2) # Should display "calculating the inverse"
5050
cacheSolve(cacheMatrix2) # Should display "getting data from cache"
5151
cacheSolve(cacheMatrix) # Should display "getting data from cache"
5252

53+
cacheMatrix$set(matrix(rnorm(16),4))
54+
cacheSolve(cacheMatrix) # Should display "calculating the inverse"
55+
5356
myBigMatrix <- matrix(rnorm(5000*5000), 5000)
5457
cacheBigMatrix <- makeCacheMatrix(myBigMatrix)
5558
result <- cacheSolve(cacheBigMatrix) # Should display "calculating the inverse" and take a long time

0 commit comments

Comments
 (0)