Skip to content

Commit 7661e98

Browse files
committed
add test for catching possible error
1 parent 9dc98a3 commit 7661e98

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

plugins/decl_netcdf/tests/decl_netcdf_tests.cxx

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ TEST(decl_netcdf_test, 06)
680680
" \n"
681681
"plugins: \n"
682682
" decl_netcdf: \n"
683-
" - file: 'test_07.nc' \n"
683+
" - file: 'test_06.nc' \n"
684684
" on_event: 'write' \n"
685685
" variables: \n"
686686
" int_matrix_var: \n"
@@ -694,7 +694,7 @@ TEST(decl_netcdf_test, 06)
694694
" variable_selection: \n"
695695
" start: ['$iter', 0, 0] \n"
696696
" subsize: [1, 8, 8] \n"
697-
" - file: 'test_07.nc' \n"
697+
" - file: 'test_06.nc' \n"
698698
" on_event: 'read' \n"
699699
" variables: \n"
700700
" int_matrix_var: \n"
@@ -739,6 +739,45 @@ TEST(decl_netcdf_test, 06)
739739
PDI_finalize();
740740
}
741741

742+
/*
743+
* Name: decl_netcdf_test.07
744+
*
745+
* Description: Tests yaml syntaxe with `write: data`
746+
*/
747+
TEST(decl_netcdf_test, 07)
748+
{
749+
const char* CONFIG_YAML
750+
= "logging: trace \n"
751+
"data: \n"
752+
" int_matrix: \n"
753+
" type: array \n"
754+
" subtype: int \n"
755+
" size: [8, 8] \n"
756+
" \n"
757+
"plugins: \n"
758+
" decl_netcdf: \n"
759+
" - file: 'test_07.nc' \n"
760+
" on_event: 'write' \n"
761+
" write: int_matrix \n";
762+
763+
PDI_init(PC_parse_string(CONFIG_YAML));
764+
765+
int int_matrix[8][8];
766+
767+
// init data
768+
for (int i = 0; i < 8; i++) {
769+
for (int j = 0; j < 8; j++) {
770+
int_matrix[i][j] = 100 + i * 8 + j;
771+
}
772+
}
773+
774+
// write data
775+
PDI_multi_expose("write", "int_matrix", int_matrix, PDI_OUT, NULL);
776+
777+
778+
PDI_finalize();
779+
}
780+
742781
/*
743782
* Name: decl_netcdf_test.size_of
744783
*

0 commit comments

Comments
 (0)