Skip to content
Open
Changes from all commits
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
18 changes: 17 additions & 1 deletion tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
library(testthat)
library(qqid)

test_check("qqid")
# check if the ANU Quantum Random Number Generator API is available
check_qrng <- function(){
tryCatch(
expr = {
req <- curl::curl_fetch_memory('https://qrng.anu.edu.au/index.php')
req$status_code
},
error = function(e){
-1
}
)
}

## run tests only if internet access and the QRNG API is both available
if(curl::has_internet() & check_qrng() == 200){
test_check("qqid")
}

# [END]