diff options
author | Martin Schulze <MHL.Schulze@t-online.de> | 2003-03-05 17:34:24 +0000 |
---|---|---|
committer | Martin Schulze <teebaum@src.gnome.org> | 2003-03-05 17:34:24 +0000 |
commit | e95491c7aab5ed98b0566901a4b5ca0b6a9110e5 (patch) | |
tree | 6ae5a0086ca968638aab52df8557154dfac22968 /tests/test_size.cc | |
parent | 6a418adf5bb48eacbbb47a8cbf151fe74b1a158c (diff) | |
download | sigc++-e95491c7aab5ed98b0566901a4b5ca0b6a9110e5.tar.gz |
Add two test cases. test_size is showing the size of public and internal
2003-03-05 Martin Schulze <MHL.Schulze@t-online.de>
* tests/Makefile.am, tests/test_size.cc, tests/test_accumulated.cc:
Add two test cases. test_size is showing the size of public and
internal structures. (Which apart from empty signals are smaller
than the sizes of the equivalent libsigc++-1.2 structures.)
test_accumulated is a test for the template signal<>::accumulated<>
at the same time showing the use of accumulators in libsigc++2.
Diffstat (limited to 'tests/test_size.cc')
-rw-r--r-- | tests/test_size.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test_size.cc b/tests/test_size.cc new file mode 100644 index 0000000..02371f8 --- /dev/null +++ b/tests/test_size.cc @@ -0,0 +1,39 @@ +// -*- c++ -*- +/* Copyright 2002, The libsigc++ Development Team + * Assigned to public domain. Use as you wish without restriction. + */ + +#include <sigc++/trackable.h> +#include <sigc++/signal.h> +#include <sigc++/functors/ptr_fun.h> +#include <sigc++/functors/mem_fun.h> +#include <iostream> + +using namespace std; +using namespace sigc::functor; +using sigc::signal; + + +struct A { + void foo(); +}; + + +int main() +{ + cout << "sizes of public classes:" << endl; + + cout << " trackable: " << sizeof(sigc::trackable) << endl; + cout << " closure<void>: " << sizeof(closure<void>) << endl; + cout << " signal<void>: " << sizeof(signal<void>) << endl; + cout << " signal<void>::iterator: " << sizeof(signal<void>::iterator) << endl; + + + cout << endl << "sizes of internal classes:" << endl; + + cout << " trackable_dependency: " << sizeof(sigc::internal::trackable_dependency) << endl; + cout << " trackable_dep_list: " << sizeof(sigc::internal::trackable_dep_list) << endl; + cout << " closure_rep: " << sizeof(internal::closure_rep) << endl; + cout << " typed_closure_rep<mem_functor0<void,A> >: " + << sizeof(internal::typed_closure_rep<mem_functor0<void,A> >) << endl; +} |