tests/testthat/test-is_int_str.R

library(testthat)

test_that("is_int_str works", {
    fixed_point_notation <- c("2.0", "3.", ".4", "-5.", "-.6")
    scientific_notation <- c("0.45e+04", "66e-05", "0.2e-3", "-33.e-1")

    floats <- c(fixed_point_notation, scientific_notation)
    ints <- c("5", "-5", "1234")
    words <- c("Hello", "world", "!", "It was nice seeing you", ".")

    expect_true(all(is_int_str(floats) == FALSE))
    expect_true(all(is_int_str(ints) == TRUE))
    expect_true(all(is_int_str(words) == FALSE))
})

Try the metabodecon package in your browser

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

metabodecon documentation built on Nov. 5, 2025, 7:12 p.m.