/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to tests/callback.c

  • Committer: Gustav Hartvigsson
  • Date: 2015-10-28 14:45:22 UTC
  • mto: This revision was merged to the branch mainline in revision 111.
  • Revision ID: gustav.hartvigsson@gmail.com-20151028144522-fo54z73ssjex0emw
* SMap seems to be broken... Or could it be SObject's Callback stuff? Or SLinkedList?

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "../libssts/SimpleTypeSystem.h"
 
2
#include "callback.h"
 
3
#include "test_macros.h"
 
4
 
 
5
int
 
6
test_callback_test_func1 (SObject * obj, spointer user_data) {
 
7
  return 2;
 
8
}
 
9
 
 
10
spointer
 
11
test_callback_test_func2 (SObject * obj, spointer user_data) {
 
12
 
 
13
  return NULL;
 
14
}
 
15
 
 
16
enum {
 
17
  TEST_CALLBACK1,
 
18
  TEST_CALLBACK2,
 
19
  TEST_CALLBACK_END
 
20
};
 
21
 
 
22
static SCallbackEntry * callback_entries[] = {NULL,};
 
23
 
 
24
int test_callback (void) {
 
25
  setup_unit ();
 
26
 
 
27
  SObject * obj = s_object_new ();
 
28
 
 
29
  callback_entries[TEST_CALLBACK1] =
 
30
    s_callback_entry_new ("test1",
 
31
                          test_callback_test_func1,
 
32
                          S_CALLBACK_CALLBACK);
 
33
 
 
34
  callback_entries[TEST_CALLBACK2] =
 
35
    s_callback_entry_new ("test2",
 
36
                          test_callback_test_func2,
 
37
                          S_CALLBACK_CALLBACK);
 
38
 
 
39
  s_object_install_callbacks (obj, TEST_CALLBACK_END ,callback_entries);
 
40
 
 
41
  s_object_free (obj);
 
42
 
 
43
  end_unit ();
 
44
}