Ejemplo n.º 1
0
def test_tick():
    jc = JitCounter()
    jc._tick_slowpath = "not callable in this test!"
    incr = jc.compute_threshold(4)
    for i in range(5):
        r = jc.tick(index2hash(jc, 104), incr)
        assert r is (i == 3)
    for i in range(5):
        r = jc.tick(index2hash(jc, 108), incr)
        s = jc.tick(index2hash(jc, 109), incr)
        assert r is (i == 3)
        assert s is (i == 3)
    jc.reset(index2hash(jc, 108))
    for i in range(5):
        r = jc.tick(index2hash(jc, 108), incr)
        assert r is (i == 3)
Ejemplo n.º 2
0
def test_tick():
    jc = JitCounter()
    jc._tick_slowpath = "not callable in this test!"
    incr = jc.compute_threshold(4)
    for i in range(5):
        r = jc.tick(index2hash(jc, 104), incr)
        assert r is (i == 3)
    for i in range(5):
        r = jc.tick(index2hash(jc, 108), incr)
        s = jc.tick(index2hash(jc, 109), incr)
        assert r is (i == 3)
        assert s is (i == 3)
    jc.reset(index2hash(jc, 108))
    for i in range(5):
        r = jc.tick(index2hash(jc, 108), incr)
        assert r is (i == 3)