tests/test_tree.c

changeset 895
ea1ac0e8225c
parent 893
0a2b328f5b91
child 902
5ed7f634f046
equal deleted inserted replaced
894:89cd8dfdc3c2 895:ea1ac0e8225c
39 struct tree_node *children; 39 struct tree_node *children;
40 int data; 40 int data;
41 } tree_node; 41 } tree_node;
42 42
43 typedef struct tree_node2 { 43 typedef struct tree_node2 {
44 struct tree_node2 *parent; 44 CX_TREE_NODE_BASE(struct tree_node2);
45 struct tree_node2 *next;
46 struct tree_node2 *prev;
47 struct tree_node2 *children;
48 struct tree_node2 *last_child;
49 int data; 45 int data;
50 } tree_node2; 46 } tree_node2;
51 47
52 typedef struct tree_node_file { 48 typedef struct tree_node_file {
53 struct tree_node_file *parent; 49 struct tree_node_file *parent;
97 offsetof(tree_node, prev), offsetof(tree_node, next) 93 offsetof(tree_node, prev), offsetof(tree_node, next)
98 #define tree_node_full_layout(structname) \ 94 #define tree_node_full_layout(structname) \
99 offsetof(structname, parent), offsetof(structname, children),\ 95 offsetof(structname, parent), offsetof(structname, children),\
100 offsetof(structname, last_child), \ 96 offsetof(structname, last_child), \
101 offsetof(structname, prev), offsetof(structname, next) 97 offsetof(structname, prev), offsetof(structname, next)
102 #define tree_node2_layout tree_node_full_layout(tree_node2) 98 #define tree_node2_layout cx_tree_node_base_layout
103 #define tree_node_file_layout tree_node_full_layout(tree_node_file) 99 #define tree_node_file_layout tree_node_full_layout(tree_node_file)
104 100
105 #define tree_children(type) offsetof(type, children), offsetof(type, next) 101 #define tree_children(type) offsetof(type, children), offsetof(type, next)
106 102
107 CX_TEST(test_tree_link_new_child) { 103 CX_TEST(test_tree_link_new_child) {

mercurial