[pygccxml-commit] SF.net SVN: pygccxml:[1819] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2010-01-26 20:37:04
|
Revision: 1819 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1819&view=rev Author: roman_yakovenko Date: 2010-01-26 20:36:57 +0000 (Tue, 26 Jan 2010) Log Message: ----------- add new test case and bit fields size to the decl_printer Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/decl_printer.py pygccxml_dev/unittests/test_all.py Added Paths: ----------- pygccxml_dev/unittests/gccxml10184_tester.py Modified: pygccxml_dev/pygccxml/declarations/decl_printer.py =================================================================== --- pygccxml_dev/pygccxml/declarations/decl_printer.py 2010-01-26 20:14:05 UTC (rev 1818) +++ pygccxml_dev/pygccxml/declarations/decl_printer.py 2010-01-26 20:36:57 UTC (rev 1819) @@ -262,6 +262,10 @@ self.writer( ' ' * curr_level * self.INDENT_SIZE + 'type: %s' % self.__inst.type.decl_string + os.linesep) self.writer( ' ' * curr_level * self.INDENT_SIZE + 'value: %s' % self.__inst.value + os.linesep) if self.__print_details: + if self.__inst.bits: + bits = 'bits: %d'%(self.__inst.bits) + self.writer( ' ' * curr_level * self.INDENT_SIZE + bits.ljust( self.JUSTIFY ) + os.linesep) + byte_size = 'size: %d'%(self.__inst.type.byte_size) self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_size.ljust( self.JUSTIFY ) + os.linesep) try: Added: pygccxml_dev/unittests/gccxml10184_tester.py =================================================================== --- pygccxml_dev/unittests/gccxml10184_tester.py (rev 0) +++ pygccxml_dev/unittests/gccxml10184_tester.py 2010-01-26 20:36:57 UTC (rev 1819) @@ -0,0 +1,45 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +import sys +import unittest +import autoconfig +import parser_test_case + +from pygccxml import utils +from pygccxml import parser +from pygccxml import declarations + +code = \ +""" +class A { +public: + virtual ~A() = 0; + unsigned int a : 1; + unsigned int unused : 31; +}; +""" + +class tester_t( parser_test_case.parser_test_case_t ): + def __init__(self, *args): + parser_test_case.parser_test_case_t.__init__(self, *args) + + def test(self): + src_reader = parser.source_reader_t( self.config ) + global_ns = declarations.get_global_namespace( src_reader.read_string( code ) ) + self.failUnless( global_ns.var( 'a' ).bits == 1 ) + self.failUnless( global_ns.var( 'unused' ).bits == 31 ) + +def create_suite(): + suite = unittest.TestSuite() + suite.addTest( unittest.makeSuite(tester_t)) + return suite + +def run_suite(): + unittest.TextTestRunner(verbosity=2).run( create_suite() ) + +if __name__ == "__main__": + run_suite() Modified: pygccxml_dev/unittests/test_all.py =================================================================== --- pygccxml_dev/unittests/test_all.py 2010-01-26 20:14:05 UTC (rev 1818) +++ pygccxml_dev/unittests/test_all.py 2010-01-26 20:36:57 UTC (rev 1819) @@ -55,8 +55,9 @@ import calling_convention_tester import const_volatile_arg_tester import array_bug_tester +import gccxml10183_tester +import gccxml10184_tester import gccxml10185_tester -import gccxml10183_tester testers = [ decl_string_tester @@ -108,8 +109,9 @@ , calling_convention_tester , const_volatile_arg_tester , array_bug_tester - , gccxml10185_tester - , gccxml10183_tester + , gccxml10183_tester + , gccxml10184_tester + , gccxml10185_tester ] def create_suite(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |