Skip to content
Snippets Groups Projects
Commit 8553f59b authored by Johannes Boog's avatar Johannes Boog
Browse files

[test] read and export msh files

parent bc47cefc
No related branches found
No related tags found
1 merge request!50Add support for mesh files in MSH format
......@@ -97,6 +97,32 @@ test_that("export_prj works for referenced *.dat files", {
unlink(test_path, recursive = TRUE)
})
test_that("export_prj works for referenced *.msh files", {
# Get extdata directory and create folder for the test
extdata_path <- system.file("extdata/", package = "r2ogs6")
test_path <- paste0(extdata_path, "/export_prj_test")
dir.create(test_path)
# Define prj_path and OGS6 object, then read in .prj file
ogs6_obj <- OGS6$new(sim_name = "t1_1Dsource",
sim_path = test_path)
prj_path <- system.file("extdata/benchmarks/t1_1Dsource",
"t1_1Dsource.prj", package = "r2ogs6")
suppressWarnings(read_in_prj(ogs6_obj, prj_path, read_in_gml = F))
# test with copying referenced files
export_prj(ogs6_obj, copy_ext_files = T)
expect_equal(sort(list.files(ogs6_obj$sim_path)),
sort(c("t1_1Dsource.gml", "t1_1Dsource.msh",
"t1_1Dsource.prj")))
# Tidy up by deleting the folder we created
unlink(test_path, recursive = TRUE)
})
test_that("export_prj works for process$include", {
......
......@@ -275,7 +275,7 @@ test_that("read_in works for python_script objects", {
})
test_that("read_in works for geometry and vtu meshes", {
test_that("read_in works for geometry and meshes", {
# read gml, vtu
prj_base_path <- system.file(
......@@ -317,6 +317,23 @@ test_that("read_in works for geometry and vtu meshes", {
expect_equal(ogs6_obj$meshes[[2]]$path, vtu_path2)
expect_equal(ogs6_obj$meshes[[3]]$path, vtu_path3)
expect_equal(ogs6_obj$meshes[[4]]$path, vtu_path4)
# read msh
prj_base_path <- system.file("extdata/benchmarks/t1_1Dsource",
package = "r2ogs6")
prj_path <- paste0(prj_base_path, "/t1_1Dsource.prj")
gml_path <- paste0(prj_base_path, "/t1_1Dsource.gml")
msh_path <- paste0(prj_base_path, "/t1_1Dsource.msh")
ogs6_obj <- OGS6$new(sim_name = "sim",
sim_path = "sim_path")
suppressWarnings(read_in_prj(ogs6_obj, prj_path, read_in_gml = F))
expect_equal(ogs6_obj$geometry, gml_path)
expect_equal(ogs6_obj$meshes$mesh$path, msh_path)
rm(ogs6_obj)
})
test_that("read_in works for chemical_system objects", {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment