Cheetah Software  1.0
test_yaml.cpp File Reference
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "ParamHandler.hpp"
#include "Utilities/utilities.h"
+ Include dependency graph for test_yaml.cpp:

Go to the source code of this file.

Functions

 TEST (YAML, yaml_category_read)
 

Function Documentation

TEST ( YAML  ,
yaml_category_read   
)

Definition at line 7 of file test_yaml.cpp.

References getConfigDirectoryPath().

7  {
8  ParamHandler paramHandler(getConfigDirectoryPath() + "test-yaml.yaml");
9  EXPECT_TRUE(paramHandler.fileOpenedSuccessfully());
10  double c1p1, c2p1;
11  std::vector<double> c1p2, c2p2;
12  EXPECT_TRUE(paramHandler.getValue("category-1", "parameter-1", c1p1));
13  EXPECT_TRUE(paramHandler.getValue("category-2", "parameter-1", c2p1));
14  EXPECT_TRUE(paramHandler.getVector("category-1", "parameter-2", c1p2));
15  EXPECT_TRUE(paramHandler.getVector("category-2", "parameter-2", c2p2));
16 
17  EXPECT_TRUE(c1p1 == 12.);
18  EXPECT_TRUE(c1p2[0] == 1.);
19  EXPECT_TRUE(c1p2[1] == 2.);
20  EXPECT_TRUE(c1p2[2] == 3.);
21  EXPECT_TRUE(c1p2.size() == 3);
22 
23  EXPECT_TRUE(c2p1 == 23.);
24  EXPECT_TRUE(c2p2[0] == 2.);
25  EXPECT_TRUE(c2p2[1] == 3.);
26  EXPECT_TRUE(c2p2.size() == 2);
27 
28  EXPECT_FALSE(paramHandler.getValue("notARealKey", c1p1));
29  ParamHandler badHandler("not-a-real-file.potato");
30  EXPECT_FALSE(badHandler.fileOpenedSuccessfully());
31 }
std::string getConfigDirectoryPath()
Definition: utilities.cpp:30

+ Here is the call graph for this function: