58 const string &testfile2password,
bool testfilesMod,
bool extendedHeaderMod,
bool withHMAC)
66 CPPUNIT_ASSERT_EQUAL_MESSAGE(context, !testfile1password.empty(), file.
isEncryptionUsed());
69 if (!testfile1password.empty()) {
77 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"testfile1"s, rootEntry->
label());
78 CPPUNIT_ASSERT_EQUAL_MESSAGE(context, 4_st, rootEntry->
children().size());
81 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"testaccount1"s, rootEntry->
children()[0]->label());
84 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"123456"s,
static_cast<AccountEntry *
>(rootEntry->
children()[0])->
fields().at(0).value());
92 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"testaccount2"s, rootEntry->
children()[1]->label());
97 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"testcategory1"s, rootEntry->
children()[2]->label());
100 CPPUNIT_ASSERT_EQUAL_MESSAGE(context, 3_st, category->
children().size());
105 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"testaccount3"s, rootEntry->
children()[3]->label());
109 }
else if (extendedHeaderMod) {
110 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"foo"s, file.
extendedHeader());
113 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
""s, file.
extendedHeader());
122 CPPUNIT_ASSERT_EQUAL_MESSAGE(context, !testfile2password.empty(), file.
isEncryptionUsed());
127 if (withHMAC && extendedHeaderMod) {
128 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
static_cast<std::uint32_t
>(6), file.
version());
130 }
else if (withHMAC) {
131 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
static_cast<std::uint32_t
>(4), file.
version());
133 }
else if (extendedHeaderMod) {
134 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
static_cast<std::uint32_t
>(6), file.
version());
137 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
static_cast<std::uint32_t
>(3), file.
version());
140 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"testfile2 - modified"s, rootEntry2->
label());
141 CPPUNIT_ASSERT_EQUAL_MESSAGE(context, 2_st, rootEntry2->
children().size());
142 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"newAccount"s, rootEntry2->
children()[1]->label());
144 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
static_cast<std::uint32_t
>(3), file.
version());
145 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"testfile2"s, rootEntry2->
label());
146 CPPUNIT_ASSERT_EQUAL_MESSAGE(context, 1_st, rootEntry2->
children().size());
148 if (extendedHeaderMod) {
149 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
"foo"s, file.
extendedHeader());
153 CPPUNIT_ASSERT_EQUAL_MESSAGE(context,
""s, file.
extendedHeader());
The exception that is thrown when a parsing error occurs.
const std::vector< Field > & fields() const
void setLabel(const std::string &label)
Sets the label.
const std::string & label() const
Returns the label.
The NodeEntry class acts as parent for other entries.
Entry * entryByPath(std::list< std::string > &path, bool includeThis=true, const EntryType *creationType=nullptr)
Returns an entry specified by the provided path.
const std::vector< Entry * > & children() const