0
|
1 #!/usr/bin/python
|
|
2 #//////////////////////////////////////////////////////////////////////////////
|
|
3 #
|
|
4 # Copyright (c) 2007,2011 Daniel Adler <dadler@uni-goettingen.de>,
|
|
5 # Tassilo Philipp <tphilipp@potion-studios.com>
|
|
6 #
|
|
7 # Permission to use, copy, modify, and distribute this software for any
|
|
8 # purpose with or without fee is hereby granted, provided that the above
|
|
9 # copyright notice and this permission notice appear in all copies.
|
|
10 #
|
|
11 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
15 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
16 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
17 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
18 #
|
|
19 #//////////////////////////////////////////////////////////////////////////////
|
|
20
|
|
21 import sys
|
|
22
|
|
23 # parameters
|
|
24
|
|
25 nargs = 8
|
|
26
|
484
|
27 # NOTE: not really feasible to enable all types, results in a huge number of
|
|
28 # cases; use other *_suite tests when needing to test many different types
|
|
29 types = ["DCdouble","DClonglong","DCint","DCpointer"] #...
|
|
30 typeSigs = ["d" ,"l" ,"i" ,"p" ] #...
|
0
|
31
|
|
32 # generator
|
|
33
|
|
34 ntypes = len(types)
|
|
35
|
|
36 sys.stderr.write("/* auto generated by mkcase (on stderr) */\n");
|
|
37 sys.stderr.write("".join(["#define NARGS ",str(nargs),"\n"]))
|
|
38 sys.stderr.write("".join(["#define NTYPES ",str(ntypes),"\n"]))
|
|
39
|
|
40 def powerfact(x, n):
|
|
41 if n==0:
|
|
42 return 0
|
|
43 else:
|
|
44 return x**n+powerfact(x,n-1)
|
|
45
|
|
46 x = 0
|
|
47 end = powerfact(ntypes,nargs)+1
|
|
48
|
|
49 sys.stdout.write("/* auto generated by mkcase.py (on stdout) */\n");
|
|
50
|
|
51 while x < end:
|
|
52 args = [str(x)]
|
|
53 sig = ["f_"]
|
|
54 pos = 0
|
|
55 y = x
|
|
56 while y > 0:
|
|
57 s = (y-1) % ntypes
|
484
|
58 y = int((y-1) / ntypes)
|
0
|
59 args += [ types [s] ]
|
|
60 sig += [ typeSigs[s] ]
|
|
61 pos += 1
|
|
62 sig = "".join(sig)
|
|
63 args += [ sig ]
|
|
64 args = ",".join(args)
|
|
65 sys.stdout.write( "".join(["VF",str(pos),"(",args,")\n"]) )
|
|
66 x += 1
|
|
67
|