1/* Test-file for coding style checker
2 * Copyright 2010, Haiku, Inc.
3 * Distributed under the terms of the MIT Licence
4 */
5
6
7// DETECTED problems
8
9
10// Line longer than 80 chars
11int
12someveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongFunctionName( int aLongParameter)
13{
14	// Identantion with spaces instead of tabs
15 	int a;
16	 int b;
17	 	int c;
18
19	// Missing space after control statement
20	if(condition);
21
22	//Missing space at comment start
23
24	// Operator without spaces
25	if (a>b);
26
27	// Operator at end of line
28	if (a >
29		b)
30	j =
31		k +
32		i;
33
34	// Wrong line breaks around else
35	if (test)
36	{
37	}
38	else
39	{
40	}
41	// Less than two lines between functions
42}
43
44// Missing space before opening brace
45int
46aFunction(char param){
47	// More than two lines between blocks
48}
49
50
51
52// CORRECT things that should not be detected as violations
53#include <dir/path.h>
54	// Not matched by 'operator at end of line'
55
56
57// Below this are FALSE POSITIVES (think of it as a TODO list)
58// Test-file
59	// Matched by 'space around operator' (should not be matched in comments)
60
61
62// NOT DETECTED violations
63int func()
64{
65	if (a)
66	{
67		// The brace should be on the same line as the if
68	}
69
70	// Everything related to naming conventions
71}
72