btool
A parser/converter/transpiler for .bib files
BibElementFixtureTest.cpp
Go to the documentation of this file.
1 #include <gtest/gtest.h>
2 #include <BibElement.hpp>
3 #include <StyleProperties.hpp>
4 
5 using namespace std::literals::string_literals;
6 
12 struct BibElementFixtureTest : public ::testing::Test {
16 
18  : props{"style"s, {"reqField"s, "reqField2"s}, {"optField"s}},
19  completeElement{"id"s,
20  "style"s,
21  {
22  {"reqField"s, "a value"s},
23  {"reqField2"s, "a value"s},
24  {"optField"s, "a value"s}
25  }},
26  incompleteElement{"id"s,
27  "style"s,
28  {
29  {"reqField2"s, "value"s}
30  }} {}
31 
32 };
33 
34 TEST_F(BibElementFixtureTest, completeElementTest) {
35  ASSERT_TRUE(completeElement.isCompliantTo(props));
36 }
37 
38 TEST_F(BibElementFixtureTest, incompleteElementTest) {
39  ASSERT_FALSE(incompleteElement.isCompliantTo(props));
40 }
41 
42 TEST(BibelementTests, constructionTest) {
43  std::vector<Field> fields = {
44  Field{"name"s, "value"s},
45  Field{"another name"s, "another value"s}
46  };
47  ASSERT_NO_THROW(([&](){
48  const auto a = BibElement{"an id"s, "a style"s, fields};
49  }()));
50  ASSERT_NO_THROW(([&](){
51  const auto a = BibElement{"another id"s, "another style"s, fields};
52  }()));
53 }
StyleProperties
style-properties-container
Definition: StyleProperties.hpp:11
Field
Field-Container.
Definition: Field.hpp:11
BibElementFixtureTest::incompleteElement
const BibElement incompleteElement
Definition: BibElementFixtureTest.cpp:15
BibElementFixtureTest::completeElement
const BibElement completeElement
Definition: BibElementFixtureTest.cpp:14
BibElementFixtureTest
Definition: BibElementFixtureTest.cpp:12
BibElementFixtureTest::props
const StyleProperties props
Definition: BibElementFixtureTest.cpp:13
BibElementFixtureTest::BibElementFixtureTest
BibElementFixtureTest()
Definition: BibElementFixtureTest.cpp:17
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