Commit a9d91af6 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Revert "Applied back Iyed changes for tester"

This reverts commit 88bed954.
parent ce8a6e57
......@@ -41,7 +41,6 @@ namespace belcard {
public:
BELCARD_PUBLIC static std::shared_ptr<BelCardParser> getInstance();
BELCARD_PUBLIC BelCardParser();
BELCARD_PUBLIC BelCardParser(std::string fileName);
BELCARD_PUBLIC ~BelCardParser();
BELCARD_PUBLIC std::shared_ptr<BelCard> parseOne(const std::string &input);
......
......@@ -93,64 +93,6 @@ BelCardParser::BelCardParser() {
BelCardDeathDate::setHandlerAndCollectors(_parser);
}
BelCardParser::BelCardParser(std::string fileName) {
shared_ptr<Grammar> grammar = Grammar::loadVectRulesMap(fileName);
_parser = new Parser<shared_ptr<BelCardGeneric>>(grammar);
BelCardList::setHandlerAndCollectors(_parser);
BelCard::setHandlerAndCollectors(_parser);
BelCardParam::setAllParamsHandlersAndCollectors(_parser);
BelCardProperty::setHandlerAndCollectors(_parser);
BelCardSource::setHandlerAndCollectors(_parser);
BelCardKind::setHandlerAndCollectors(_parser);
BelCardXML::setHandlerAndCollectors(_parser);
BelCardFullName::setHandlerAndCollectors(_parser);
BelCardName::setHandlerAndCollectors(_parser);
BelCardNickname::setHandlerAndCollectors(_parser);
BelCardPhoto::setHandlerAndCollectors(_parser);
BelCardBirthday::setHandlerAndCollectors(_parser);
BelCardAnniversary::setHandlerAndCollectors(_parser);
BelCardGender::setHandlerAndCollectors(_parser);
BelCardAddress::setHandlerAndCollectors(_parser);
BelCardPhoneNumber::setHandlerAndCollectors(_parser);
BelCardEmail::setHandlerAndCollectors(_parser);
BelCardImpp::setHandlerAndCollectors(_parser);
BelCardLang::setHandlerAndCollectors(_parser);
BelCardTimezone::setHandlerAndCollectors(_parser);
BelCardGeo::setHandlerAndCollectors(_parser);
BelCardTitle::setHandlerAndCollectors(_parser);
BelCardRole::setHandlerAndCollectors(_parser);
BelCardLogo::setHandlerAndCollectors(_parser);
BelCardOrganization::setHandlerAndCollectors(_parser);
BelCardMember::setHandlerAndCollectors(_parser);
BelCardRelated::setHandlerAndCollectors(_parser);
BelCardCategories::setHandlerAndCollectors(_parser);
BelCardNote::setHandlerAndCollectors(_parser);
BelCardProductId::setHandlerAndCollectors(_parser);
BelCardRevision::setHandlerAndCollectors(_parser);
BelCardSound::setHandlerAndCollectors(_parser);
BelCardUniqueId::setHandlerAndCollectors(_parser);
BelCardClientProductIdMap::setHandlerAndCollectors(_parser);
BelCardURL::setHandlerAndCollectors(_parser);
BelCardKey::setHandlerAndCollectors(_parser);
BelCardFBURL::setHandlerAndCollectors(_parser);
BelCardCALADRURI::setHandlerAndCollectors(_parser);
BelCardCALURI::setHandlerAndCollectors(_parser);
BelCardBirthPlace::setHandlerAndCollectors(_parser);
BelCardDeathPlace::setHandlerAndCollectors(_parser);
BelCardDeathDate::setHandlerAndCollectors(_parser);
}
BelCardParser::~BelCardParser() {
delete _parser;
}
......
......@@ -137,51 +137,6 @@ static void property_sort_using_pref_param(void) {
BC_ASSERT_EQUAL((unsigned int)belCard->getProperties().size(), 1, unsigned int, "%u");
}
static void vcard_grammar_from_binary_dump(void) {
string grammarDumpFileName = bc_tester_file("vcardGrammarDump.bin");
remove(grammarDumpFileName.c_str());
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
grammar->createGrammarDump(grammarDumpFileName);
shared_ptr<Grammar> grammar2 = Grammar::loadVectRulesMap(grammarDumpFileName);
BC_ASSERT_TRUE(grammar->equal(grammar2));
}
static void vcard_parsing_serialized(void) {
string vcard = openFile("vcards/vcard.vcf");
string grammarDumpFileName = bc_tester_file("vcardGrammarDump.bin");
remove(grammarDumpFileName.c_str());
belr::ABNFGrammarBuilder grammar_builder;
shared_ptr<belr::Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<belr::CoreRules>());
grammar->createGrammarDump(grammarDumpFileName);
BelCardParser *parser = new BelCardParser(grammarDumpFileName);
shared_ptr<BelCard> belCard = parser->parseOne(vcard);
if (!BC_ASSERT_TRUE(belCard!=NULL)) return;
BC_ASSERT_TRUE(belCard->assertRFCCompliance());
string vcard2 = belCard->toFoldedString();
BC_ASSERT_EQUAL(vcard2.compare(vcard), 0, int, "%d");
delete(parser);
}
static void vcards_parsing_serialized(void) {
string vcards = openFile("vcards/vcards.vcf");
string grammarDumpFileName = bc_tester_file("vcardGrammarDump.bin");
BelCardParser *parser = new BelCardParser(grammarDumpFileName);
shared_ptr<BelCardList> belCards = parser->parse(vcards);
if (!BC_ASSERT_TRUE(belCards!=NULL)) return;
BC_ASSERT_EQUAL((unsigned int)belCards->getCards().size(), 2, unsigned int, "%u");
string vcards2 = belCards->toString();
BC_ASSERT_EQUAL(vcards2.compare(vcards), 0, int, "%d");
delete(parser);
}
static test_t tests[] = {
TEST_NO_TAG("Folding", folding),
TEST_NO_TAG("Unfolding", unfolding),
......@@ -189,9 +144,6 @@ static test_t tests[] = {
TEST_NO_TAG("VCards parsing", vcards_parsing),
TEST_NO_TAG("VCard created from scratch", create_vcard_from_api),
TEST_NO_TAG("Property sort using pref param", property_sort_using_pref_param),
TEST_NO_TAG("VCard grammar from binary dump", vcard_grammar_from_binary_dump),
TEST_NO_TAG("VCard parsing serialized", vcard_parsing_serialized),
TEST_NO_TAG("VCards parsing serialized", vcards_parsing_serialized),
};
test_suite_t vcard_test_suite = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment