From a1572f28db44849addade3181396e5cdcbac887c Mon Sep 17 00:00:00 2001 From: aheinri5 <Anna@netzkritzler.de> Date: Sun, 2 May 2021 12:09:51 +0200 Subject: [PATCH] Added a test for the axisym attribute which didnt get exported before --- tests/testthat/test-export_utils.R | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/testthat/test-export_utils.R b/tests/testthat/test-export_utils.R index 1c152a5..2223f17 100644 --- a/tests/testthat/test-export_utils.R +++ b/tests/testthat/test-export_utils.R @@ -220,3 +220,27 @@ test_that("to_node works for prj_process class", { expect_equal(attrs, c(internal_name = "sigma_xx", output_name = "sigma_xx")) }) + + + +test_that("meshes_to_node works for mesh / meshes elements", { + + meshes <- list(mesh = list(path = "a", axially_symmetric = TRUE), + mesh = list(path = "b", axially_symmetric = FALSE)) + + test_xml_1 <- meshes_to_xml(meshes) + + expect_equal(length(xml2::xml_find_all(test_xml_1,"/meshes/mesh")), 2) + expect_equal(xml2::xml_attrs(xml2::xml_find_first(test_xml_1, + "/meshes/mesh")), + c(axially_symmetric = "true")) + + + lone_mesh <- list(mesh = list(path = "a", axially_symmetric = TRUE)) + test_xml_2 <- meshes_to_xml(lone_mesh) + + expect_equal(length(xml2::xml_find_all(test_xml_2,"/mesh")), 1) + expect_equal(xml2::xml_attrs(xml2::xml_find_first(test_xml_2, + "/mesh")), + c(axially_symmetric = "true")) +}) -- GitLab