r-simmer / simmer

Discrete-Event Simulation for R
https://r-simmer.org
GNU General Public License v2.0
222 stars 42 forks source link

reset() does not restore initial resource parameters #325

Closed Enchufa2 closed 1 month ago

Enchufa2 commented 1 month ago

Related to #324. Test case:

library(simmer)
library(testthat)

t <- trajectory() %>%
  set_capacity("res", 2) %>%
  set_queue_size("res", 2)

env <- simmer() %>%
  add_resource("res", 1, 1) %>%
  add_generator("dummy", t, at(0))

expect_equal(get_capacity(env, "res"), 1)
expect_equal(get_queue_size(env, "res"), 1)

run(env)

expect_equal(get_capacity(env, "res"), 2)
expect_equal(get_queue_size(env, "res"), 2)

reset(env)

expect_equal(get_capacity(env, "res"), 1)
expect_equal(get_queue_size(env, "res"), 1)