/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
4 by Gustav Hartvigsson
Fixed a few problems.
1
#include "SimpleTypeSystem.h"
32 by Gustav Hartvigsson
* Added some compile options to the root CMakeLists.txt
2
#include "../test_macros.h"
3
4 by Gustav Hartvigsson
Fixed a few problems.
4
5
int main (char ** argc, int argv) {
32 by Gustav Hartvigsson
* Added some compile options to the root CMakeLists.txt
6
  
7
  int retval = 0;
8
  
9
  SObject * obj = s_object_new ();
10
  
33 by Gustav Hartvigsson
* made test_macros.h a lil' bit more portable
11
  test_case (s_object_get_refcount (obj) == 1, "Start refcount == 1", retval);
12
  
13
  s_object_ref (obj);
14
  
15
  test_case (s_object_get_refcount (obj) == 2, "Manual get of refcount. == 2", retval);
16
  
17
  test_case (s_object_ref (obj) == 3, "Get refcount from ref function. == 3", retval);
18
  
19
  s_print ("running ref 10 000 times on object\n");
20
  for (size_t i = 0; i < 10000; i++) {
21
    s_object_ref (obj);
22
  }
23
  s_print ("running unref 10 000 times on object\n");
24
  for (size_t i = 0; i < 10000; i++) {
25
    s_object_unref (obj);
26
  }
27
  
28
  test_case (s_object_get_refcount (obj) == 3, "refcount == 3", retval);
29
  
30
  test_case (s_object_unref (obj) == 2, "Get refcount from unref function. == 2", retval);
31
  
32
  s_print ("Skipping unref test.\n");
33
  s_object_unref (obj);
34
  
35
  test_case (s_object_unref (obj) == 0, "refcount == 0", retval);
32 by Gustav Hartvigsson
* Added some compile options to the root CMakeLists.txt
36
  
4 by Gustav Hartvigsson
Fixed a few problems.
37
  return 0;
38
}