diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-02-20 17:31:24 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-02-20 18:20:32 -0300 |
commit | 92a957859814d40d86e7e1287ec1b9c2b717a923 (patch) | |
tree | ac5fd509990fc5e952dc5230ad37be34f039c74d /tests/libsample | |
parent | 75507160e33339291d391cbdd0893fc0c9d4d3f5 (diff) |
Adds test for C++ 'const char*' argument receiving a Python None as a null pointer.
The test function 'countCharacters(const char*)' now returns -1 when
receiving a null pointer.
Diffstat (limited to 'tests/libsample')
-rw-r--r-- | tests/libsample/functions.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/libsample/functions.cpp b/tests/libsample/functions.cpp index d02b7a19d..aebd9b83b 100644 --- a/tests/libsample/functions.cpp +++ b/tests/libsample/functions.cpp @@ -85,6 +85,8 @@ multiplyPair(std::pair<double, double> pair) int countCharacters(const char* text) { + if (!text) + return -1; int count; for(count = 0; text[count] != '\0'; count++) ; @@ -176,3 +178,4 @@ acceptDouble(double x) { return x; } + |