Update of /cvsroot/luabind/luabind/luabind/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14830/test
Modified Files:
Tag: beta7-devel2
test_operators.cpp
Log Message:
fixed bug in the const-pointer and const-reference matchers returning perfect matches for some non-matches
Index: test_operators.cpp
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/test/test_operators.cpp,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -d -r1.15 -r1.15.2.1
--- test_operators.cpp 15 Apr 2005 13:46:17 -0000 1.15
+++ test_operators.cpp 25 Oct 2005 22:57:47 -0000 1.15.2.1
@@ -51,9 +51,18 @@
{
return 2.5f + a;
}
-
};
+float operator*(operator_tester const& lhs, operator_tester const& rhs)
+{
+ return 35.f;
+}
+
+std::string operator*(operator_tester const&, int v)
+{
+ return "(operator_tester, int) overload";
+}
+
int operator+(int a, const operator_tester&)
{
return 2 + a;
@@ -101,11 +110,14 @@
.def(self + int())
.def(other<int>() + self)
.def(-self)
- .def(self + other<operator_tester2&>())
+ .def(self + other<operator_tester2&>())
.def(self())
.def(const_self(int()))
.def(self(int()))
- .def(tostring(const_self)),
+ .def(tostring(const_self))
+// .def(const_self * other<operator_tester const&>())
+ .def(const_self * const_self)
+ .def(const_self * other<int>()),
// .def("clone", &clone, adopt(return_value)),
class_<operator_tester2>("operator_tester2")
@@ -134,6 +146,8 @@
DOSTRING(L, "assert(test(5) == 2.5 + 5)");
DOSTRING(L, "assert(-test == 46)");
+ DOSTRING(L, "assert(test * test == 35)");
+ DOSTRING(L, "assert(test * 3 == '(operator_tester, int) overload')")
DOSTRING(L, "assert(test + test2 == 73)");
DOSTRING(L, "assert(2 + test == 2 + 2)");
DOSTRING(L, "assert(test + 2 == 1 + 2)");
|