@@ -17,37 +17,48 @@ 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
21
+
22
+ def setUp (self ):
23
+ decls = parser .parse ([self .header ], self .config )
24
+ self .global_ns = declarations .get_global_namespace (decls )
20
25
21
26
def test_smart_pointer (self ):
22
27
"""
23
- Test code in the smart_pointer_traits module .
28
+ Test smart_pointer_traits class .
24
29
25
30
"""
26
31
27
32
if self .config .xml_generator == "gccxml" :
28
33
return
29
34
30
- decls = parser .parse ([self .header ], self .config )
31
- global_ns = declarations .get_global_namespace (decls )
32
-
33
35
criteria = declarations .declaration_matcher (name = "yes1" )
34
- decls = declarations .matcher .find (criteria , global_ns )
36
+ decls = declarations .matcher .find (criteria , self . global_ns )
35
37
self .assertTrue (
36
38
declarations .smart_pointer_traits .is_smart_pointer (
37
39
decls [0 ].decl_type ))
38
40
41
+ def test_auto_pointer (self ):
42
+ """
43
+ Test auto_ptr_traits class.
44
+
45
+ """
46
+
47
+ if self .config .xml_generator == "gccxml" :
48
+ return
49
+
39
50
criteria = declarations .declaration_matcher (name = "yes2" )
40
- decls = declarations .matcher .find (criteria , global_ns )
51
+ decls = declarations .matcher .find (criteria , self . global_ns )
41
52
self .assertTrue (
42
53
declarations .auto_ptr_traits .is_smart_pointer (decls [0 ].decl_type ))
43
54
44
55
criteria = declarations .declaration_matcher (name = "no1" )
45
- decls = declarations .matcher .find (criteria , global_ns )
56
+ decls = declarations .matcher .find (criteria , self . global_ns )
46
57
self .assertFalse (
47
58
declarations .auto_ptr_traits .is_smart_pointer (decls [0 ].decl_type ))
48
59
49
60
criteria = declarations .declaration_matcher (name = "no2" )
50
- decls = declarations .matcher .find (criteria , global_ns )
61
+ decls = declarations .matcher .find (criteria , self . global_ns )
51
62
self .assertFalse (
52
63
declarations .auto_ptr_traits .is_smart_pointer (decls [0 ].decl_type ))
53
64
0 commit comments