Created new subtree for groups of related test programs.
[reactos.git] / reactos / apps / testsets / msvcrt / fileio / main.c
1 /*
2 * ReactOS test program -
3 *
4 * main.c
5 *
6 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #define WIN32_LEAN_AND_MEAN
24 #include <windows.h>
25 #include <tchar.h>
26 #include <wchar.h>
27 #include <stdio.h>
28
29 #include "main.h"
30
31
32 #define VERSION "1.00"
33 #ifdef UNICODE
34 #define TARGET "UNICODE"
35 #else
36 #define TARGET "MBCS"
37 #endif
38
39
40 #define TEST_BUFFER_SIZE 200
41
42 TCHAR test_buffer[TEST_BUFFER_SIZE];
43 BOOL verbose_flagged = 0;
44
45
46 int usage(char* argv0)
47 {
48 printf("USAGE:\n");
49 printf("\t%s clean - delete test output files\n", argv0);
50 printf("\t%s test_number [unicode][ansi]\n", argv0);
51 return 0;
52 }
53
54 int __cdecl main(int argc, char* argv[])
55 {
56 int test_num = 0;
57 int result = 0;
58
59 printf("%s test application - build %s (%s)\n", argv[0], VERSION, TARGET);
60 if (argc < 2) {
61 return usage(argv[0]);
62 }
63 if (argc > 1) {
64 if (strstr(argv[1], "clean") || strstr(argv[1], "clean")) {
65 #ifdef UNICODE
66 return test_unicode_files(-1);
67 #else
68 return test_ansi_files(-1);
69 #endif
70 }
71 test_num = atoi(argv[1]);
72 }
73 if (argc > 2) {
74 if (argc > 3) {
75 verbose_flagged = 1;
76 }
77 if (strstr(argv[2], "ansi") || strstr(argv[2], "ANSI")) {
78 result = test_ansi_files(test_num);
79 } else if (strstr(argv[2], "unicode") || strstr(argv[2], "UNICODE")) {
80 result = test_unicode_files(test_num);
81 } else {
82 result = test_ansi_files(test_num);
83 result = test_unicode_files(test_num);
84 }
85 } else {
86 #ifdef UNICODE
87 result = test_unicode_files(test_num);
88 #else
89 result = test_ansi_files(test_num);
90 #endif
91 }
92 printf("finished\n");
93 return result;
94 }
95