~ubuntu-branches/ubuntu/precise/folks/precise-201306070638

« back to all changes in this revision

Viewing changes to tests/lib/test-case.c

  • Committer: Bazaar Package Importer
  • Author(s): Brian Curtis
  • Date: 2011-02-02 14:22:14 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20110202142214-ngpuu3mhjxyl430f
Tags: 0.3.4-0ubuntu1
* New Upstream Release
  - libfolks-telepathy.so exports private symbols
  - Add a HACKING file that outlines development policies and coding style
  - Review coding conventions in folks
  - Add folks command line application
  - libfolks hard-codes backend names for debugging
  - Print stack traces for failed tests to improve remote debugging
  - Add static aggregation tests
  - Logger service unavailable in make check
  - Add tests for LinkedHashSet
  - Use better interface names
* debian/control
  -changed Maintainer to XSBC-Original-Maintainer
  -added Maintainer of Ubuntu Core Developers
  -changed libfolks19* > libfolks20*
* debian
  -changed .install and .symbols files from 19 > 20

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* test-case.c generated by valac 0.11.2.25-30b2-dirty, the Vala compiler
 
1
/* test-case.c generated by valac 0.11.5.3-fe751, the Vala compiler
2
2
 * generated from test-case.vala, do not modify */
3
3
 
