Skip to content

Commit

Permalink
Fix incorrect odin code in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
richfitz committed Nov 14, 2024
1 parent 85942c9 commit f8ae8d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/test-generate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];",
" }",
"}"))

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit f8ae8d6

Please sign in to comment.