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

test_that("hsRestoreAttributes works correctly", {
  # Create a test object with attributes
  x <- 1:5
  attr(x, "attr1") <- "value1"
  attr(x, "attr2") <- 123

  # Store original attributes
  original_attrs <- attributes(x)

  # Remove an attribute
  attr(x, "attr1") <- NULL

  # Restore the removed attribute
  x_restored <- hsRestoreAttributes(x, original_attrs)

  # Test that the attribute was restored
  expect_equal(attr(x_restored, "attr1"), "value1")
  expect_equal(attr(x_restored, "attr2"), 123)

  # Test that the object values remain unchanged
  expect_true(all(x_restored == 1:5))

  # Test with no attributes to restore
  x_no_restore <- hsRestoreAttributes(x_restored, list())
  expect_equal(x_no_restore, x_restored)
  expect_equal(attributes(x_no_restore), attributes(x_restored))
})
