Verified Commit fb3d4194 authored by Artem Klevtsov's avatar Artem Klevtsov 😹

Fix tests

parent a965d305
......@@ -2,7 +2,8 @@
ptrn <- "[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}"
expect_error(uuid_generate(NULL))
expect_error(uuid_generate(NA))
# expect_error(uuid_generate(NA_integer_))
expect_error(uuid_generate(c(0, 0)))
expect_equal(uuid_generate(0), character(0))
expect_true(is.character(uuid_generate(1)))
expect_true(grepl(ptrn, uuid_generate(1)))
......
expect_error(uuid_validate(NULL))
expect_equal(uuid_validate(NA), NA)
expect_equal(uuid_validate(""), NA)
expect_false(uuid_validate(""), NA)
expect_false(uuid_validate("0"))
expect_false(all(uuid_validate(c("0", "0"))))
expect_equal(length(uuid_generate(7)), 7)
expect_true(uuid_validate(uuid_generate(1)))
expect_true(all(uuid_validate(uuid_generate(100))))
......@@ -60,7 +60,7 @@ Rcpp::LogicalVector uuid_validate(Rcpp::StringVector x) {
size_t n = x.size();
Rcpp::LogicalVector res = Rcpp::no_init(n);
for (size_t i = 0; i < n; ++i) {
if (x[i].empty() || Rcpp::StringVector::is_na(x[i])) {
if (Rcpp::StringVector::is_na(x[i])) {
res[i] = NA_LOGICAL;
} else {
res[i] = uuids::uuid::is_valid_uuid(std::string(x[i]));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment