[svn-commits] tilghman: branch 1.6.2 r295062 - in /branches/1.6.2: ./ tests/test_expr.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 15 12:24:04 CST 2010


Author: tilghman
Date: Mon Nov 15 12:24:02 2010
New Revision: 295062

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=295062
Log:
Merged revisions 295026 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r295026 | tilghman | 2010-11-15 11:58:37 -0600 (Mon, 15 Nov 2010) | 2 lines
  
  Create test verifying results of expression parser
........

Added:
    branches/1.6.2/tests/test_expr.c
      - copied, changed from r295026, branches/1.4/tests/test_expr.c
Modified:
    branches/1.6.2/   (props changed)

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Copied: branches/1.6.2/tests/test_expr.c (from r295026, branches/1.4/tests/test_expr.c)
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/tests/test_expr.c?view=diff&rev=295062&p1=branches/1.4/tests/test_expr.c&r1=295026&p2=branches/1.6.2/tests/test_expr.c&r2=295062
==============================================================================
--- branches/1.4/tests/test_expr.c (original)
+++ branches/1.6.2/tests/test_expr.c Mon Nov 15 12:24:02 2010
@@ -43,7 +43,7 @@
 {
 	int res = AST_TEST_PASS, i, len;
 	struct {
-		const char *input;
+		char *input;
 		const char *output;
 	} tests[] = {
 		{ "2 + 2", "4" },
@@ -57,7 +57,7 @@
 		{ "4 + (2 * 8)", "20" },
 		{ "4 + (2 * 8) ? 3 :: 6", "3" },
 		{ "4 + 8 / 2", "8" },
-		{ "4 + 8 / 3", "6" },
+		{ "FLOOR(4 + 8 / 3)", "6" }, /* Floating point op on 1.6 and higher, need FLOOR() to keep result sane */
 		{ "(4+8) / 3", "4" },
 		{ "4 + 8 % 3", "6" },
 		{ "4 + 9 % 3", "4" },
@@ -165,7 +165,7 @@
 
 	for (i = 0; i < ARRAY_LEN(tests); i++) {
 		memset(buf, 0, sizeof(buf));
-		len = ast_expr(tests[i].input, buf, sizeof(buf));
+		len = ast_expr(tests[i].input, buf, sizeof(buf), NULL);
 		buf[len] = '\0';
 		if (strcmp(buf, tests[i].output)) {
 			ast_test_status_update(test, "Case %d: expression '%s' evaluated as '%s', but should have evaluated as '%s'\n", i + 1, tests[i].input, buf, tests[i].output);




More information about the svn-commits mailing list