#!/usr/bin/python

import sys
import os.path
import time

# -- Test cases formatting function
#
def process(in_file, out_file, header):
	out_file.write('# Generated by script : ' + sys.argv[0] + ' on ' + time.asctime() + '\n');
	out_file.write('FILENAME: ' + sys.argv[1] + '\n');
	return

# -- Main function
#
def main(argv) :

	if len(argv) < 2 :
		print 'Usage ' + argv[0] + ' <filename>'
		return

	if not os.path.isfile(argv[1]) :
		print 'File not found: ' + argv[1];		

	in_file = open(argv[1],'r');
	header = in_file.readline();
	print 'Opened file ' + argv[1] + ' with header "' + header + '"';
	out_filename = argv[1] + '.tsc';
	print 'Test cases will be written to "' + out_filename + '"';
	try :
		out_file = open(argv[1] + '.tsc', 'w')
		process(in_file, out_file, header)
	except :
		print 'Exception occured while trying to open file for writing';
	finally :
		out_file.close()
	in_file.close()

	return;

# --------------
#
	
if __name__ == "__main__" :
	main(sys.argv)

