diff options
author | Garrett Regier <Garrett.Regier@riftio.com> | 2014-08-07 12:23:54 -0400 |
---|---|---|
committer | Garrett Regier <Garrett.Regier@riftio.com> | 2014-08-07 15:53:47 -0400 |
commit | e2b96aaa46ce73812fd41e46d996cd21da18f7be (patch) | |
tree | b109196f430566b2aa77bdc08703a082613dfd78 /tests/scanner/regress.c | |
parent | a6f199ddf1fbe1ba3ed406e40bf114c0912ef346 (diff) | |
download | gobject-introspection-e2b96aaa46ce73812fd41e46d996cd21da18f7be.tar.gz |
tests: Add regression test for callbacks with an inout array
https://bugzilla.gnome.org/show_bug.cgi?id=702508
Diffstat (limited to 'tests/scanner/regress.c')
-rw-r--r-- | tests/scanner/regress.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index b42e0cd0..e60b8e17 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -3363,6 +3363,37 @@ int regress_test_array_callback (RegressTestCallbackArray callback) } /** + * regress_test_array_inout_callback: + * @callback: (scope call): + * + */ +int +regress_test_array_inout_callback (RegressTestCallbackArrayInOut callback) +{ + int *ints; + int length; + + ints = g_new (int, 5); + for (length = 0; length < 5; ++length) + ints[length] = length - 2; + + callback (&ints, &length); + + g_assert_cmpint (length, ==, 4); + for (length = 0; length < 4; ++length) + g_assert_cmpint (ints[length], ==, length - 1); + + callback (&ints, &length); + + g_assert_cmpint (length, ==, 3); + for (length = 0; length < 3; ++length) + g_assert_cmpint (ints[length], ==, length); + + g_free (ints); + return length; +} + +/** * regress_test_simple_callback: * @callback: (scope call) (allow-none): * |