aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libsample
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-08-04 17:31:48 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:08 -0300
commit08f29f0d8f456eb1f994b05c21fd04468c95329c (patch)
tree857a3dee162eec94d3ffd624ec4fba3f7c5e21d8 /tests/libsample
parenteda3572089e71e0c5065831438c4999486838547 (diff)
Included tests for added function signatures very similar to already existing ones.
Specifically this causes the situation when there is in C++ a function with an argument that is a reference to a Value Type, and the user adds a very similar function with the same type, but passed as value. Example: C++ : function(const TYPE& a, int b) Added: function(TYPE) The return type of ShibokenGenerator::getArgumentReplacement() method was modified, because the argument object is more useful than its index.
Diffstat (limited to 'tests/libsample')
-rw-r--r--tests/libsample/samplenamespace.cpp13
-rw-r--r--tests/libsample/samplenamespace.h8
2 files changed, 18 insertions, 3 deletions
diff --git a/tests/libsample/samplenamespace.cpp b/tests/libsample/samplenamespace.cpp
index 0bcc5c2b2..922f26fa3 100644
--- a/tests/libsample/samplenamespace.cpp
+++ b/tests/libsample/samplenamespace.cpp
@@ -101,5 +101,16 @@ forceDecisorSideB(int a, const Point& pt, const Str& text, ObjectType* object)
{
}
-} // namespace SampleNamespace
+double
+passReferenceToValueType(const Point& point, double multiplier)
+{
+ return (point.x() + point.y()) * multiplier;
+}
+
+int
+passReferenceToObjectType(const ObjectType& obj, int multiplier)
+{
+ return obj.objectName().size() * multiplier;
+}
+} // namespace SampleNamespace
diff --git a/tests/libsample/samplenamespace.h b/tests/libsample/samplenamespace.h
index 3ac5b2601..e1578dc88 100644
--- a/tests/libsample/samplenamespace.h
+++ b/tests/libsample/samplenamespace.h
@@ -26,8 +26,7 @@
#include "libsamplemacros.h"
#include "str.h"
#include "point.h"
-
-class ObjectType;
+#include "objecttype.h"
// Anonymous global enum
enum {
@@ -130,6 +129,11 @@ LIBSAMPLE_API void forceDecisorSideA(const Point& pt, const Str& text, ObjectTyp
LIBSAMPLE_API void forceDecisorSideB(int a, ObjectType* object = 0);
LIBSAMPLE_API void forceDecisorSideB(int a, const Point& pt, const Str& text, ObjectType* object = 0);
+// Add a new signature on type system with only a Point value as parameter.
+LIBSAMPLE_API double passReferenceToValueType(const Point& point, double multiplier);
+// Add a new signature on type system with only a ObjectType pointer as parameter.
+LIBSAMPLE_API int passReferenceToObjectType(const ObjectType& obj, int multiplier);
+
} // namespace SampleNamespace
#endif // SAMPLENAMESPACE_H