// should not happen
FAIL();
}
+
+// PluginData class
+
+TEST(CONTRIB_NNC, PluginData)
+{
+ // Constructor(name, value)
+ Data d("some name", "some value");
+ ASSERT_EQ(d.getName(), "some name");
+ ASSERT_EQ(d.getValue(), "some value");
+ ASSERT_EQ(d.hasValue(), true);
+
+ // Constructor(name)
+ Data d2("name1");
+ ASSERT_EQ(d2.getName(), "name1");
+ ASSERT_EQ(d2.hasValue(), false);
+ ASSERT_THROW(d2.getValue(), DataException);
+
+ // 'setValue' method
+ d2.setValue("value1");
+ ASSERT_EQ(d2.getValue(), "value1");
+ ASSERT_EQ(d2.hasValue(), true);
+ d2.setValue("value2");
+ ASSERT_EQ(d2.getValue(), "value2");
+}
+
+TEST(CONTRIB_NNC, PluginDataOperators)
+{
+ Data d("some name", "some value");
+
+ // Operator '=='
+ ASSERT_TRUE(d == "some value");
+ ASSERT_FALSE(d == "wrong value");
+
+ // Operator '<<'
+ std::ostringstream os1;
+ os1 << d;
+ ASSERT_EQ(os1.str(), "<some name> = some value");
+ std::ostringstream os2;
+ os2 << Data("name2");
+ ASSERT_EQ(os2.str(), "<name2>");
+}