/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: 2016-01-26 13:54:14 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20160126135414-73ojri873r6kms17
*More tests to the test god!

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
}
9
9
 
10
10
spointer
11
 
test_callback_test_func2 (SObject * obj, spointer user_data) {
12
 
 
 
11
test_callback_test_func2 (SObject * obj, sint * output) {
 
12
  s_print ("Hello from the callback!\n");
 
13
  *output = 1337;
13
14
  return NULL;
14
15
}
15
16
 
34
35
 
35
36
  callback_entries[TEST_CALLBACK2] =
36
37
    s_callback_entry_new ("test2",
37
 
                          test_callback_test_func2,
 
38
                          CALLBACK(test_callback_test_func2)  ,
38
39
                          S_CALLBACK_CALLBACK);
39
40
 
40
41
  s_object_install_callbacks (obj, TEST_CALLBACK_END, callback_entries);
41
 
 
 
42
  
 
43
  test_case (s_object_notify (obj, "test1", NULL) == 2,
 
44
            "the output from the callback is the expected value");
 
45
  
 
46
  sint * output = malloc (sizeof (sint));
 
47
  
 
48
  s_object_notify (obj, "test2", (spointer)output);
 
49
  
 
50
  test_case (*output != NULL, "The value that was givef vida the user_data"
 
51
                              "pointer is not null");
 
52
  
 
53
  test_case (*output == 1337, "The value that was given via the"
 
54
                              " user_data pointer has the corret"
 
55
                              " value");
 
56
  
42
57
  s_object_free (obj);
43
58
 
44
59
  end_unit ();