test_that("rfuzzyurn outputs expected structure", {
  N <- 50
  d <- 2
  Z_mat <- matrix(runif(N * d), nrow = N, ncol = d)
  
  res <- rfuzzyurn(n = 10, Z = Z_mat, 
                   mu = function(z) 0.5, 
                   w0 = function(z) 1.0)
                   
  expect_length(res$selected_units, 10)
  expect_length(res$X_trajectory, 11)
  expect_equal(res$final_fuzzy_mass, 5.0)
})

test_that("fuzzyurn_bound returns valid probabilities", {
  b <- fuzzyurn_bound(epsilon = 2, n = 10)
  expect_true(b >= 0 && b <= 1)
})
