1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#include <gtest/gtest.h>
#include <Comment.h>
using namespace XdgUtils::DesktopEntry::AST;
TEST(TestComment, create) {
Comment comment1("# Test", " Test");
ASSERT_EQ(" Test", comment1.getValue());
}
TEST(TestComment, setValue) {
Comment comment1("# Test", " Test");
comment1.setValue(" More Tests!");
ASSERT_EQ(" More Tests!", comment1.getValue());
std::stringstream out;
comment1.write(out);
ASSERT_EQ("# More Tests!", out.str());
}
TEST(TestComment, setValueToEmpty) {
Comment comment1("", "");
comment1.setValue(" More Tests!");
ASSERT_EQ(" More Tests!", comment1.getValue());
std::stringstream out;
comment1.write(out);
ASSERT_EQ("# More Tests!", out.str());
}
TEST(TestComment, compare) {
ASSERT_EQ(Comment("", ""), Comment("", ""));
ASSERT_EQ(Comment("# ", " Random Rocker"), Comment("# ", " Random Rocker"));
ASSERT_EQ(Comment("# ", " Random Rocker"), Comment("#", " Random Rocker"));
ASSERT_NE(Comment("# ", " Random Blocker"), Comment("#", " Random Rocker"));
ASSERT_NE(Comment("", ""), Comment("#", " Random Rocker"));
}
|