@@ -100,3 +100,31 @@ test_that("warm-up filtering works as expected", {
100100 mock_result [[" arrivals" ]])
101101 expect_identical(short_warm_up [[" resources" ]], mock_result [[" resources" ]])
102102})
103+
104+
105+ test_that(" parallel processing runs successfully" , {
106+
107+ # Mock simulation model function so it can run without other dependencies
108+ # This will allows us to execute runner, but when it calls model(), instead
109+ # of attempting to run a simulation, it will just return a list of dataframes
110+ test_model <- function (run_number , param , set_seed ) {
111+ list (
112+ arrivals = data.frame (run = run_number , value = rnorm(1 )),
113+ resources = data.frame (run = run_number , value = rnorm(1 )),
114+ run_results = data.frame (run = run_number , success = TRUE )
115+ )
116+ }
117+ mockery :: stub(runner , " simulation::model" , test_model )
118+ param <- list (cores = 2 , number_of_runs = 5 )
119+ result <- runner(param , use_future_seeding = TRUE )
120+
121+ # Check if results contain expected structure
122+ expect_true(" arrivals" %in% names(result ))
123+ expect_true(" resources" %in% names(result ))
124+ expect_true(" run_results" %in% names(result ))
125+
126+ # Ensure results have 5 runs worth of data
127+ expect_equal(nrow(result $ arrivals ), 5 )
128+ expect_equal(nrow(result $ resources ), 5 )
129+ expect_equal(nrow(result $ run_results ), 5 )
130+ })
0 commit comments