Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: third_party/lcov-1.9/example/example.c

Issue 23189008: Upgrades lcov to 1.10, removes lcov-1.9 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-adds UNKNOWN suppression Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/lcov-1.9/example/descriptions.txt ('k') | third_party/lcov-1.9/example/gauss.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * example.c
3 *
4 * Calculate the sum of a given range of integer numbers. The range is
5 * specified by providing two integer numbers as command line argument.
6 * If no arguments are specified, assume the predefined range [0..9].
7 * Abort with an error message if the resulting number is too big to be
8 * stored as int variable.
9 *
10 * This program example is similar to the one found in the GCOV documentation.
11 * It is used to demonstrate the HTML output generated by LCOV.
12 *
13 * The program is split into 3 modules to better demonstrate the 'directory
14 * overview' function. There are also a lot of bloated comments inserted to
15 * artificially increase the source code size so that the 'source code
16 * overview' function makes at least a minimum of sense.
17 *
18 */
19
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include "iterate.h"
23 #include "gauss.h"
24
25 static int start = 0;
26 static int end = 9;
27
28
29 int main (int argc, char* argv[])
30 {
31 int total1, total2;
32
33 /* Accept a pair of numbers as command line arguments. */
34
35 if (argc == 3)
36 {
37 start = atoi(argv[1]);
38 end = atoi(argv[2]);
39 }
40
41
42 /* Use both methods to calculate the result. */
43
44 total1 = iterate_get_sum (start, end);
45 total2 = gauss_get_sum (start, end);
46
47
48 /* Make sure both results are the same. */
49
50 if (total1 != total2)
51 {
52 printf ("Failure (%d != %d)!\n", total1, total2);
53 }
54 else
55 {
56 printf ("Success, sum[%d..%d] = %d\n", start, end, total1);
57 }
58
59 return 0;
60 }
OLDNEW
« no previous file with comments | « third_party/lcov-1.9/example/descriptions.txt ('k') | third_party/lcov-1.9/example/gauss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698