1515 "vector_traits.hpp" ,
1616]
1717
18+ import logging
19+ #from pygccxml import utils
20+ #utils.loggers.set_level(logging.DEBUG)
21+
1822
1923@pytest .fixture
2024def global_ns ():
2125 COMPILATION_MODE = parser .COMPILATION_MODE .ALL_AT_ONCE
2226 INIT_OPTIMIZER = True
2327 config = autoconfig .cxx_parsers_cfg .config .clone ()
28+ config .keep_xml = True
2429 # TOOD: this breaks the tests, check why
2530 # config.castxml_epic_version = 1
2631 decls = parser .parse (TEST_FILES , config , COMPILATION_MODE )
@@ -30,59 +35,60 @@ def global_ns():
3035 return global_ns
3136
3237
33- def validate_yes (value_type , container ):
34- traits = declarations .vector_traits
35- assert traits .is_my_case (container ) is True
36- assert declarations .is_same (
37- value_type ,
38- traits .element_type (container )) is True
39- assert traits .is_sequence (container ) is True
40-
41-
42- def test_global_ns (global_ns ):
43- value_type = global_ns .class_ ('_0_' )
44- container = global_ns .typedef ('container' , recursive = False )
45- validate_yes (value_type , container )
46-
47-
48- def test_yes (global_ns ):
49- yes_ns = global_ns .namespace ('yes' )
50- for struct in yes_ns .classes ():
51- if not struct .name .startswith ('_' ):
52- continue
53- if not struct .name .endswith ('_' ):
54- continue
55- validate_yes (
56- struct .typedef ('value_type' ),
57- struct .typedef ('container' ))
58-
59-
60- def test_no (global_ns ):
61- traits = declarations .vector_traits
62- no_ns = global_ns .namespace ('no' )
63- for struct in no_ns .classes ():
64- if not struct .name .startswith ('_' ):
65- continue
66- if not struct .name .endswith ('_' ):
67- continue
68- assert traits .is_my_case (struct .typedef ('container' )) is False
69-
70-
71- def test_declaration ():
72- cnt = (
73- 'std::vector<std::basic_string<char, std::char_traits<char>, ' +
74- 'std::allocator<char>>,std::allocator<std::basic_string<char, ' +
75- 'std::char_traits<char>, std::allocator<char>>>>' +
76- '@::std::vector<std::basic_string<char, std::char_traits<char>, ' +
77- 'std::allocator<char>>, std::allocator<std::basic_string<char, ' +
78- 'std::char_traits<char>, std::allocator<char>>>>' )
79- traits = declarations .find_container_traits (cnt )
80- assert declarations .vector_traits == traits
38+ # def validate_yes(value_type, container):
39+ # traits = declarations.vector_traits
40+ # assert traits.is_my_case(container) is True
41+ # assert declarations.is_same(
42+ # value_type,
43+ # traits.element_type(container)) is True
44+ # assert traits.is_sequence(container) is True
45+
46+
47+ # def test_global_ns(global_ns):
48+ # value_type = global_ns.class_('_0_')
49+ # container = global_ns.typedef('container', recursive=False)
50+ # validate_yes(value_type, container)
51+
52+
53+ # def test_yes(global_ns):
54+ # yes_ns = global_ns.namespace('yes')
55+ # for struct in yes_ns.classes():
56+ # if not struct.name.startswith('_'):
57+ # continue
58+ # if not struct.name.endswith('_'):
59+ # continue
60+ # validate_yes(
61+ # struct.typedef('value_type'),
62+ # struct.typedef('container'))
63+
64+
65+ # def test_no(global_ns):
66+ # traits = declarations.vector_traits
67+ # no_ns = global_ns.namespace('no')
68+ # for struct in no_ns.classes():
69+ # if not struct.name.startswith('_'):
70+ # continue
71+ # if not struct.name.endswith('_'):
72+ # continue
73+ # assert traits.is_my_case(struct.typedef('container')) is False
74+
75+
76+ # def test_declaration():
77+ # cnt = (
78+ # 'std::vector<std::basic_string<char, std::char_traits<char>, ' +
79+ # 'std::allocator<char>>,std::allocator<std::basic_string<char, ' +
80+ # 'std::char_traits<char>, std::allocator<char>>>>' +
81+ # '@::std::vector<std::basic_string<char, std::char_traits<char>, ' +
82+ # 'std::allocator<char>>, std::allocator<std::basic_string<char, ' +
83+ # 'std::char_traits<char>, std::allocator<char>>>>')
84+ # traits = declarations.find_container_traits(cnt)
85+ # assert declarations.vector_traits == traits
8186
8287
8388def test_element_type (global_ns ):
8489 do_nothing = global_ns .free_function ('do_nothing' )
8590 v = declarations .remove_reference (
8691 declarations .remove_declarated (
8792 do_nothing .arguments [0 ].decl_type ))
93+ print ("v" , v )
8894 declarations .vector_traits .element_type (v )
0 commit comments