Add more coverage for recently added (skip) regress additions
authorDavid Zeuthen <davidz@redhat.com>
Sat, 14 May 2011 00:40:17 +0000 (20:40 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Sat, 14 May 2011 00:40:17 +0000 (20:40 -0400)
Whilst doing the gjs patch, it turned out this was needed in order to
do a robust test suite - we really want to cover all bases here.

Signed-off-by: David Zeuthen <davidz@redhat.com>
tests/scanner/Regress-1.0-expected.gir
tests/scanner/regress.c
tests/scanner/regress.h

index 4d915b896e7b5d1f2366984e10b528608c36faa6..40bdf4e0626b47204944efc16ed2de4027d46ac3 100644 (file)
@@ -534,10 +534,108 @@ case.</doc>
           </parameter>
         </parameters>
       </method>
+      <method name="skip_inout_param"
+              c:identifier="regress_test_obj_skip_inout_param"
+              throws="1">
+        <doc xml:whitespace="preserve">Check that the out value is skipped</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the call succeeds, %FALSE if @error is set.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="a" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Parameter.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="out_b"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="c" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Other parameter.</doc>
+            <type name="gdouble" c:type="gdouble"/>
+          </parameter>
+          <parameter name="inout_d"
+                     direction="inout"
+                     caller-allocates="0"
+                     transfer-ownership="full"
+                     skip="1">
+            <doc xml:whitespace="preserve">Will be incremented.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="out_sum"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="num1" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="num2" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="skip_out_param"
+              c:identifier="regress_test_obj_skip_out_param"
+              throws="1">
+        <doc xml:whitespace="preserve">Check that the out value is skipped</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the call succeeds, %FALSE if @error is set.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="a" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Parameter.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="out_b"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full"
+                     skip="1">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="c" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Other parameter.</doc>
+            <type name="gdouble" c:type="gdouble"/>
+          </parameter>
+          <parameter name="inout_d"
+                     direction="inout"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Will be incremented.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="out_sum"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="num1" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="num2" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
       <method name="skip_param"
               c:identifier="regress_test_obj_skip_param"
               throws="1">
-        <doc xml:whitespace="preserve">Check that the return value is skipped</doc>
+        <doc xml:whitespace="preserve">Check that a parameter is skipped</doc>
         <return-value transfer-ownership="none">
           <doc xml:whitespace="preserve">%TRUE if the call succeeds, %FALSE if @error is set.</doc>
           <type name="gboolean" c:type="gboolean"/>
@@ -558,6 +656,28 @@ case.</doc>
             <doc xml:whitespace="preserve">Other parameter.</doc>
             <type name="gdouble" c:type="gdouble"/>
           </parameter>
+          <parameter name="inout_d"
+                     direction="inout"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Will be incremented.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="out_sum"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="num1" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="num2" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
         </parameters>
       </method>
       <method name="skip_return_val"
@@ -584,6 +704,28 @@ case.</doc>
             <doc xml:whitespace="preserve">Other parameter.</doc>
             <type name="gdouble" c:type="gdouble"/>
           </parameter>
+          <parameter name="inout_d"
+                     direction="inout"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Will be incremented.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="out_sum"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="num1" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="num2" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
         </parameters>
       </method>
       <method name="torture_signature_0"
index f8a552b06104557c64217a295b72b8ca6f0e3799..3d8690f538e5df04c1848777f9d9ef5ea5a35b8c 100644 (file)
@@ -2038,6 +2038,10 @@ regress_test_obj_torture_signature_1 (RegressTestObj   *obj,
  * @a: Parameter.
  * @out_b: (out): A return value.
  * @c: Other parameter.
+ * @inout_d: (inout): Will be incremented.
+ * @out_sum: (out): Return value.
+ * @num1: Number.
+ * @num2: Number.
  * @error: Return location for error.
  *
  * Check that the return value is skipped
@@ -2045,16 +2049,23 @@ regress_test_obj_torture_signature_1 (RegressTestObj   *obj,
  * Returns: (skip): %TRUE if the call succeeds, %FALSE if @error is set.
  */
 gboolean
-regress_test_obj_skip_return_val (RegressTestObj  *obj,
-                                  gint             a,
-                                  gint            *out_b,
-                                  gdouble          c,
-                                  GError         **error)
-{
-  if (a == 0)
-    return TRUE;
-  g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "a is non-zero");
-  return FALSE;
+regress_test_obj_skip_return_val (RegressTestObj *obj,
+                                  gint            a,
+                                  gint           *out_b,
+                                  gdouble         c,
+                                  gint           *inout_d,
+                                  gint           *out_sum,
+                                  gint            num1,
+                                  gint            num2,
+                                  GError        **error)
+{
+  if (out_b != NULL)
+    *out_b = a + 1;
+  if (inout_d != NULL)
+    *inout_d = *inout_d + 1;
+  if (out_sum != NULL)
+    *out_sum = num1 + 10*num2;
+  return TRUE;
 }
 
 /**
@@ -2063,8 +2074,13 @@ regress_test_obj_skip_return_val (RegressTestObj  *obj,
  * @a: Parameter.
  * @out_b: (out): Return value.
  * @c: (skip): Other parameter.
+ * @inout_d: (inout): Will be incremented.
+ * @out_sum: (out): Return value.
+ * @num1: Number.
+ * @num2: Number.
+ * @error: Return location for error.
  *
- * Check that the return value is skipped
+ * Check that a parameter is skipped
  *
  * Returns: %TRUE if the call succeeds, %FALSE if @error is set.
  */
@@ -2073,12 +2089,91 @@ regress_test_obj_skip_param (RegressTestObj *obj,
                              gint            a,
                              gint           *out_b,
                              gdouble         c,
+                             gint           *inout_d,
+                             gint           *out_sum,
+                             gint            num1,
+                             gint            num2,
                              GError        **error)
 {
-  if (a == 0)
-    return TRUE;
-  g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "a is non-zero");
-  return FALSE;
+  if (out_b != NULL)
+    *out_b = a + 1;
+  if (inout_d != NULL)
+    *inout_d = *inout_d + 1;
+  if (out_sum != NULL)
+    *out_sum = num1 + 10*num2;
+  return TRUE;
+}
+
+/**
+ * regress_test_obj_skip_out_param:
+ * @obj: A #RegressTestObj.
+ * @a: Parameter.
+ * @out_b: (out) (skip): Return value.
+ * @c: Other parameter.
+ * @inout_d: (inout): Will be incremented.
+ * @out_sum: (out): Return value.
+ * @num1: Number.
+ * @num2: Number.
+ * @error: Return location for error.
+ *
+ * Check that the out value is skipped
+ *
+ * Returns: %TRUE if the call succeeds, %FALSE if @error is set.
+ */
+gboolean
+regress_test_obj_skip_out_param (RegressTestObj *obj,
+                                 gint            a,
+                                 gint           *out_b,
+                                 gdouble         c,
+                                 gint           *inout_d,
+                                 gint           *out_sum,
+                                 gint            num1,
+                                 gint            num2,
+                                 GError        **error)
+{
+  if (out_b != NULL)
+    *out_b = a + 1;
+  if (inout_d != NULL)
+    *inout_d = *inout_d + 1;
+  if (out_sum != NULL)
+    *out_sum = num1 + 10*num2;
+  return TRUE;
+}
+
+/**
+ * regress_test_obj_skip_inout_param:
+ * @obj: A #RegressTestObj.
+ * @a: Parameter.
+ * @out_b: (out): Return value.
+ * @c: Other parameter.
+ * @inout_d: (inout) (skip): Will be incremented.
+ * @out_sum: (out): Return value.
+ * @num1: Number.
+ * @num2: Number.
+ * @error: Return location for error.
+ *
+ * Check that the out value is skipped
+ *
+ * Returns: %TRUE if the call succeeds, %FALSE if @error is set.
+ */
+gboolean
+regress_test_obj_skip_inout_param (RegressTestObj *obj,
+                                   gint            a,
+                                   gint           *out_b,
+                                   gdouble         c,
+                                   gint           *inout_d,
+                                   gint           *out_sum,
+                                   gint            num1,
+                                   gint            num2,
+                                   GError        **error)
+{
+  if (out_b != NULL)
+    *out_b = a + 1;
+  if (inout_d != NULL)
+    *inout_d = *inout_d + 1;
+  if (out_sum != NULL)
+    *out_sum = num1 + 10*num2;
+  return TRUE;
 }
 
 /**
index 562e8a4c596359e02f4e7f4869e1af84c3fbfed9..ee535f6592ebff68cf6166982e100921d1f92015 100644 (file)
@@ -352,18 +352,46 @@ gboolean regress_test_obj_torture_signature_1 (RegressTestObj    *obj,
                                        guint       m,
                                        GError    **error);
 
-gboolean regress_test_obj_skip_return_val (RegressTestObj  *obj,
-                                           gint             a,
-                                           gint            *out_b,
-                                           gdouble          c,
-                                           GError         **error);
+gboolean regress_test_obj_skip_return_val (RegressTestObj *obj,
+                                           gint            a,
+                                           gint           *out_b,
+                                           gdouble         c,
+                                           gint           *inout_d,
+                                           gint           *out_sum,
+                                           gint            num1,
+                                           gint            num2,
+                                           GError        **error);
 
 gboolean regress_test_obj_skip_param (RegressTestObj *obj,
                                       gint            a,
                                       gint           *out_b,
                                       gdouble         c,
+                                      gint           *inout_d,
+                                      gint           *out_sum,
+                                      gint            num1,
+                                      gint            num2,
                                       GError        **error);
 
+gboolean regress_test_obj_skip_out_param (RegressTestObj *obj,
+                                          gint            a,
+                                          gint           *out_b,
+                                          gdouble         c,
+                                          gint           *inout_d,
+                                          gint           *out_sum,
+                                          gint            num1,
+                                          gint            num2,
+                                          GError        **error);
+
+gboolean regress_test_obj_skip_inout_param (RegressTestObj *obj,
+                                            gint            a,
+                                            gint           *out_b,
+                                            gdouble         c,
+                                            gint           *inout_d,
+                                            gint           *out_sum,
+                                            gint            num1,
+                                            gint            num2,
+                                            GError        **error);
+
 /* virtual */
 int        regress_test_obj_do_matrix (RegressTestObj *obj, const char *somestr);