belcard-communication-tester.cpp 1.81 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
	belcard-communication-tester.cpp
	Copyright (C) 2015  Belledonne Communications SARL

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

Sylvain Berfini's avatar
Sylvain Berfini committed
19
#include "belcard/belcard.hpp"
20
#include "belcard-tester.hpp"
Sylvain Berfini's avatar
Sylvain Berfini committed
21 22 23 24 25

using namespace::std;
using namespace::belcard;

static void tel_property(void) {
Sylvain Berfini's avatar
Sylvain Berfini committed
26 27 28
	test_property<BelCardPhoneNumber>("TEL;VALUE=uri;TYPE=work:tel:+33-9-52-63-65-05\r\n");
	test_property<BelCardPhoneNumber>("TEL;VALUE=uri;TYPE=\"voice,work\":tel:+33952636505\r\n");
	test_property<BelCardPhoneNumber>("TEL;VALUE=text;TYPE=work:+33 9 52 63 65 05\r\n");
29 30 31
}

static void email_property(void) {
32
	test_property<BelCardEmail>("EMAIL;TYPE=work:sylvain.berfini@belledonne-communications.com\r\n");
33 34 35
}

static void impp_property(void) {
36
	test_property<BelCardImpp>("IMPP;TYPE=work:sip:sylvain@sip.linphone.org\r\n");
37 38 39
}

static void lang_property(void) {
40 41
	test_property<BelCardLang>("LANG;TYPE=home:fr\r\n");
	test_property<BelCardLang>("LANG:fr-FR\r\n");
Sylvain Berfini's avatar
Sylvain Berfini committed
42 43 44
}

static test_t tests[] = {
45 46 47 48
	TEST_NO_TAG("Tel", tel_property),
	TEST_NO_TAG("Email", email_property),
	TEST_NO_TAG("IMPP", impp_property),
	TEST_NO_TAG("Language", lang_property),
Sylvain Berfini's avatar
Sylvain Berfini committed
49 50 51 52 53 54 55 56 57 58
};

test_suite_t vcard_communication_properties_test_suite = {
	"Communication",
	NULL,
	NULL,
	NULL,
	NULL,
	sizeof(tests) / sizeof(tests[0]),
	tests
59
};