4
4
/* testcase.vala
29
29
#include <glib-object.h>
30
30
#include <stdlib.h>
31
31
#include <string.h>
 
32
#include <stdio.h>
32
33
#include <gobject/gvaluecollector.h>
33
34
 
34
35
 
70
71
};
71
72
 
72
73
struct _FolksTestCasePrivate {
73
 
        GTestSuite* suite;
74
 
        FolksTestCaseAdaptor** adaptors;
75
 
        gint adaptors_length1;
76
 
        gint _adaptors_size_;
 
74
        GTestSuite* _suite;
 
75
        FolksTestCaseAdaptor** _adaptors;
 
76
        gint _adaptors_length1;
 
77
        gint __adaptors_size_;
77
78
};
78
79
 
79
80
typedef void (*FolksTestCaseTestMethod) (void* user_data);
90
91
 
91
92
struct _FolksTestCaseAdaptorPrivate {
92
93
        gchar* _name;
93
 
        FolksTestCaseTestMethod test;
94
 
        gpointer test_target;
95
 
        GDestroyNotify test_target_destroy_notify;
96
 
        FolksTestCase* test_case;
 
94
        FolksTestCaseTestMethod _test;
 
95
        gpointer _test_target;
 
96
        GDestroyNotify _test_target_destroy_notify;
 
97
        FolksTestCase* _test_case;
97
98
};
98
99
 
99
100
struct _FolksTestCaseParamSpecAdaptor {
137
138
enum  {
138
139
        FOLKS_TEST_CASE_ADAPTOR_DUMMY_PROPERTY
139
140
};
 
141
static void _folks_test_case_adaptor_printerr_func_stack_trace (FolksTestCaseAdaptor* self, const gchar* text);
 
142
static void _folks_test_case_adaptor_log_func_stack_trace (FolksTestCaseAdaptor* self, const gchar* log_domain, GLogLevelFlags log_levels, const gchar* message);
 
143
static void __folks_test_case_adaptor_log_func_stack_trace_glog_func (const gchar* log_domain, GLogLevelFlags log_levels, const gchar* message, gpointer self);
140
144
static void folks_test_case_adaptor_set_name (FolksTestCaseAdaptor* self, const gchar* value);
141
145
static void folks_test_case_adaptor_finalize (FolksTestCaseAdaptor* obj);
142
146
static void folks_test_case_finalize (GObject* obj);
150
154
        g_return_val_if_fail (name != NULL, NULL);
151
155
        self = (FolksTestCase*) g_object_new (object_type, NULL);
152
156
        _tmp0_ = g_test_create_suite (name);
153
 
        self->priv->suite = _tmp0_;
 
157
        self->priv->_suite = _tmp0_;
154
158
        return self;
155
159
}
156
160
 
196
200
        _tmp0_ = folks_test_case_adaptor_new (name, test, test_target, self);
197
201
        adaptor = _tmp0_;
198
202
        _tmp1_ = _folks_test_case_adaptor_ref0 (adaptor);
199
 
        _vala_array_add1 (&self->priv->adaptors, &self->priv->adaptors_length1, &self->priv->_adaptors_size_, _tmp1_);
 
203
        _vala_array_add1 (&self->priv->_adaptors, &self->priv->_adaptors_length1, &self->priv->__adaptors_size_, _tmp1_);
200
204
        _tmp2_ = folks_test_case_adaptor_get_name (adaptor);
201
205
        _tmp3_ = g_test_create_case (_tmp2_, (gsize) 0, adaptor, (void (*) (void)) _folks_test_case_adaptor_set_up_gtest_func, (void (*) (void)) _folks_test_case_adaptor_run_gtest_func, (void (*) (void)) _folks_test_case_adaptor_tear_down_gtest_func);
202
 
        g_test_suite_add (self->priv->suite, _tmp3_);
 
206
        g_test_suite_add (self->priv->_suite, _tmp3_);
203
207
        _folks_test_case_adaptor_unref0 (adaptor);
204
208
}
205
209
 
227
231
GTestSuite* folks_test_case_get_suite (FolksTestCase* self) {
228
232
        GTestSuite* result = NULL;
229
233
        g_return_val_if_fail (self != NULL, NULL);
230
 
        result = self->priv->suite;
 
234
        result = self->priv->_suite;
231
235
        return result;
232
236
}
233
237
 
239
243
 
240
244
static FolksTestCaseAdaptor* folks_test_case_adaptor_construct (GType object_type, const gchar* name, FolksTestCaseTestMethod test, void* test_target, FolksTestCase* test_case) {
241
245
        FolksTestCaseAdaptor* self = NULL;
242
 
        FolksTestCaseTestMethod _tmp0_;
243
 
        FolksTestCaseTestMethod _tmp1_;
244
 
        FolksTestCase* _tmp2_;
245
 
        FolksTestCase* _tmp3_;
 
246
        gchar* _tmp0_;
 
247
        gchar* _tmp1_;
 
248
        FolksTestCaseTestMethod _tmp2_;
 
249
        FolksTestCaseTestMethod _tmp3_;
 
250
        FolksTestCase* _tmp4_;
 
251
        FolksTestCase* _tmp5_;
246
252
        g_return_val_if_fail (name != NULL, NULL);
247
253
        g_return_val_if_fail (test_case != NULL, NULL);
248
254
        self = (FolksTestCaseAdaptor*) g_type_create_instance (object_type);
249
 
        folks_test_case_adaptor_set_name (self, name);
250
 
        _tmp0_ = test;
 
255
        _tmp0_ = g_strdup (name);
251
256
        _tmp1_ = _tmp0_;
252
 
        (self->priv->test_target_destroy_notify == NULL) ? NULL : (self->priv->test_target_destroy_notify (self->priv->test_target), NULL);
253
 
        self->priv->test = NULL;
254
 
        self->priv->test_target = NULL;
255
 
        self->priv->test_target_destroy_notify = NULL;
256
 
        self->priv->test_target = test_target;
257
 
        self->priv->test_target_destroy_notify = NULL;
258
 
        self->priv->test = _tmp1_;
259
 
        _tmp2_ = _g_object_ref0 (test_case);
 
257
        _g_free0 (self->priv->_name);
 
258
        self->priv->_name = _tmp1_;
 
259
        _tmp2_ = test;
260
260
        _tmp3_ = _tmp2_;
261
 
        _g_object_unref0 (self->priv->test_case);
262
 
        self->priv->test_case = _tmp3_;
 
261
        (self->priv->_test_target_destroy_notify == NULL) ? NULL : (self->priv->_test_target_destroy_notify (self->priv->_test_target), NULL);
 
262
        self->priv->_test = NULL;
 
263
        self->priv->_test_target = NULL;
 
264
        self->priv->_test_target_destroy_notify = NULL;
 
265
        self->priv->_test_target = test_target;
 
266
        self->priv->_test_target_destroy_notify = NULL;
 
267
        self->priv->_test = _tmp3_;
 
268
        _tmp4_ = _g_object_ref0 (test_case);
 
269
        _tmp5_ = _tmp4_;
 
270
        _g_object_unref0 (self->priv->_test_case);
 
271
        self->priv->_test_case = _tmp5_;
263
272
        return self;
264
273
}
265
274
 
269
278
}
270
279
 
271
280
 
 
281
static void __folks_test_case_adaptor_log_func_stack_trace_glog_func (const gchar* log_domain, GLogLevelFlags log_levels, const gchar* message, gpointer self) {
 
282
        _folks_test_case_adaptor_log_func_stack_trace (self, log_domain, log_levels, message);
 
283
}
 
284
 
 
285
 
272
286
static void folks_test_case_adaptor_set_up (FolksTestCaseAdaptor* self, void* fixture) {
273
287
        g_return_if_fail (self != NULL);
274
 
        folks_test_case_set_up (self->priv->test_case);
 
288
        g_set_printerr_handler ((GPrintFunc) _folks_test_case_adaptor_printerr_func_stack_trace);
 
289
        g_log_set_default_handler (__folks_test_case_adaptor_log_func_stack_trace_glog_func, self);
 
290
        folks_test_case_set_up (self->priv->_test_case);
 
291
}
 
292
 
 
293
 
 
294
static void _folks_test_case_adaptor_printerr_func_stack_trace (FolksTestCaseAdaptor* self, const gchar* text) {
 
295
        g_return_if_fail (self != NULL);
 
296
        if (text != NULL) {
 
297
                fprintf (stderr, "%s", text);
 
298
        }
 
299
        g_on_error_stack_trace ("libtool --mode=execute gdb");
 
300
}
 
301
 
 
302
 
 
303
static void _folks_test_case_adaptor_log_func_stack_trace (FolksTestCaseAdaptor* self, const gchar* log_domain, GLogLevelFlags log_levels, const gchar* message) {
 
304
        g_return_if_fail (self != NULL);
 
305
        g_return_if_fail (message != NULL);
 
306
        g_log_default_handler (log_domain, log_levels, message, NULL);
 
307
        if ((log_levels & ((G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR) | G_LOG_LEVEL_CRITICAL)) != 0) {
 
308
                g_on_error_stack_trace ("libtool --mode=execute gdb");
 
309
        }
275
310
}
276
311
 
277
312
 
278
313
static void folks_test_case_adaptor_run (FolksTestCaseAdaptor* self, void* fixture) {
279
314
        g_return_if_fail (self != NULL);
280
 
        self->priv->test (self->priv->test_target);
 
315
        self->priv->_test (self->priv->_test_target);
281
316
}
282
317
 
283
318
 
284
319
static void folks_test_case_adaptor_tear_down (FolksTestCaseAdaptor* self, void* fixture) {
285
320
        g_return_if_fail (self != NULL);
286
 
        folks_test_case_tear_down (self->priv->test_case);
 
321
        folks_test_case_tear_down (self->priv->_test_case);
287
322
}
288
323
 
289
324
 
433
468
        FolksTestCaseAdaptor * self;
434
469
        self = FOLKS_TEST_CASE_ADAPTOR (obj);
435
470
        _g_free0 (self->priv->_name);
436
 
        (self->priv->test_target_destroy_notify == NULL) ? NULL : (self->priv->test_target_destroy_notify (self->priv->test_target), NULL);
437
 
        self->priv->test = NULL;
438
 
        self->priv->test_target = NULL;
439
 
        self->priv->test_target_destroy_notify = NULL;
440
 
        _g_object_unref0 (self->priv->test_case);
 
471
        (self->priv->_test_target_destroy_notify == NULL) ? NULL : (self->priv->_test_target_destroy_notify (self->priv->_test_target), NULL);
 
472
        self->priv->_test = NULL;
 
473
        self->priv->_test_target = NULL;
 
474
        self->priv->_test_target_destroy_notify = NULL;
 
475
        _g_object_unref0 (self->priv->_test_case);
441
476
}
442
477
 
443
478
 
486
521
        FolksTestCaseAdaptor** _tmp0_ = NULL;
487
522
        self->priv = FOLKS_TEST_CASE_GET_PRIVATE (self);
488
523
        _tmp0_ = g_new0 (FolksTestCaseAdaptor*, 0 + 1);
489
 
        self->priv->adaptors = _tmp0_;
490
 
        self->priv->adaptors_length1 = 0;
491
 
        self->priv->_adaptors_size_ = self->priv->adaptors_length1;
 
524
        self->priv->_adaptors = _tmp0_;
 
525
        self->priv->_adaptors_length1 = 0;
 
526
        self->priv->__adaptors_size_ = self->priv->_adaptors_length1;
492
527
}
493
528
 
494
529
 
495
530
static void folks_test_case_finalize (GObject* obj) {
496
531
        FolksTestCase * self;
497
532
        self = FOLKS_TEST_CASE (obj);
498
 
        self->priv->adaptors = (_vala_array_free (self->priv->adaptors, self->priv->adaptors_length1, (GDestroyNotify) folks_test_case_adaptor_unref), NULL);
 
533
        self->priv->_adaptors = (_vala_array_free (self->priv->_adaptors, self->priv->_adaptors_length1, (GDestroyNotify) folks_test_case_adaptor_unref), NULL);
499
534
        G_OBJECT_CLASS (folks_test_case_parent_class)->finalize (obj);
500
535
}
501
536