Skip to content

Commit

Permalink
extend the unit tests for FieldSet
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrdar committed Sep 7, 2023
1 parent 9a03a35 commit 7ee251a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/tests/field/fctest_field.F90
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ module fcta_Field_fixture
TEST( test_fieldset )
implicit none

type(atlas_FieldSet) :: fieldset
type(atlas_Field) :: field
type(atlas_FieldSet) :: fieldset, fieldset_2
type(atlas_Field) :: field, field_2

write(*,*) "test_fieldset starting"

Expand All @@ -163,6 +163,15 @@ module fcta_Field_fixture
FCTEST_CHECK_EQUAL( field%name(), "field_1" )
field = fieldset%field(3)
FCTEST_CHECK_EQUAL( field%name(), "field_2" )

fieldset_2 = atlas_FieldSet()
call fieldset_2%add(fieldset)
field_2 = fieldset_2%field("field_0")
call field_2%rename("field_00")
FCTEST_CHECK(fieldset%has("field_00"))
field = fieldset%field("field_00")
FCTEST_CHECK_EQUAL(field%name(), "field_00")

call fieldset%final()
write(0,*) "test_fieldset end"

Expand Down
4 changes: 3 additions & 1 deletion src/tests/field/test_fieldset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ CASE("test_fieldset_concatenation") {
auto field_2_v = array::make_view<double,2>(field_2);
field_2_v(1,1) = 1.;

EXPECT_EQ( field_1_v(1,1), 1.);
EXPECT(!fieldset_2.has(""));
EXPECT_EQ(fieldset_2.field(0).name(), "");
EXPECT_EQ(field_1_v(1,1), 1.);
}

//-----------------------------------------------------------------------------
Expand Down

0 comments on commit 7ee251a

Please sign in to comment.