diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/gcov/gcov-2.C')
-rw-r--r-- | gcc/testsuite/g++.dg/gcov/gcov-2.C | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-2.C b/gcc/testsuite/g++.dg/gcov/gcov-2.C new file mode 100644 index 000000000..66d8af39b --- /dev/null +++ b/gcc/testsuite/g++.dg/gcov/gcov-2.C @@ -0,0 +1,32 @@ +/* Verify line coverage counts for simple member functions. */ + +/* { dg-options "-fprofile-arcs -ftest-coverage" } */ +/* { dg-do run { target native } } */ + +class C { +public: + C() + { + i = 0; /* count(1) */ + } + ~C() {} + void seti (int j) + { + i = j; /* count(1) */ + } +private: + int i; +}; + +void foo() +{ + C c; /* count(1) */ + c.seti (1); /* count(1) */ +} + +int main() +{ + foo(); /* count(1) */ +} + +/* { dg-final { run-gcov gcov-2.C } } */ |