Code Search for Developers
 
 
  

generate_indicetest.py from p4shelf at Krugle


Show generate_indicetest.py syntax highlighted

#####################################################################################
#
#  Copyright (c) Microsoft Corporation. All rights reserved.
#
#  This source code is subject to terms and conditions of the Shared Source License
#  for IronPython. A copy of the license can be found in the License.html file
#  at the root of this distribution. If you can not locate the Shared Source License
#  for IronPython, please send an email to ironpy@microsoft.com.
#  By using this source code in any fashion, you are agreeing to be bound by
#  the terms of the Shared Source License for IronPython.
#
#  You must not remove this notice, or any other, from this software.
#
######################################################################################

boundaries = (None, -7,-2,0,1,6,10)
steps = (-5,-3,-1,1,5,20)
lengths = (-100,-15,-3,0,1,5,10,100)

global counter
global tests
global file

counter = 0
tests = 0
file = None

one_test="t"
group_test=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q']

file = open("Tests\\IndiceTest.py", "w")
file.write("""#####################################################################################
#
#  Copyright (c) Microsoft Corporation. All rights reserved.
#
#  This source code is subject to terms and conditions of the Shared Source License
#  for IronPython. A copy of the license can be found in the License.html file
#  at the root of this distribution. If you can not locate the Shared Source License
#  for IronPython, please send an email to ironpy@microsoft.com.
#  By using this source code in any fashion, you are agreeing to be bound by
#  the terms of the Shared Source License for IronPython.
#
#  You must not remove this notice, or any other, from this software.
#
######################################################################################

from Util.Debug import *

""")

file.write("def " + one_test + "(i,j,k,l,r) :\n")
file.write("\trr = slice(i,j,k).indices(l)\n")
file.write("\tAssert(rr == r, \"slice(\" + str(i) + \",\" + str(j) + \",\" + str(k) + \").indices(\" + str(l) + \") != \" + str(r) + \": \" + str(rr))\n\n")



for start in boundaries:
    for stop in boundaries:
        for step in steps:
            for length in lengths:
                if tests % 2000 == 0:
                    func = "def " + group_test[counter] + "():\n"
                    file.write(func)
                    counter += 1
                tests += 1
                s = slice(start, stop, step)
                i = s.indices(length)
                file.write("\t"+ one_test + "(" + str(start) + "," + str(stop) + "," + str(step) + "," + str(length) + "," + str(i) + ")\n")


file.write("\n")
file.write("def main():\n")
fnc = 0
while fnc < counter:
    file.write("\t" + group_test[fnc] + "()\n")
    fnc += 1

file.write("\n\nmain()\n\n")

file.close()

print tests
print counter




See more files for this project here

p4shelf

A feature in Visual Studio Team Studio that was immediately appealing to me was shelving. The goal of this tool is replicate that general functionality in Perforce.

Project homepage: http://code.google.com/p/p4shelf/
Programming language(s): C#,C++,Python
License: gpl2

  Tests/
    Imp/
      pkg_a/
        pkg_b/
          pkg_c/
            pkg_d/
      pkg_m/
      pkg_q/
        pkg_r/
          pkg_s/
    Inc/
    Inputs/
    StandAlone/
      ModPath/
    Util/
    compat/
  Wix/
    Core.wxs
    Doc.wxs
    IronPython.wxs
    Src.wxs
    build.bat
  CompareDirs.py
  clean.py
  copyrights.py
  generate.py
  generate_alltypes.py
  generate_binops.py
  generate_calls.py
  generate_convert.py
  generate_environment.py
  generate_exceptions.py
  generate_indicetest.py
  generate_math.py
  generate_ops.py
  generate_symboltable.py
  generate_typecache.py
  generate_walker.py
  make_meta1.py
  radix_generator.py
  test_builder.py
  test_cgcheck.py
  test_parrot.py
  test_pystone.py