BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
compatibilityutils.test.cpp File Reference

Implements class CLASS? More...

Include dependency graph for compatibilityutils.test.cpp:

Go to the source code of this file.

Classes

class  CompatibilityUtilsTest
 Test of CompatibilityUtilsTest. More...
 

Functions

 TEST_F (CompatibilityUtilsTest, IsCompatibleGroupTag)
 Testing IsCompatibleSingleProperty. More...
 
 TEST_F (CompatibilityUtilsTest, IsCompatibleSinglePropertyTag)
 Testing IsCompatibleSingleProperty. More...
 
 TEST_F (CompatibilityUtilsTest, IsCompatibleUniversalTag)
 Testing IsCompatibleSingleProperty. More...
 

Detailed Description

Implements class CLASS?

Homepage:\n http://www.bornagainproject.org
License:\n GNU General Public License v3 or higher (see COPYING)
Authors
Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)

Definition in file compatibilityutils.test.cpp.

Function Documentation

◆ TEST_F() [1/3]

TEST_F ( CompatibilityUtilsTest  ,
IsCompatibleGroupTag   
)

Testing IsCompatibleSingleProperty.

Definition at line 64 of file compatibilityutils.test.cpp.

65 {
66  TagInfo tag = TagInfo::universalTag(GroupItem::T_GROUP_ITEMS);
67  SessionItemContainer container(tag);
68 
69  // to be compatible, container should be non-empty
70  EXPECT_FALSE(Compatibility::IsCompatibleGroupTag(container, tag));
71 
72  EXPECT_TRUE(container.insertItem(new PropertyItem, 0));
73  EXPECT_TRUE(Compatibility::IsCompatibleGroupTag(container, tag));
74 }
Item to carry concrete editable entity (e.g.
Definition: propertyitem.h:27
Holds collection of SessionItem objects related to the same tag.
Holds info about single tag for SessionItem.
Definition: taginfo.h:28
bool IsCompatibleGroupTag(const SessionItemContainer &container, const TagInfo &taginfo)

References ModelView::SessionItemContainer::insertItem(), ModelView::Compatibility::IsCompatibleGroupTag(), ModelView::GroupItem::T_GROUP_ITEMS, and ModelView::TagInfo::universalTag().

Here is the call graph for this function:

◆ TEST_F() [2/3]

TEST_F ( CompatibilityUtilsTest  ,
IsCompatibleSinglePropertyTag   
)

Testing IsCompatibleSingleProperty.

Definition at line 36 of file compatibilityutils.test.cpp.

37 {
38  TagInfo tag = TagInfo::propertyTag("thickness", Constants::PropertyType);
39  SessionItemContainer container(tag);
40 
41  // to be compatible, container should have PropertyItem in it already
42  EXPECT_FALSE(Compatibility::IsCompatibleSinglePropertyTag(container, tag));
43 
44  EXPECT_TRUE(container.insertItem(new PropertyItem, 0));
45  EXPECT_TRUE(Compatibility::IsCompatibleSinglePropertyTag(container, tag));
46 }
bool IsCompatibleSinglePropertyTag(const SessionItemContainer &container, const TagInfo &taginfo)
const model_type PropertyType
Definition: mvvm_types.h:59

References ModelView::SessionItemContainer::insertItem(), ModelView::Compatibility::IsCompatibleSinglePropertyTag(), ModelView::TagInfo::propertyTag(), and ModelView::Constants::PropertyType.

Here is the call graph for this function:

◆ TEST_F() [3/3]

TEST_F ( CompatibilityUtilsTest  ,
IsCompatibleUniversalTag   
)

Testing IsCompatibleSingleProperty.

Definition at line 50 of file compatibilityutils.test.cpp.

51 {
52  TagInfo tag = TagInfo::universalTag("layers");
53  SessionItemContainer container(tag);
54 
55  // to be compatible, container should be empty
56  EXPECT_TRUE(Compatibility::IsCompatibleUniversalTag(container, tag));
57 
58  EXPECT_TRUE(container.insertItem(new PropertyItem, 0));
59  EXPECT_FALSE(Compatibility::IsCompatibleUniversalTag(container, tag));
60 }
bool IsCompatibleUniversalTag(const SessionItemContainer &container, const TagInfo &taginfo)

References ModelView::SessionItemContainer::insertItem(), ModelView::Compatibility::IsCompatibleUniversalTag(), and ModelView::TagInfo::universalTag().

Here is the call graph for this function: