1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2018, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  * Seven Du <seven@signalwire.com>
26  *
27  *
28  * switch_utils.c -- tests switch_utils
29  *
30  */
31 
32 #include <stdio.h>
33 #include <switch.h>
34 #include <test/switch_test.h>
35 
36 FST_MINCORE_BEGIN("./conf")
37 
FST_SUITE_BEGIN(switch_hash)38 FST_SUITE_BEGIN(switch_hash)
39 
40 FST_SETUP_BEGIN()
41 {
42 }
43 FST_SETUP_END()
44 
FST_TEARDOWN_BEGIN()45 FST_TEARDOWN_BEGIN()
46 {
47 }
48 FST_TEARDOWN_END()
49 
FST_TEST_BEGIN(benchmark)50 FST_TEST_BEGIN(benchmark)
51 {
52     char encoded[1024];
53     char *s = "ABCD";
54 
55     switch_url_encode(s, encoded, sizeof(encoded));
56     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "encoded: [%s]\n", encoded);
57     fst_check_string_equals(encoded, "ABCD");
58 
59     s = "&bryän#!杜金房";
60     switch_url_encode(s, encoded, sizeof(encoded));
61     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "encoded: [%s]\n", encoded);
62     fst_check_string_equals(encoded, "%26bry%C3%A4n%23!%E6%9D%9C%E9%87%91%E6%88%BF");
63 }
64 FST_TEST_END()
65 
66 FST_SUITE_END()
67 
68 FST_MINCORE_END()
69 
70 /* For Emacs:
71  * Local Variables:
72  * mode:c
73  * indent-tabs-mode:t
74  * tab-width:4
75  * c-basic-offset:4
76  * End:
77  * For VIM:
78  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
79  */
80