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

Implements class CLASS? More...

Include dependency graph for taginfo.test.cpp:

Go to the source code of this file.

Classes

class  TagInfoTest
 Tests of TagInfo class. More...
 

Functions

 TEST_F (TagInfoTest, defaultTag)
 Testing default tag intended for storing unlimited amount of items of any type. More...
 
 TEST_F (TagInfoTest, equalityOperator)
 Testing equality operators. More...
 
 TEST_F (TagInfoTest, initialState)
 
 TEST_F (TagInfoTest, propertyTag)
 Testing property tag intended for storing single PropertyItem. 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 taginfo.test.cpp.

Function Documentation

◆ TEST_F() [1/4]

TEST_F ( TagInfoTest  ,
defaultTag   
)

Testing default tag intended for storing unlimited amount of items of any type.

Definition at line 42 of file taginfo.test.cpp.

43 {
44  // initial state
45  TagInfo tag = TagInfo::universalTag("name");
46  EXPECT_EQ(tag.name(), std::string("name"));
47  EXPECT_EQ(tag.min(), 0);
48  EXPECT_EQ(tag.max(), -1);
49  EXPECT_FALSE(tag.isSinglePropertyTag());
50  EXPECT_TRUE(tag.isValidChild(""));
51  EXPECT_TRUE(tag.isValidChild("abc"));
52 }
Holds info about single tag for SessionItem.
Definition: taginfo.h:28
std::string name() const
Definition: taginfo.cpp:45
int max() const
Definition: taginfo.cpp:55
bool isValidChild(const std::string &modelType) const
Returns true if given modelType matches the list of possible model types.
Definition: taginfo.cpp:67
int min() const
Definition: taginfo.cpp:50
bool isSinglePropertyTag() const
Returns true if this tag is used to store single properties.
Definition: taginfo.cpp:75

References ModelView::TagInfo::isSinglePropertyTag(), ModelView::TagInfo::isValidChild(), ModelView::TagInfo::max(), ModelView::TagInfo::min(), ModelView::TagInfo::name(), and ModelView::TagInfo::universalTag().

Here is the call graph for this function:

◆ TEST_F() [2/4]

TEST_F ( TagInfoTest  ,
equalityOperator   
)

Testing equality operators.

Definition at line 71 of file taginfo.test.cpp.

72 {
73  // default constructor
74  TagInfo tag1, tag2;
75  EXPECT_TRUE(tag1 == tag2);
76  EXPECT_FALSE(tag1 != tag2);
77 
78  // same property tag
79  TagInfo tag3 = TagInfo::propertyTag("name", "model_type");
80  TagInfo tag4 = TagInfo::propertyTag("name", "model_type");
81  EXPECT_TRUE(tag3 == tag4);
82  EXPECT_FALSE(tag3 != tag4);
83 
84  // same universal tag
85  TagInfo tag5 = TagInfo::universalTag("name");
86  TagInfo tag6 = TagInfo::universalTag("name");
87  EXPECT_TRUE(tag5 == tag6);
88  EXPECT_FALSE(tag5 != tag6);
89 
90  // different tag
91  TagInfo tag7("tag7", 0, 1, std::vector<std::string>());
92  TagInfo tag8("tag8", 0, 1, std::vector<std::string>());
93  EXPECT_FALSE(tag7 == tag8);
94  EXPECT_TRUE(tag7 != tag8);
95 }

References ModelView::TagInfo::propertyTag(), and ModelView::TagInfo::universalTag().

Here is the call graph for this function:

◆ TEST_F() [3/4]

TEST_F ( TagInfoTest  ,
initialState   
)

Definition at line 29 of file taginfo.test.cpp.

30 {
31  TagInfo tag;
32  EXPECT_EQ(tag.name(), std::string());
33  EXPECT_EQ(tag.min(), 0);
34  EXPECT_EQ(tag.max(), -1);
35  EXPECT_FALSE(tag.isSinglePropertyTag());
36  EXPECT_TRUE(tag.isValidChild(""));
37  EXPECT_TRUE(tag.isValidChild("abc"));
38 }

References ModelView::TagInfo::isSinglePropertyTag(), ModelView::TagInfo::isValidChild(), ModelView::TagInfo::max(), ModelView::TagInfo::min(), and ModelView::TagInfo::name().

Here is the call graph for this function:

◆ TEST_F() [4/4]

TEST_F ( TagInfoTest  ,
propertyTag   
)

Testing property tag intended for storing single PropertyItem.

Definition at line 56 of file taginfo.test.cpp.

57 {
58  // initial state
59  TagInfo tag = TagInfo::propertyTag("name", "model_type");
60 
61  EXPECT_EQ(tag.name(), std::string("name"));
62  EXPECT_EQ(tag.min(), 1);
63  EXPECT_EQ(tag.max(), 1);
64  EXPECT_TRUE(tag.isSinglePropertyTag());
65  EXPECT_TRUE(tag.isValidChild("model_type"));
66  EXPECT_FALSE(tag.isValidChild("abc"));
67 }

References ModelView::TagInfo::isSinglePropertyTag(), ModelView::TagInfo::isValidChild(), ModelView::TagInfo::max(), ModelView::TagInfo::min(), ModelView::TagInfo::name(), and ModelView::TagInfo::propertyTag().

Here is the call graph for this function: