From f8ae8d61d0440134b7d11ed2e127bf29d5645c5f Mon Sep 17 00:00:00 2001 From: Rich FitzJohn Date: Wed, 13 Nov 2024 18:56:00 +0000 Subject: [PATCH] Fix incorrect odin code in tests --- tests/testthat/test-generate.R | 4 ++-- tests/testthat/test-parse.R | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test-generate.R b/tests/testthat/test-generate.R index f8aaa68d..2cdeb31b 100644 --- a/tests/testthat/test-generate.R +++ b/tests/testthat/test-generate.R @@ -2358,7 +2358,7 @@ test_that("cast integers to sizes", { test_that("can generate system with output", { dat <- odin_parse({ initial(x[]) <- 0 - deriv(x[]) <- x * r[i] + deriv(x[]) <- x[i] * r[i] r <- parameter() n <- 3 dim(x) <- n @@ -2384,7 +2384,7 @@ test_that("can generate system with output", { c(method_args$rhs, " const auto * x = state + 0;", " for (size_t i = 1; i <= shared.dim.x.size; ++i) {", - " state_deriv[i - 1 + 0] = x * shared.r[i - 1];", + " state_deriv[i - 1 + 0] = x[i - 1] * shared.r[i - 1];", " }", "}")) diff --git a/tests/testthat/test-parse.R b/tests/testthat/test-parse.R index cb5d46b7..b5fc2e50 100644 --- a/tests/testthat/test-parse.R +++ b/tests/testthat/test-parse.R @@ -888,7 +888,7 @@ test_that("LHS of assignment with [] on sum is accepted", { expect_error( odin_parse({ initial(x) <- 0 - update(x) <- a_tot + update(x) <- sum(a_tot) dim(a) <- c(4, 4) dim(a_tot) <- 4 a[, ] <- 3 @@ -1054,7 +1054,7 @@ test_that("don't duplicate offsets when boundary condition used in initial", { dat <- odin_parse({ initial(x[]) <- 0 initial(x[1]) <- 1 - update(x[]) <- x + 1 + update(x[]) <- x[i] + 1 dim(x) <- 4 }) expect_equal(dat$variables, "x")