[pygccxml-commit] SF.net SVN: pygccxml: [468] pyplusplus_dev/unittests/data
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2006-08-25 18:24:31
|
Revision: 468 Author: roman_yakovenko Date: 2006-08-25 11:24:08 -0700 (Fri, 25 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=468&view=rev Log Message: ----------- Fixing AttributeError bug, adding test cases Modified Paths: -------------- pyplusplus_dev/unittests/data/member_variables_to_be_exported.cpp pyplusplus_dev/unittests/data/member_variables_to_be_exported.hpp Modified: pyplusplus_dev/unittests/data/member_variables_to_be_exported.cpp =================================================================== --- pyplusplus_dev/unittests/data/member_variables_to_be_exported.cpp 2006-08-25 18:23:07 UTC (rev 467) +++ pyplusplus_dev/unittests/data/member_variables_to_be_exported.cpp 2006-08-25 18:24:08 UTC (rev 468) @@ -1,45 +1,44 @@ -// Copyright 2004 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) - -#include "member_variables_to_be_exported.hpp" - -namespace member_variables{ - -int point::instance_count = 0; -const point::color point::default_color = point::red; - -unsigned int get_a(const bit_fields_t& inst){ - return inst.a; -} - -void set_a( bit_fields_t& inst, unsigned int new_value ){ - inst.a = new_value; -} - -unsigned int get_b(const bit_fields_t& inst){ - return inst.b; -} - -namespace pointers{ - -std::auto_ptr<tree_node_t> create_tree(){ - std::auto_ptr<tree_node_t> root( new tree_node_t() ); - root->data = new data_t(); - root->data->value = 0; - - root->left = new tree_node_t( root.get() ); - root->left->data = new data_t(); - root->left->data->value = 1; - - return root; -} - -} +// Copyright 2004 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) +#include "member_variables_to_be_exported.hpp" + +namespace member_variables{ + +int point::instance_count = 0; +const point::color point::default_color = point::red; + +unsigned int get_a(const bit_fields_t& inst){ + return inst.a; +} + +void set_a( bit_fields_t& inst, unsigned int new_value ){ + inst.a = new_value; +} + +unsigned int get_b(const bit_fields_t& inst){ + return inst.b; +} + +namespace pointers{ + +std::auto_ptr<tree_node_t> create_tree(){ + std::auto_ptr<tree_node_t> root( new tree_node_t() ); + root->data = new data_t(); + root->data->value = 0; + + root->left = new tree_node_t( root.get() ); + root->left->data = new data_t(); + root->left->data->value = 1; + + return root; +} + +} + namespace statics{ std::string mem_var_str_t::class_name( "mem_var_str_t" ); -} -} - +} +} Modified: pyplusplus_dev/unittests/data/member_variables_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/member_variables_to_be_exported.hpp 2006-08-25 18:23:07 UTC (rev 467) +++ pyplusplus_dev/unittests/data/member_variables_to_be_exported.hpp 2006-08-25 18:24:08 UTC (rev 468) @@ -1,139 +1,139 @@ -// Copyright 2004 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) - -#ifndef __member_variables_to_be_exported_hpp__ -#define __member_variables_to_be_exported_hpp__ -#include <memory> +// Copyright 2004 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) + +#ifndef __member_variables_to_be_exported_hpp__ +#define __member_variables_to_be_exported_hpp__ +#include <memory> #include <string> - -namespace member_variables{ - -struct point{ - enum color{ red, green, blue }; - - point() - : prefered_color( blue ) - , x( -1 ) - , y( 2 ) - {++instance_count;} - - point( const point& other ) - : prefered_color( other.prefered_color ) - , x( other.x ) - , y( other.y ) - {} - - ~point() - { --instance_count; } - - int x; - int y; - const color prefered_color; - static int instance_count; - static const color default_color; -}; - -struct bit_fields_t{ - bit_fields_t() - : b(28){} - unsigned int a : 1; - unsigned int : 0; - const unsigned int b : 11; -}; - -unsigned int get_a(const bit_fields_t& inst); -void set_a( bit_fields_t& inst, unsigned int new_value ); -unsigned int get_b(const bit_fields_t& inst); - -struct array_t{ - array_t(){ - for( int i = 0; i < 10; ++i ){ - ivars[i] = -i; - } - } - - struct variable_t{ - variable_t() : value(-9){} - int value; - }; - - int get_ivars_item( int index ){ - return ivars[index]; - } - - const variable_t vars[3]; - int ivars[10]; - int ivars2[10]; -}; - -namespace pointers{ - -struct data_t{ - data_t() : value( 201 ) {} - int value; - static char* reserved; -}; - -struct tree_node_t{ - data_t *data; - tree_node_t *left; - tree_node_t *right; - const tree_node_t *parent; - - tree_node_t(const tree_node_t* parent=0) - : data(0) - , left( 0 ) - , right( 0 ) - , parent( parent ) - {} - - ~tree_node_t(){ - if( left ){ - delete left; - } - if( right ){ - delete right; - } - if( data ){ - delete data; - } - } -}; - -std::auto_ptr<tree_node_t> create_tree(); - -} - -namespace reference{ - -enum EFruit{ apple, orange }; - -struct fundamental_t{ - fundamental_t( EFruit& fruit, const int& i ) - : m_fruit( fruit ), m_i( i ) - {} - - EFruit& m_fruit; - const int& m_i; -}; - -struct A{}; - - -struct B { - B( A& a_ ): a( a_ ){} - A& a; -}; - -struct C { - C( A& a_ ): a( a_ ){} - const A& a; -}; -} +namespace member_variables{ +struct point{ + enum color{ red, green, blue }; + + point() + : prefered_color( blue ) + , x( -1 ) + , y( 2 ) + {++instance_count;} + + point( const point& other ) + : prefered_color( other.prefered_color ) + , x( other.x ) + , y( other.y ) + {} + + ~point() + { --instance_count; } + + int x; + int y; + const color prefered_color; + static int instance_count; + static const color default_color; +}; + +struct bit_fields_t{ + bit_fields_t() + : b(28){} + unsigned int a : 1; + unsigned int : 0; + const unsigned int b : 11; +}; + +unsigned int get_a(const bit_fields_t& inst); +void set_a( bit_fields_t& inst, unsigned int new_value ); +unsigned int get_b(const bit_fields_t& inst); + +struct array_t{ + array_t(){ + for( int i = 0; i < 10; ++i ){ + ivars[i] = -i; + } + } + + struct variable_t{ + variable_t() : value(-9){} + int value; + }; + + int get_ivars_item( int index ){ + return ivars[index]; + } + + const variable_t vars[3]; + int ivars[10]; + int ivars2[10]; +}; + +namespace pointers{ + +struct data_t{ + data_t() : value( 201 ) {} + int value; + static char* reserved; +}; + +struct tree_node_t{ + data_t *data; + tree_node_t *left; + tree_node_t *right; + const tree_node_t *parent; + + tree_node_t(const tree_node_t* parent=0) + : data(0) + , left( 0 ) + , right( 0 ) + , parent( parent ) + {} + + ~tree_node_t(){ + if( left ){ + delete left; + } + if( right ){ + delete right; + } + if( data ){ + delete data; + } + } +}; + +std::auto_ptr<tree_node_t> create_tree(); + +} + +namespace reference{ + +enum EFruit{ apple, orange }; + +struct fundamental_t{ + fundamental_t( EFruit& fruit, const int& i ) + : m_fruit( fruit ), m_i( i ) + {} + + EFruit& m_fruit; + const int& m_i; +}; + +struct A{}; + + +struct B { + B( A& a_ ): a( a_ ){} + A& a; +}; + +struct C { + C( A& a_ ): a( a_ ){} + const A& a; +}; + +} + namespace statics{ struct mem_var_str_t{ @@ -142,6 +142,20 @@ }; } - -} -#endif//__member_variables_to_be_exported_hpp__ + +namespace bugs{ +struct allocator_ { + void * (*alloc) (unsigned); + void (*dispose) (void *p); +}; + +typedef struct allocator_ *allocator_t; + +struct faulty { + allocator_t allocator; +}; + +} + +} +#endif//__member_variables_to_be_exported_hpp__ \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |