Skip to content

Commit

Permalink
Add tests for deprecated parameters in RenameBlockGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
loganharbour committed Nov 18, 2021
1 parent 99cf669 commit f6c102f
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"reporters": {
"mesh_info": {
"type": "MeshInfo",
"values": {
"subdomain_elems": {
"type": "std::map<unsigned short, MeshInfo::SubdomainInfo, std::less<unsigned short>, std::allocator<std::pair<unsigned short const, MeshInfo::SubdomainInfo> > >"
}
}
}
},
"time_steps": [
{
"mesh_info": {
"subdomain_elems": null
},
"time": 0.0,
"time_step": 0
},
{
"mesh_info": {
"subdomain_elems": [
{
"elems": [
0,
1,
4,
5
],
"id": 1,
"name": "block0"
},
{
"elems": [
2,
3,
6,
7
],
"id": 2,
"name": "block1"
},
{
"elems": [
8,
9,
12,
13
],
"id": 3,
"name": "block2"
},
{
"elems": [
10,
11,
14,
15
],
"id": 4,
"name": "block3"
}
]
},
"time": 1.0,
"time_step": 1
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"reporters": {
"mesh_info": {
"type": "MeshInfo",
"values": {
"subdomain_elems": {
"type": "std::map<unsigned short, MeshInfo::SubdomainInfo, std::less<unsigned short>, std::allocator<std::pair<unsigned short const, MeshInfo::SubdomainInfo> > >"
}
}
}
},
"time_steps": [
{
"mesh_info": {
"subdomain_elems": null
},
"time": 0.0,
"time_step": 0
},
{
"mesh_info": {
"subdomain_elems": [
{
"elems": [
0,
1,
4,
5
],
"id": 0,
"name": "foo"
},
{
"elems": [
2,
3,
6,
7
],
"id": 1,
"name": "bar"
},
{
"elems": [
8,
9,
12,
13
],
"id": 2,
"name": "block2"
},
{
"elems": [
10,
11,
14,
15
],
"id": 3,
"name": "block3"
}
]
},
"time": 1.0,
"time_step": 1
}
]
}
86 changes: 86 additions & 0 deletions test/tests/meshgenerators/rename_block_generator/tests
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,90 @@
detail = 'and when the provided old and new blocks are not the same length.'
[]
[]

[deprecated]
requirement = 'The system shall be able to rename or renumber mesh blocks using old syntax by'

[id]
type = JSONDiff
input = 'rename_block.i'
cli_args = '--allow-warnings
Mesh/rename/old_block_id="0 1 3 2"
Mesh/rename/new_block_id="1 2 4 3"
Outputs/file_base=deprecated_id'
jsondiff = 'deprecated_id.json'

detail = 'identifying blocks by ID'
[]
[name]
type = JSONDiff
input = 'rename_block.i'
cli_args = '--allow-warnings
Mesh/rename/old_block_name="block0 block1"
Mesh/rename/new_block_name="foo bar"
Outputs/file_base=deprecated_name'
jsondiff = 'deprecated_name.json'

detail = 'identifying blocks by name'
[]
[]

[deprecated_errors]
requirement = 'The system shall report a reasonable error when renaming or renumbering blocks using deprecated syntax when'

[old_block_id_and_name]
type = RunException
input = 'rename_block.i'
cli_args = 'Mesh/rename/old_block_id=0
Mesh/rename/old_block_name=dummy'
expect_err = "old_block_id\):.*Cannot use in combination with 'old_block_name'. Please use 'old_block' instead; 'old_block_id' and 'old_block_name' are deprecated."

detail = 'both old block IDs and old block names are provided'
[]
[new_block_id_and_name]
type = RunException
input = 'rename_block.i'
cli_args = 'Mesh/rename/new_block_id=0
Mesh/rename/new_block_name=dummy'
expect_err = "new_block_id\):.*Cannot use in combination with 'new_block_name'. Please use 'new_block' instead; 'new_block_id' and 'new_block_name' are deprecated."

detail = 'both new block IDs and new block names are provided'
[]
[old_block_and_id]
type = RunException
input = 'rename_block.i'
cli_args = 'Mesh/rename/old_block=0
Mesh/rename/old_block_id=0'
expect_err = "old_block_id\):.*Cannot use with 'old_block'. Use only 'old_block'; 'old_block_id' is deprecated."

detail = 'the deprecated syntax for old block id and the new syntax for old block is used'
[]
[old_block_and_name]
type = RunException
input = 'rename_block.i'
cli_args = 'Mesh/rename/old_block=0
Mesh/rename/old_block_name=dummy'
expect_err = "old_block_name\):.*Cannot use with 'old_block'. Use only 'old_block'; 'old_block_name' is deprecated."

detail = 'the deprecated syntax for old block name and the new syntax for old block is used'
[]
[new_block_and_id]
type = RunException
input = 'rename_block.i'
cli_args = 'Mesh/rename/new_block=0
Mesh/rename/new_block_id=0'
expect_err = "new_block_id\):.*Cannot use with 'new_block'. Use only 'new_block'; 'new_block_id' is deprecated."

detail = 'the deprecated syntax for new block id and the new syntax for new block is used'
[]
[new_block_and_name]
type = RunException
input = 'rename_block.i'
cli_args = 'Mesh/rename/new_block=0
Mesh/rename/new_block_name=dummy'
expect_err = "new_block_name\):.*Cannot use with 'new_block'. Use only 'new_block'; 'new_block_name' is deprecated."

detail = 'the deprecated syntax for new block name and the new syntax for new block is used'
[]
[]
[]

0 comments on commit f6c102f

Please sign in to comment.