MachineIntelligenceCore:Toolchain
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PropertyTests.cpp
Go to the documentation of this file.
1 
22 #include <gtest/gtest.h>
23 
24 #include <fstream>
25 
26 // Redefine word "public" so every class field/method will be accessible for tests.
27 #define private public
29 
33 TEST(Property, OperatorAssignString) {
34 
35  mic::configuration::Property<std::string> prop("string_property","empty_string");
36  //std::cout<<"Setting value with operator=!\n";
37  prop = "string";
38  // std::cout<<"Getting value with ()\n";
39  std::string s1 = prop;
40  std::string s2 = "string";
41 
42  ASSERT_EQ(s1.size(), s2.size()) << "Strings s1 and s2 are of unequal length";
43 
44  for (size_t i = 0; i < s1.size(); ++i)
45  EXPECT_EQ(s1[i], s2[i]) << "Strings s1 and s2 differ at index " << i;
46 }
47 
51 TEST(Property, OperatorAssignInt) {
52 
53  mic::configuration::Property<int> prop("int_property",0);
54  //std::cout<<"Setting value with operator=!\n";
55  prop = 10;
56  // std::cout<<"Getting value with ()\n";
57  ASSERT_EQ(prop, 10) << "Property value not equal to value set(10)";
58 
59 }
60 
61 
65 TEST(Property, OperatorAssignDouble) {
66 
67  mic::configuration::Property<double> prop("double_property",0);
68  //std::cout<<"Setting value with operator=!\n";
69  prop = 3.14;
70  // std::cout<<"Getting value with ()\n";
71  ASSERT_EQ(prop, 3.14) << "Property value not equal to value set(3.14)";
72 
73 }
74 
75 
76 int main(int argc, char **argv) {
77  testing::InitGoogleTest(&argc, argv);
78  return RUN_ALL_TESTS();
79 }
80 
81 
Template class for storing properties.
Definition: Property.hpp:133
int main(int argc, char **argv)
TEST(Property, OperatorAssignString)
Contains declaration of the Property class.