@@ -17,40 +17,93 @@ def __init__(self, *args):
17
17
parser_test_case .parser_test_case_t .__init__ (self , * args )
18
18
self .header = "test_smart_pointer.hpp"
19
19
self .config .cflags = "-std=c++11"
20
+ self .global_ns = None
20
21
21
- def test_smart_pointer (self ):
22
+ def setUp (self ):
23
+ if self .config .xml_generator == "gccxml" :
24
+ return
25
+ decls = parser .parse ([self .header ], self .config )
26
+ self .global_ns = declarations .get_global_namespace (decls )
27
+
28
+ def test_is_smart_pointer (self ):
22
29
"""
23
- Test code in the smart_pointer_traits module .
30
+ Test smart_pointer_traits.is_smart_pointer method .
24
31
25
32
"""
26
33
27
34
if self .config .xml_generator == "gccxml" :
28
35
return
29
36
30
- decls = parser .parse ([self .header ], self .config )
31
- global_ns = declarations .get_global_namespace (decls )
32
-
33
37
criteria = declarations .declaration_matcher (name = "yes1" )
34
- decls = declarations .matcher .find (criteria , global_ns )
38
+ decls = declarations .matcher .find (criteria , self . global_ns )
35
39
self .assertTrue (
36
40
declarations .smart_pointer_traits .is_smart_pointer (
37
41
decls [0 ].decl_type ))
38
42
43
+ criteria = declarations .declaration_matcher (name = "no1" )
44
+ decls = declarations .matcher .find (criteria , self .global_ns )
45
+ self .assertFalse (
46
+ declarations .smart_pointer_traits .is_smart_pointer (
47
+ decls [0 ].decl_type ))
48
+
49
+ criteria = declarations .declaration_matcher (name = "no2" )
50
+ decls = declarations .matcher .find (criteria , self .global_ns )
51
+ self .assertFalse (
52
+ declarations .smart_pointer_traits .is_smart_pointer (
53
+ decls [0 ].decl_type ))
54
+
55
+ def test_is_auto_pointer (self ):
56
+ """
57
+ Test auto_ptr_traits.is_smart_pointer method.
58
+
59
+ """
60
+
61
+ if self .config .xml_generator == "gccxml" :
62
+ return
63
+
39
64
criteria = declarations .declaration_matcher (name = "yes2" )
40
- decls = declarations .matcher .find (criteria , global_ns )
65
+ decls = declarations .matcher .find (criteria , self . global_ns )
41
66
self .assertTrue (
42
67
declarations .auto_ptr_traits .is_smart_pointer (decls [0 ].decl_type ))
43
68
44
69
criteria = declarations .declaration_matcher (name = "no1" )
45
- decls = declarations .matcher .find (criteria , global_ns )
70
+ decls = declarations .matcher .find (criteria , self . global_ns )
46
71
self .assertFalse (
47
72
declarations .auto_ptr_traits .is_smart_pointer (decls [0 ].decl_type ))
48
73
49
74
criteria = declarations .declaration_matcher (name = "no2" )
50
- decls = declarations .matcher .find (criteria , global_ns )
75
+ decls = declarations .matcher .find (criteria , self . global_ns )
51
76
self .assertFalse (
52
77
declarations .auto_ptr_traits .is_smart_pointer (decls [0 ].decl_type ))
53
78
79
+ def test_smart_pointer_value_type (self ):
80
+ """
81
+ Test smart_pointer_traits.value_type method.
82
+
83
+ """
84
+
85
+ if self .config .xml_generator == "gccxml" :
86
+ return
87
+
88
+ criteria = declarations .declaration_matcher (name = "yes1" )
89
+ decls = declarations .matcher .find (criteria , self .global_ns )
90
+ vt = declarations .smart_pointer_traits .value_type (decls [0 ].decl_type )
91
+ self .assertIsInstance (vt , declarations .int_t )
92
+
93
+ def test_auto_pointer_value_type (self ):
94
+ """
95
+ Test auto_pointer_traits.value_type method.
96
+
97
+ """
98
+
99
+ if self .config .xml_generator == "gccxml" :
100
+ return
101
+
102
+ criteria = declarations .declaration_matcher (name = "yes2" )
103
+ decls = declarations .matcher .find (criteria , self .global_ns )
104
+ vt = declarations .auto_ptr_traits .value_type (decls [0 ].decl_type )
105
+ self .assertIsInstance (vt , declarations .double_t )
106
+
54
107
55
108
def create_suite ():
56
109
suite = unittest .TestSuite ()
0 commit comments