btool
A parser/converter/transpiler for .bib files
/github/workspace/test/BibElementFixtureTest.cpp

Tests for Bib-Elements

Test:
BibElement Fixture Tests
#include <gtest/gtest.h>
#include <BibElement.hpp>
using namespace std::literals::string_literals;
struct BibElementFixtureTest : public ::testing::Test {
const StyleProperties props;
const BibElement completeElement;
const BibElement incompleteElement;
: 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}
}} {}
};
TEST_F(BibElementFixtureTest, completeElementTest) {
ASSERT_TRUE(completeElement.isCompliantTo(props));
}
TEST_F(BibElementFixtureTest, incompleteElementTest) {
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};
}()));
}
StyleProperties
style-properties-container
Definition: StyleProperties.hpp:11
Field
Field-Container.
Definition: Field.hpp:11
BibElementFixtureTest
Definition: BibElementFixtureTest.cpp:12
TEST
TEST(BibelementTests, constructionTest)
Definition: BibElementFixtureTest.cpp:42
TEST_F
TEST_F(BibElementFixtureTest, completeElementTest)
Definition: BibElementFixtureTest.cpp:34
StyleProperties.hpp
BibElement.hpp
BibElement
bib-element-Container
Definition: BibElement.hpp:14