Tests for Bib-Elements
- Test:
- BibElement Fixture Tests
#include <gtest/gtest.h>
using namespace std::literals::string_literals;
: props{"style"s, {"reqField"s, "reqField2"s}, {"optField"s}},
completeElement{"id"s,
"style"s,
{
{"reqField"s, "a value"s},
{"reqField2"s, "a value"s},
{"optField"s, "a value"s}
}},
incompleteElement{"id"s,
"style"s,
{
{"reqField2"s, "value"s}
}} {}
};
ASSERT_TRUE(completeElement.isCompliantTo(props));
}
ASSERT_FALSE(incompleteElement.isCompliantTo(props));
}
TEST(BibelementTests, constructionTest) {
std::vector<Field> fields = {
Field{
"name"s,
"value"s},
Field{
"another name"s,
"another value"s}
};
ASSERT_NO_THROW(([&](){
const auto a =
BibElement{
"an id"s,
"a style"s, fields};
}()));
ASSERT_NO_THROW(([&](){
const auto a =
BibElement{
"another id"s,
"another style"s, fields};
}()));
}