1 /*
2  *  typespeed - measures your typing speed
3  *  Copyright (C) 1999-2003   Jani Ollikainen  <bestis@iki.fi>
4  *                          & Jaakko Manelius  <jman@iki.fi>
5  *  Copyright (C) 2006-2007   Tobias Stoeckmann  <tobias@bugol.de>
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 
22 #ifdef HAVE_CONFIG_H
23 	#include "config.h"
24 #endif /* HAVE_CONFIG_H */
25 
26 #include <stdio.h>
27 
28 #ifdef HAVE_STDLIB_H
29 	#include <stdlib.h>
30 #endif /* HAVE_STDLIB_H */
31 
32 extern int level(int);
33 
34 short color;
35 
36 void
xcolor_set(short a)37 xcolor_set(short a)
38 {
39 	color = a;
40 }
41 
42 int
main(void)43 main(void)
44 {
45 	int a, e, i;
46 
47 	for (color = -1, i = -1; i < 900; i++) {
48 		e = 0;
49 		a = level(i);
50 
51 		if (i < 0 && a == 0)
52 			continue;
53 		if (i > 900 && a == 10)
54 			continue;
55 
56 		switch(a) {
57 		case 0:
58 			if (i > 0 || color != 6)
59 				e = 1;
60 			break;
61 		case 1:
62 			if (i < 0 || i > 100 || color != 6)
63 				e = 1;
64 			break;
65 		case 2:
66 			if (i < 100 || i > 200 || color != 6)
67 				e = 1;
68 			break;
69 		case 3:
70 			if (i < 200 || i > 300 || color != 6)
71 				e = 1;
72 			break;
73 		case 4:
74 			if (i < 300 || i > 400 || color != 6)
75 				e = 1;
76 			break;
77 		case 5:
78 			if (i < 400 || i > 500 || color != 1)
79 				e = 1;
80 			break;
81 		case 6:
82 			if (i < 500 || i > 600 || color != 1)
83 				e = 1;
84 			break;
85 		case 7:
86 			if (i < 600 || i > 700 || color != 7)
87 				e = 1;
88 			break;
89 		case 8:
90 			if (i < 700 || i > 800 || color != 3)
91 				e = 1;
92 			break;
93 		case 9:
94 			if (i < 800 || i > 900 || color != 3)
95 				e = 1;
96 			break;
97 		case 10:
98 			if (i < 900 || color != 3)
99 				e = 1;
100 			break;
101 		default:
102 			e = 1;
103 			break;
104 		}
105 		if (e)
106 			fprintf(stderr, "error: %d -> %d\n", i, a);
107 	}
108 
109 	return EXIT_SUCCESS;
110 }
111 
112