This is too many test. So i write a simply testing program.
You should create 4 files:
/* --------------- testgen.c -----------------*/
#include <stdio.h>
#include <process.h>
#include <string.h>
char S[ 123 ], A[ 123 ];
int main()
{
int i;
freopen( "tests.txt", "rt", stdin );
for( i = 1; scanf( "%[^\n]%*c", S ) != EOF; i++ )
{
sprintf( A, "1216in.%d", i );
freopen( A, "wt", stdout );
printf( "%s\n", S );
scanf( "%[^\n]%*c", S );
printf( "%s\n", S );
fclose( stdout );
sprintf( A, "1216ans.%d", i );
freopen( A, "wt", stdout );
scanf( "%[^\n]%*c", S );
printf( "%s\n", S );
fclose( stdout );
}
fclose( stdin );
return 0;
}
/* ---------------- tester.c -------------------*/
#include <stdio.h>
#include <stdlib.h>
char S[ 123 ], A[ 123 ];
int main( int count, char *arg[] )
{
int i, j;
j = atoi( arg[ 1 ] );
freopen( "1216test.bat", "wt", stdout );
for( i = 1; i <= j; i++ )
{
printf( "call 1216.bat %d\n", i );
}
fclose( stdout );
return 0;
}
/* -------------------- checker.c ---------------- */
#include <stdio.h>
#include <string.h>
char Ans[ 123 ], Out[ 123 ];
int main( int count, char *arg[] )
{
FILE *fans = fopen( arg[ 1 ], "rt" );
FILE *fout = fopen( arg[ 2 ], "rt" );
fscanf( fans, "%[^\n]", Ans );
fscanf( fout, "%[^\n]", Out );
if( strcmp( Ans, Out ) == 0 )
printf( "%s: Ok\n", arg[ 3 ] );
else
printf( "%s: Wrong answer\n", arg[ 3 ] );
fclose( fans );
fclose( fout );
return 0;
}
/* -------------- 1216.bat ----------------- */
1216.exe <1216in.%1 >1216out.%1
checker.exe 1216ans.%1 1216out.%1 %1
Copy all tests to tests.txt without count (number 232). Then compile testgen.c and execute. It delimit this test to separated files. Then compile tester.c and execute with count by parameter. It generate 1216test.bat. Then execute 1216test.bat and enjoy. ::) Be sure what you 1216.exe is in the same directory.
Edited by author 14.10.2005 18:24