Révision 208 pobysoPythonSage/src/testPobyso.sage

testPobyso.sage (revision 208)
229 229
    return timing
230 230
# End test_pobyso_error_so
231 231

  
232
def test_pobyso_lib_init(iterationsNum=10000):
232
def test_pobyso_lib_init(repeat=1000, number=10):
233 233
    """
234 234
    Must be called exactly once. Leaks lots of memory otherwise.
235 235
    """
236
    print "Running", inspect.stack()[0][3]
237
    for index in xrange(0,iterationsNum):
236
    functionName = inspect.stack()[0][3]
237
    print "Running", functionName,"..."
238
    def test():
238 239
        pobyso_lib_init()
239
        #pobyso_lib_close()
240
        pobyso_lib_close()
241

  
242
    wrapped = test_pobyso_wrapper(test)
243
    timing = min(timeit.repeat(wrapped, repeat=repeat, number=number))
244
    print "\t...", functionName, "done."
245
    return timing
240 246
# End test_pobyso_lib_init
241 247

  
242
def test_pobyso_parse_string_sa_so(iterationsNum=10000):
243
    print "Running", inspect.stack()[0][3]
244
    for index in xrange(0,iterationsNum):
245
        expressionSo = pobyso_parse_string_sa_so('exp(x)+2*x*sin(x)')
248
def test_pobyso_parse_string_sa_so(repeat=1000, number=10):
249
    functionName = inspect.stack()[0][3]
250
    print "Running", functionName,"..."
251
    stringToParse = "exp(x)^(2)/sin(x)*cos(x)"
252
    def test(stringToParseSa):
253
        expressionSo = pobyso_parse_string_sa_so(stringToParseSa)
246 254
        sollya_lib_clear_obj(expressionSo)
247
# End pobyso_parse_string_sa_so
255
    
256
    wrapped = test_pobyso_wrapper(test,
257
                                  stringToParse)
258
    timing = min(timeit.repeat(wrapped, repeat=repeat, number=number))
259
    print "\t...", functionName, "done."
260
    return timing
248 261

  
262
# End test_pobyso_parse_string_sa_so
263

  
249 264
def test_pobyso_taylor_expansion_no_change_var_so_so(repeat=1000, number=10):
250 265
    functionName = inspect.stack()[0][3]
251 266
    print "Running", functionName, "..."

Formats disponibles : Unified diff