mirror of
https://github.com/boostorg/contract.git
synced 2026-02-27 04:52:22 +00:00
testing public mebmer (virtual and static), constructor, and destructor
This commit is contained in:
39
test/introspect.cpp
Normal file
39
test/introspect.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
#include <boost/contract/introspect.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
struct w {};
|
||||
|
||||
struct z {
|
||||
char f(int) { return 'z'; }
|
||||
};
|
||||
|
||||
struct y {
|
||||
int f(char) { return -1; }
|
||||
};
|
||||
|
||||
struct x {
|
||||
int f(char) {
|
||||
BOOST_TEST((introspect_f::has_member_function<y, int,
|
||||
boost::mpl::vector<char> >::value));
|
||||
BOOST_TEST((!introspect_f::has_member_function<z, int,
|
||||
boost::mpl::vector<char> >::value));
|
||||
BOOST_TEST((!introspect_f::has_member_function<w, int,
|
||||
boost::mpl::vector<char> >::value));
|
||||
|
||||
BOOST_TEST((introspect_f::member_function_address<y,
|
||||
int (y::*)(char const)>() == &y::f));
|
||||
|
||||
return 'x';
|
||||
}
|
||||
private:
|
||||
BOOST_CONTRACT_INTROSPECT(f)
|
||||
};
|
||||
|
||||
int main() {
|
||||
x xx;
|
||||
xx.f('a');
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user