tests/raw_as_char.R

suppressMessages(library(utils))
library(argon2)

compare = function(test, truth) stopifnot(identical(truth, test))

x = charToRaw("asdfZ")



### spaces = TRUE
truth = capture.output(print(x))
truth = substr(truth, 5, nchar(truth))
test = raw_as_char(x, upper=FALSE, spaces=TRUE)
compare(test, truth)

test = raw_as_char(x, upper=TRUE, spaces=TRUE)
compare(test, toupper(truth))



### spaces = FALSE
truth = paste0(unlist(strsplit(truth, split=" ")), collapse="")
test = raw_as_char(x, upper=FALSE, spaces=FALSE)
compare(test, truth)

test = raw_as_char(x, upper=TRUE, spaces=FALSE)
compare(test, toupper(truth))

Try the argon2 package in your browser

Any scripts or data that you put into this service are public.

argon2 documentation built on Oct. 31, 2021, 1:06 a.m.