[asterisk-commits] twilson: branch group/srtp_reboot r250239 - in /team/group/srtp_reboot: ./ co...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 2 18:07:26 CST 2010
Author: twilson
Date: Tue Mar 2 18:07:23 2010
New Revision: 250239
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=250239
Log:
Merged revisions 250213,250235,250237 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r250213 | mnicholson | 2010-03-02 17:22:11 -0600 (Tue, 02 Mar 2010) | 2 lines
Merge missed files from res_fax/res_fax_spandsp merge.
........
r250235 | dvossel | 2010-03-02 17:38:29 -0600 (Tue, 02 Mar 2010) | 2 lines
base64 unit test
........
r250237 | dvossel | 2010-03-02 18:04:28 -0600 (Tue, 02 Mar 2010) | 2 lines
fixes assumption that test failed if it did not pass when generating results
........
Added:
team/group/srtp_reboot/configs/res_fax.conf.sample
- copied unchanged from r250237, trunk/configs/res_fax.conf.sample
team/group/srtp_reboot/include/asterisk/res_fax.h
- copied unchanged from r250237, trunk/include/asterisk/res_fax.h
Modified:
team/group/srtp_reboot/ (props changed)
team/group/srtp_reboot/main/test.c
team/group/srtp_reboot/tests/test_utils.c
Propchange: team/group/srtp_reboot/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Mar 2 18:07:23 2010
@@ -1,1 +1,1 @@
-/trunk:1-250199
+/trunk:1-250238
Modified: team/group/srtp_reboot/main/test.c
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/main/test.c?view=diff&rev=250239&r1=250238&r2=250239
==============================================================================
--- team/group/srtp_reboot/main/test.c (original)
+++ team/group/srtp_reboot/main/test.c Tue Mar 2 18:07:23 2010
@@ -281,7 +281,7 @@
last_results.last_time += test->time;
if (test->state == AST_TEST_PASS) {
last_results.last_passed++;
- } else {
+ } else if (test->state == AST_TEST_FAIL) {
last_results.last_failed++;
}
Modified: team/group/srtp_reboot/tests/test_utils.c
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/tests/test_utils.c?view=diff&rev=250239&r1=250238&r2=250239
==============================================================================
--- team/group/srtp_reboot/tests/test_utils.c (original)
+++ team/group/srtp_reboot/tests/test_utils.c Tue Mar 2 18:07:23 2010
@@ -185,11 +185,64 @@
return res;
}
+AST_TEST_DEFINE(base64_test)
+{
+ static const struct {
+ const char *input;
+ const char *decoded;
+ } tests[] = {
+ { "giraffe",
+ "Z2lyYWZmZQ==" },
+ { "platypus",
+ "cGxhdHlwdXM=" },
+ { "ParastratiosphecomyiaStratiosphecomyioides",
+ "UGFyYXN0cmF0aW9zcGhlY29teWlhU3RyYXRpb3NwaGVjb215aW9pZGVz" },
+ };
+ int i;
+ enum ast_test_result_state res = AST_TEST_PASS;
+
+ switch (cmd) {
+ case TEST_INIT:
+ info->name = "base64_test";
+ info->category = "main/utils/";
+ info->summary = "base64 test";
+ info->description = "This test exercises the base64 conversions.";
+ return AST_TEST_NOT_RUN;
+ case TEST_EXECUTE:
+ break;
+ }
+
+
+ for (i = 0; i < ARRAY_LEN(tests); i++) {
+ char tmp[64];
+ ast_base64encode(tmp, (unsigned char *)tests[i].input, strlen(tests[i].input), sizeof(tmp));
+ if (strcasecmp(tmp, tests[i].decoded)) {
+ ast_test_status_update(test,
+ "input: '%s' base64 output: '%s' expected base64 output: '%s'\n",
+ tests[i].input, tmp, tests[i].decoded);
+ res = AST_TEST_FAIL;
+ }
+
+ memset(tmp, 0, sizeof(tmp));
+ ast_base64decode((unsigned char *) tmp, tests[i].decoded, (sizeof(tmp) - 1));
+ if (strcasecmp(tmp, tests[i].input)) {
+ ast_test_status_update(test,
+ "base64 input: '%s' output: '%s' expected output: '%s'\n",
+ tests[i].decoded, tmp, tests[i].input);
+ res = AST_TEST_FAIL;
+ }
+ }
+
+ return res;
+}
+
+
static int unload_module(void)
{
AST_TEST_UNREGISTER(uri_encode_decode_test);
AST_TEST_UNREGISTER(md5_test);
AST_TEST_UNREGISTER(sha1_test);
+ AST_TEST_UNREGISTER(base64_test);
return 0;
}
@@ -198,6 +251,7 @@
AST_TEST_REGISTER(uri_encode_decode_test);
AST_TEST_REGISTER(md5_test);
AST_TEST_REGISTER(sha1_test);
+ AST_TEST_REGISTER(base64_test);
return AST_MODULE_LOAD_SUCCESS;
}
More information about the asterisk-commits
mailing list