diff --git a/R/convert_sic_params.R b/R/convert_sic_params.R index 9ec364361296d907680459588d7914dbae0dca2b..7b674e60199df0b2b90505c7433292366df9feed 100644 --- a/R/convert_sic_params.R +++ b/R/convert_sic_params.R @@ -11,7 +11,7 @@ #' @export #' #' @examples -#' convert_sic_param(list(SCE = 1, VAR = 1)) +#' convert_sic_params(list(SCE = 1, VAR = 1)) #' convert_sic_params <- function(params, cfg = loadConfig()) { if (!"INTERF" %in% names(params)) { diff --git a/R/sic_run_fortran.R b/R/sic_run_fortran.R index d9111eb7a561fa3f22187a8d247862aaf4af3a3e..57c986a5f2638ea89b9c54d017cc262ccdd89698 100644 --- a/R/sic_run_fortran.R +++ b/R/sic_run_fortran.R @@ -16,7 +16,7 @@ #' params <- list(SCE=1) #' sic_run_fortran("fluvia", params) #'} -sic_run_fortran <- function(prog, params, cfg = loadConfig()) { +sic_run_fortran <- function(prog, params = list(), cfg = loadConfig()) { if (is.list(params)) params <- convert_sic_params(params, cfg) cmd_line <- shQuote( paste( diff --git a/tests/testthat/test-create_section_txt.R b/tests/testthat/test-create_section_txt.R index b014043213a0a9080cb58aceac6030351968d646..aec73a5dbeec1afa6c1720c19a90208cc3ea51fd 100644 --- a/tests/testthat/test-create_section_txt.R +++ b/tests/testthat/test-create_section_txt.R @@ -7,7 +7,7 @@ profT <- list( test_that("Trapezoidale minor section", { expect_equal( - create_section_txt("toto", 1000, "T", profT, distance_majeur = FALSE), + create_section_txt("toto", 1000, "T", profT, distance_majeur = FALSE)[1:3], c("toto $ 1000 $ $ 0 $ T", "2\t1", "102\t100") ) profT_wrong <- profT @@ -23,7 +23,7 @@ test_that("X/Z minor section", { ) profA <- matrix(c(0, 2, 4, 6, 102, 100, 100, 102), ncol = 2) expect_equal( - create_section_txt("toto", 1000, "A", profA, distance_majeur = FALSE), + create_section_txt("toto", 1000, "A", profA, distance_majeur = FALSE)[1:5], c("toto $ 1000 $ $ 0 $ A", "0\t102", "2\t100", "4\t100", "6\t102") ) }) diff --git a/tests/testthat/test-sic_run_fortran.R b/tests/testthat/test-sic_run_fortran.R index 15b5bcc6832957743d84a811eb5e32239d07f3aa..7a0b3db214ea82201d43e08b2f9bb3b8b73bc8f0 100644 --- a/tests/testthat/test-sic_run_fortran.R +++ b/tests/testthat/test-sic_run_fortran.R @@ -7,3 +7,9 @@ test_that("fluvia on SCE=1 should create a binary result file", { expect_true(file.exists(gsub("\\.xml", "_1_0.res", cfg$project$path))) expect_true(file.exists(gsub("\\.xml", "_1_0.rci", cfg$project$path))) }) + +test_that("talweg should update xml project", { + mtime_before <- file.mtime(cfg$project$path) + sic_run_fortran("talweg", cfg = cfg) + expect_gt(file.mtime(cfg$project$path), mtime_before) +})