Commit c56b4510 authored by Christoph Reiter's avatar Christoph Reiter 馃悕

tests: add tests for boxed in GLists. See !24

parent 9c3cb6b4
Pipeline #3543 passed with stage
in 10 minutes and 45 seconds
......@@ -67,3 +67,36 @@ regress_test_array_fixed_boxed_none_out (RegressTestBoxedC ***objs)
*objs = arr;
}
/**
* regress_test_glist_boxed_none_return
* Return value: (element-type RegressTestBoxedC) (transfer none):
**/
GList *
regress_test_glist_boxed_none_return (guint count)
{
static GList *list = NULL;
if (!list) {
while (count > 0) {
list = g_list_prepend (list, regress_test_boxed_c_new ());
count--;
}
}
return list;
}
/**
* regress_test_glist_boxed_full_return
* Return value: (element-type RegressTestBoxedC) (transfer full):
**/
GList *
regress_test_glist_boxed_full_return (guint count)
{
GList *list = NULL;
while (count > 0) {
list = g_list_prepend (list, regress_test_boxed_c_new ());
count--;
}
return list;
}
......@@ -16,5 +16,9 @@ RegressTestBoxedC *regress_test_boxed_c_wrapper_get (RegressTestBoxedCWrapper *s
_GI_TEST_EXTERN
void regress_test_array_fixed_boxed_none_out (RegressTestBoxedC ***objs);
_GI_TEST_EXTERN
GList *regress_test_glist_boxed_none_return (guint count);
_GI_TEST_EXTERN
GList *regress_test_glist_boxed_full_return (guint count);
#endif /* REGRESS_EXTRA_H */
......@@ -1166,6 +1166,22 @@ class TestBoxed(unittest.TestCase):
assert arr[0].refcount == 2
assert arr[1].refcount == 2
def test_glist_boxed_none_return(self):
assert len(Everything.test_glist_boxed_none_return(0)) == 0
list_ = Everything.test_glist_boxed_none_return(2)
assert len(list_) == 2
assert list_[0].refcount == 2
assert list_[1].refcount == 2
def test_glist_boxed_full_return(self):
assert len(Everything.test_glist_boxed_full_return(0)) == 0
list_ = Everything.test_glist_boxed_full_return(2)
assert len(list_) == 2
assert list_[0].refcount == 1
assert list_[1].refcount == 1
class TestTortureProfile(unittest.TestCase):
def test_torture_profile(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment