source: trunk/symbol_table/test/gen_test_file.py @ 3028

Last change on this file since 3028 was 2106, checked in by ksherdy, 7 years ago

Added bit / byte strategy. Added length test to hash table.

File size: 1.7 KB
Line 
1#
2# gen_test_file.py
3#
4# Quick-and-dirty Python symbol table test script
5# to generate length sorted symbol table file.
6#
7# Created on: April 12, 2012
8# Author: Ken Herdy
9#
10#----------------------------------------------------------------------------
11# Edit:
12#----------------------------------------------------------------------------
13import sys
14import subprocess
15import os
16import shutil
17import fnmatch                 
18from string import *
19#----------------------------------------------------------------------------
20# Edit:
21program_path_dir='./'
22#
23#----------------------------------------------------------------------------
24# Command line args.
25#----------------------------------------------------------------------------
26import optparse
27def get_option_parser():
28        """Return an C{optparse.OptionParser} instance tied to this configuration."""
29
30        parser = optparse.OptionParser(usage='python %prog',
31                                        version='1.0',
32                                        )
33
34        return parser
35#----------------------------------------------------------------------------
36def gen_test_file(lb, ub, O, U):
37        total = 0
38
39        command = ['python']
40        args = [program_path_dir + 'st_test_file_generator.py']
41
42        L_O_U = ''
43        avg_gap = '1'
44        max_gap = '1'
45
46        for lgth in range(lb, ub+1):
47                L_O_U = "[" + str(lgth) + "," + str(O) + "," + str(U) + "]"
48                args.append(L_O_U)
49
50        print "Total: %d" % total
51
52        args.append(avg_gap)
53        args.append(max_gap)
54
55        command.extend(args)
56
57        subprocess.call(command)
58
59
60if __name__ == "__main__":
61
62        option_parser = get_option_parser()
63        options, args = option_parser.parse_args(sys.argv[1:])
64
65        if len(args) != 0:
66            option_parser.print_usage()
67            sys.exit()
68
69        min_lgth = 1
70        max_lgth = 20
71        occurences = 100       
72        unique = 10
73
74        gen_test_file(min_lgth,max_lgth,occurences,unique)
75
76
77
78       
Note: See TracBrowser for help on using the repository browser.