1 : // Copyright 2013 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 :
15 : // NOTE: Do *NOT* modify line number because this file is used for testing end
16 : // to end coverage.
17 :
18 : // Avoid any optimization.
19 : #pragma optimize("", off)
20 :
21 m : int always_zero = 0;
22 m : int always_one = 1;
23 :
24 m : int coverage_func1() {
25 m : int sum = 2;
26 m : for (int i = 0; i < 10; ++i)
27 m : sum += 4 * i;
28 m : return sum;
29 m : }
30 :
31 m : int coverage_func2() {
32 m : int sum = 2;
33 m : if (always_one) {
34 m : for (int i = 0; i < 10; ++i)
35 m : sum += 4 * i;
36 m : } else {
37 : // This is never executed.
38 m : always_one = 0;
39 m : }
40 m : return sum;
41 m : }
42 :
43 m : int coverage_func3() {
44 m : int sum = 2;
45 m : if (always_zero) {
46 : // This is never executed.
47 m : for (int i = 0; i < 10; ++i)
48 m : sum += 4 * i;
49 m : } else {
50 m : always_one = 0;
51 m : }
52 m : return sum;
53 m : }
|