List:Commits« Previous MessageNext Message »
From:sebrecht Date:October 16 2007 12:41pm
Subject:ODBC C-tests commit: r168 - in trunk: doc etc testsuites testsuites/t_bug_10128
View as plain text  
Added:
   trunk/testsuites/t_bug_10128/
   trunk/testsuites/t_bug_10128/bug10128.c
   trunk/testsuites/t_bug_10128/t_bug_10128.h
   trunk/testsuites/t_bug_10128/t_bug_10128_suite.c
Modified:
   trunk/doc/suite_description.readme
   trunk/etc/test4v3.conf
Log:
add testsuite for bug 10128


Modified: trunk/doc/suite_description.readme
===================================================================
--- trunk/doc/suite_description.readme	2007-10-11 23:31:25 UTC (rev 167)
+++ trunk/doc/suite_description.readme	2007-10-16 12:41:25 UTC (rev 168)
@@ -9,6 +9,11 @@
    ok 2 - [master/bug_concat/concat]
    ok 3 - [master/bug_concat - TEARDOWN]
 
+t_bug_10128 (V3)
+ This testsuite is to test bug 10128.
+ It makes some calculations with select, like select (12-6)*1000/7.
+ There is no bug, when the tests doesn't fail.
+
 t_bug_16258 (V3)
  This testsuite is to test bug 16258.
  It tries to make inserts into views that are not

Modified: trunk/etc/test4v3.conf
===================================================================
--- trunk/etc/test4v3.conf	2007-10-11 23:31:25 UTC (rev 167)
+++ trunk/etc/test4v3.conf	2007-10-16 12:41:25 UTC (rev 168)
@@ -1,5 +1,6 @@
 t_bug_16258
 t_bug_30235
+t_bug_10128
 t_charset_bug
 t_bug_union_select
 t_bug_foreign_key

Added: trunk/testsuites/t_bug_10128/bug10128.c
===================================================================
--- trunk/testsuites/t_bug_10128/bug10128.c	2007-10-11 23:31:25 UTC (rev 167)
+++ trunk/testsuites/t_bug_10128/bug10128.c	2007-10-16 12:41:25 UTC (rev 168)
@@ -0,0 +1,50 @@
+/* ******************************************
+ * This test shows bug 10128
+
+ * created: 10/16/2007 susanne
+
+ ****************************************** */
+
+
+#include "t_bug_10128.h"
+
+OT_TEST_METHOD(selectdivision)
+{
+  SQLRETURN rc;
+  SQLLEN len;
+  int i= 0;
+  double rs=0.0;
+  SQLHANDLE stmt= get_statement();
+  char *qry= "select (12.4767-6)*1000/7.2659";
+  char *qry2="select 1/2";
+  char *qry3="select ((13.5-3)*10/3.5)/(2.5-1)";
+  
+  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry, SQL_NTS), stmt);
+  if((rc= SQLFetch(stmt)) != SQL_SUCCESS)
+    OT_FAIL("No data found for select (12.4767-6)*1000/7.2659.");
+  CHECK_SQL_S(SQLGetData(stmt, 1, SQL_C_DOUBLE, &rs, 0, &len), stmt);
+  test_printf("result (12.4767-6)*1000/7.2659: %f\n",rs);
+  if((rs < 891.3) || (rs > 891.4))
+    OT_FAIL("Wrong result.");
+  reset_statement(stmt);
+  rs=0.0;
+
+  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry2, SQL_NTS), stmt);
+  if((rc= SQLFetch(stmt)) != SQL_SUCCESS)
+    OT_FAIL("No data found for select 1/2.");
+  CHECK_SQL_S(SQLGetData(stmt, 1, SQL_C_DOUBLE, &rs, 0, &len), stmt);
+  test_printf("result 1/2: %f\n",rs);
+  if(rs != 0.5)
+    OT_FAIL("Wrong result.");
+  reset_statement(stmt);
+  rs=0.0;
+  
+  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry3, SQL_NTS), stmt);
+  if((rc= SQLFetch(stmt)) != SQL_SUCCESS)
+    OT_FAIL("No data found for select ((13.5-3)*10/3.5)/(2.5-1).");
+  CHECK_SQL_S(SQLGetData(stmt, 1, SQL_C_DOUBLE, &rs, 0, &len), stmt);
+  test_printf("result ((13.5-3)*10/3.5)/(2.5-1): %f\n",rs);
+  if(rs != 20.0)
+    OT_FAIL("Wrong result.");
+  free_statement(stmt);
+}

Added: trunk/testsuites/t_bug_10128/t_bug_10128.h
===================================================================
--- trunk/testsuites/t_bug_10128/t_bug_10128.h	2007-10-11 23:31:25 UTC (rev 167)
+++ trunk/testsuites/t_bug_10128/t_bug_10128.h	2007-10-16 12:41:25 UTC (rev 168)
@@ -0,0 +1,9 @@
+#include "odbctest.h"
+
+/* test data definitions */
+extern const char *TD_DBNAME;
+
+extern const int TD_ALLTYPES_COLS;
+
+/* create tests */
+OT_TEST_METHOD(selectdivision);

Added: trunk/testsuites/t_bug_10128/t_bug_10128_suite.c
===================================================================
--- trunk/testsuites/t_bug_10128/t_bug_10128_suite.c	2007-10-11 23:31:25 UTC (rev 167)
+++ trunk/testsuites/t_bug_10128/t_bug_10128_suite.c	2007-10-16 12:41:25 UTC (rev 168)
@@ -0,0 +1,22 @@
+#include "t_bug_10128.h"
+
+OT_SUITE_SETUP(bug_10128_suite_setup)
+{  
+  if (!global_connect())
+    return "Cannot create global connection!";
+  else
+    return NULL;
+}
+
+OT_SUITE_TEARDOWN(bug_10128_suite_teardown)
+{
+  global_disconnect();
+  return NULL;
+}
+
+OT_SUITE_REGISTER_START("bug_10128",bug_10128_suite_setup,bug_10128_suite_teardown)
+/* create tests */
+OT_SUITE_ADD_TEST(selectdivision, NULL, NULL);
+
+OT_SUITE_REGISTER_END
+

Thread
ODBC C-tests commit: r168 - in trunk: doc etc testsuites testsuites/t_bug_10128sebrecht16 Oct