[luabind-cvs] luabind/luabind/test test_object.cpp,1.28.2.1,1.28.2.2
Brought to you by:
arvidn,
daniel_wallin
From: Arvid N. <ar...@us...> - 2005-12-30 16:57:45
|
Update of /cvsroot/luabind/luabind/luabind/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23283/luabind/test Modified Files: Tag: luabind_rc_0_7 test_object.cpp Log Message: now allows comparison of uninitialized objects Index: test_object.cpp =================================================================== RCS file: /cvsroot/luabind/luabind/luabind/test/test_object.cpp,v retrieving revision 1.28.2.1 retrieving revision 1.28.2.2 diff -u -d -r1.28.2.1 -r1.28.2.2 --- test_object.cpp 30 Dec 2005 00:04:39 -0000 1.28.2.1 +++ test_object.cpp 30 Dec 2005 16:57:37 -0000 1.28.2.2 @@ -26,6 +26,7 @@ #include <luabind/adopt_policy.hpp> #include <luabind/detail/debug.hpp> #include <luabind/error.hpp> +#include <luabind/operator.hpp> #include <utility> @@ -87,6 +88,9 @@ { luabind::object obj; luabind::object obj2; + + bool operator==(test_param const& rhs) const + { return obj == rhs.obj && obj2 == rhs.obj2; } }; COUNTER_GUARD(test_param); @@ -127,6 +131,7 @@ .def(constructor<>()) .def_readwrite("obj", &test_param::obj) .def_readonly("obj2", &test_param::obj2) + .def(const_self == const_self) ]; object uninitialized; @@ -135,7 +140,10 @@ test_param temp_object; globals(L)["temp"] = temp_object; + TEST_CHECK(object_cast<test_param>(globals(L)["temp"]) == temp_object); globals(L)["temp"] = &temp_object; + TEST_CHECK(object_cast<test_param const*>(globals(L)["temp"]) == &temp_object); + TEST_CHECK(globals(L)["temp"] == temp_object); DOSTRING(L, "t = 2\n" |