# WARNING - Generated by {fusen} from dev/flat_chars_structure_general.Rmd: do not edit by hand

test_that("Valid outputs are consistent", {
  
  input <- c("ABC123", "DE4F56", "789GHI", "ABC123")
  
  unique_named <- chars_structure_general(
    input_vector = input, split = "", 
    patterns_and_replacements = c("[:alpha:]" = "[letter]", 
                                  "[:digit:]" = "[number]"), 
    unique = TRUE, named_output = TRUE)
  
  unique_nonamed <- chars_structure_general(
    input_vector = input, split = "", 
    patterns_and_replacements = c("[:alpha:]" = "[letter]", 
                                  "[:digit:]" = "[number]"), 
    unique = TRUE, named_output = FALSE)
  
  nounique_nonamed <- chars_structure_general(
    input_vector = input, split = "", 
    patterns_and_replacements = c("[:alpha:]" = "[letter]", 
                                  "[:digit:]" = "[number]"), 
    unique = FALSE, named_output = FALSE)
  
  nounique_named <- chars_structure_general(
    input_vector = input, split = "", 
    patterns_and_replacements = c("[:alpha:]" = "[letter]", 
                                  "[:digit:]" = "[number]"), 
    unique = FALSE, named_output = TRUE)
  
  expect_identical(
    object = unique_named, 
    expected = c(ABC123 = "3[letter], 3[number]", 
                 DE4F56 = "2[letter], 1[number], 1[letter], 2[number]", 
                 `789GHI` = "3[number], 3[letter]"))
  
  expect_identical(
    object = unique_nonamed, 
    expected = c("3[letter], 3[number]", 
                 "2[letter], 1[number], 1[letter], 2[number]", 
                 "3[number], 3[letter]"))
  
  expect_identical(
    object = nounique_nonamed, 
    expected = c("3[letter], 3[number]", 
                 "2[letter], 1[number], 1[letter], 2[number]", 
                 "3[number], 3[letter]", "3[letter], 3[number]"))
  
  expect_identical(
    object = nounique_named, 
    expected = c(ABC123 = "3[letter], 3[number]", 
                 DE4F56 = "2[letter], 1[number], 1[letter], 2[number]", 
                 `789GHI` = "3[number], 3[letter]", 
                 ABC123 = "3[letter], 3[number]"))
  
})

test_that("Erros are consistent", {
  
  expect_error(
    object = chars_structure_general(input_vector = c(1, 2, 3)), 
    regexp = "input_vector must be a character vector")
})
