1 // Copyright Daniel Wallin 2009. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include <luabind/luabind.hpp>
8 // Test the following hierarchy:
77 // This hiearchy tries to prove that conversion and caching works for all sub
129 struct Derived
: Left
, Right
144 Base
* right(Right
* p
)
149 void test_main(lua_State
* L
)
151 using namespace luabind
;
160 class_
<U
, bases
<Y
, Z
> >("U")
161 .def(constructor
<int>()),
162 def("upcast", &upcast
)
165 // Do everything twice to verify that caching works.
168 "function assert2(x)\n"
176 "assert2(x:f() == 1)\n"
177 "assert2(x:g() == 2)\n"
178 "assert2(x:h() == 3)\n"
183 "assert2(y:f() == 1)\n"
184 "assert2(y:g() == 2)\n"
185 "assert2(y:h() == 3)\n"
189 class_
<Base
>("Base"),
190 class_
<Left
, Base
>("Left")
191 .def("left", &Left::left
),
192 class_
<Right
, Base
>("Right")
193 .def("right", &Right::right
),
194 class_
<Derived
, bases
<Left
, Right
> >("Derived")
195 .def(constructor
<>())
196 .def("f", &Derived::f
),
203 "assert2(x:left() == 1)\n"
204 "assert2(x:right() == 2)\n"
205 "assert2(x:f() == 3)\n"
210 "assert2(y:left() == 1)\n"
211 "assert2(y:right() == 2)\n"
212 "assert2(y:f() == 3)\n"
217 "assert2(y:left() == 1)\n"
218 "assert2(y:right() == 2)\n"
219 "assert2(y:f() == 3)\n"