From 87b9c4f66d489b92efea36707f0cd7c4c267f25c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20J=C3=A4rvi?= Date: Tue, 20 Nov 2001 22:03:25 +0000 Subject: [PATCH] added ll_sizeof tests [SVN r11750] --- test/cast_test.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/cast_test.cpp b/test/cast_test.cpp index 83c5b1f..773ffd2 100644 --- a/test/cast_test.cpp +++ b/test/cast_test.cpp @@ -1,4 +1,4 @@ -// constructor_tests.cpp -------------------------------- +// cast_tests.cpp -------------------------------- #define BOOST_INCLUDE_MAIN // for testing, include rather than link #include // see "Header Implementation Option" @@ -22,6 +22,7 @@ public: }; class derived : public base { + int y[100]; public: virtual std::string class_name() const { return "const derived"; } virtual std::string class_name() { return "derived"; } @@ -66,12 +67,26 @@ int do_test() { (var(ip) = ll_reinterpret_cast(cp))(); BOOST_TEST(*ip == 10); + + // typeid + BOOST_TEST(string(ll_typeid(d)().name()) == string(typeid(d).name())); + // sizeof + + BOOST_TEST(ll_sizeof(_1)(p_derived) == sizeof(p_derived)); + BOOST_TEST(ll_sizeof(_1)(*p_derived) == sizeof(*p_derived)); + BOOST_TEST(ll_sizeof(_1)(p_base) == sizeof(p_base)); + BOOST_TEST(ll_sizeof(_1)(*p_base) == sizeof(*p_base)); + + int an_array[100]; + BOOST_TEST(ll_sizeof(_1)(an_array) == 100 * sizeof(int)); + delete p_derived; delete p_base; + } int test_main(int, char *[]) {