1 #include <gtest/gtest.h>
4 #include <spdlog/spdlog.h>
8 using namespace std::literals::string_literals;
9 using namespace std::literals::string_view_literals;
60 })"}, {"article"}} {};
64 ASSERT_EQ(sample.generate(
""sv,
"year"s,
"someFile.bib"s), std::vector<BibElement>());
68 auto const input = R
"(@article{FeigenspanSiFr11,
69 author = {Janet Feigenspan and Norbert Siegmund and Jana Fruth},
70 title = {{On the Role of Program Comprehension in Embedded Systems}},
71 journal = {Softwaretechnik-Trends},
76 url = {http://www.uni-koblenz-landau.de/koblenz/fb4/institute/uebergreifend/sre/conferences/wsr/wsr2011/wsr2011_proceedings.pdf}
79 const std::vector<BibElement> expected{
84 {
"author",
"Janet Feigenspan and Norbert Siegmund and Jana Fruth"},
85 {
"title",
"On the Role of Program Comprehension in Embedded Systems"},
86 {
"journal",
"Softwaretechnik-Trends"},
92 "http://www.uni-koblenz-landau.de/koblenz/fb4/institute/uebergreifend/sre/conferences/wsr/wsr2011/wsr2011_proceedings.pdf"
97 auto const actual = sample.generate(input,
"year"s,
"someFile.bib"s);
98 ASSERT_EQ(actual, expected);
102 auto const input = R
"(@article{FeigenspanSiFr11,
103 author = {Janet Feigenspan and Norbert Siegmund and Jana Fruth},
104 journal = {Softwaretechnik-Trends},
109 url = {http://www.uni-koblenz-landau.de/koblenz/fb4/institute/uebergreifend/sre/conferences/wsr/wsr2011/wsr2011_proceedings.pdf}
112 auto const actual = sample.generate(input,
"year"s,
"someFile.bib"s);
113 ASSERT_EQ(actual, std::vector<BibElement>{});
117 boost::filesystem::path target = boost::filesystem::path(
"../../test/res/publications.bib");
118 ASSERT_NO_THROW([&]() {
119 const auto elements = sample.generate(std::vector<boost::filesystem::path>{target}, std::nullopt);
120 ASSERT_EQ(elements.size(), 1u);
125 boost::filesystem::path target = boost::filesystem::path(
"../../test/res");
126 ASSERT_NO_THROW(([&]() {
127 const auto elements =
Parser{std::optional<boost::filesystem::path>(std::nullopt), {},
true}.
generate(std::vector<
128 boost::filesystem::path>{target}, std::nullopt);
129 ASSERT_EQ(elements.size(), 62u);
134 boost::filesystem::path target = boost::filesystem::path(
"../../test/res/someFileThatDoesNotExist.something");
136 const auto elements = sample.generate(std::vector<boost::filesystem::path>{target}, std::nullopt);
141 const auto file = R
"(
142 @article{Feigenspan11,
143 author = {Janet Feigenspan},
144 title = {{Program Comprehension of Feature-Oriented Software Development}},
145 booktitle = {International Doctoral Symposium on Empirical Software Engineering (IDoESE)},
148 url = {http://wwwiti.cs.uni-magdeburg.de/iti_db/publikationen/ps/auto/Feigenspan11.pdf}
150 @article{FeigenspanSiFr11,
151 author = {Janet Feigenspan and Norbert Siegmund and Jana Fruth},
152 title = {{On the Role of Program Comprehension in Embedded Systems}},
153 journal = {Softwaretechnik-Trends},
158 url = {http://www.uni-koblenz-landau.de/koblenz/fb4/institute/uebergreifend/sre/conferences/wsr/wsr2011/wsr2011_proceedings.pdf}
161 std::vector<BibElement> expected{
162 {"FeigenspanSiFr11",
"article", {
163 {
"author",
"Janet Feigenspan and Norbert Siegmund and Jana Fruth"},
164 {
"title",
"On the Role of Program Comprehension in Embedded Systems"},
165 {
"journal",
"Softwaretechnik-Trends"},
171 "http://www.uni-koblenz-landau.de/koblenz/fb4/institute/uebergreifend/sre/conferences/wsr/wsr2011/wsr2011_proceedings.pdf"}
173 {
"Feigenspan11",
"article", {
174 {
"author",
"Janet Feigenspan"},
175 {
"title",
"Program Comprehension of Feature-Oriented Software Development"},
176 {
"booktitle",
"International Doctoral Symposium on Empirical Software Engineering (IDoESE)"},
179 {
"url",
"http://wwwiti.cs.uni-magdeburg.de/iti_db/publikationen/ps/auto/Feigenspan11.pdf"}
182 ASSERT_EQ(sample.generate(file,
"title",
"testfile.bib"), expected);