Skip to content

Commit

Permalink
Add Test For C++ Namespaces
Browse files Browse the repository at this point in the history
Fixes #9
  • Loading branch information
fundamental committed Mar 13, 2015
1 parent 84983f6 commit d179ee9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,15 @@ add_test(lambda-call
${SRC}/test/lambda-call.cpp)
set_property(TEST lambda-call PROPERTY PASS_REGULAR_EXPRESSION
"malloc_of_doooooooooom.* : Assumed Unsafe")

add_test(namespace-disambiguation
${RUBY} ${CMAKE_SOURCE_DIR}/test/run-test.rb
${CMAKE_SOURCE_DIR}/stoat
${CMAKE_BINARY_DIR}/libstoat.so
${CLANGPP}
${CMAKE_SOURCE_DIR}/data/whitelist.txt
${CMAKE_SOURCE_DIR}/data/blacklist.txt
nil
${SRC}/test/namespaces.cpp)
set_property(TEST namespace-disambiguation PROPERTY PASS_REGULAR_EXPRESSION
"Total of 2 error")
26 changes: 26 additions & 0 deletions test/namespaces.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace A {
class aa {
public:
virtual int doStuff() __attribute__((annotate("realtime"))) {return 1;}
};
}

namespace B {
class bb: public A::aa{
public:
int doStuff() __attribute__((annotate("realtime"))) {return 2;}
};
}

class cc:public B::bb
{
public:
int doStuff() __attribute__((annotate("non-realtime"))) {return 3;}
};

int main() __attribute__((annotate("realtime")))
{
B::bb *B = new cc;
B->doStuff();
return 0;
}

0 comments on commit d179ee9

Please sign in to comment.