def test_bounce_should_leave_Particle_within_boundaries(
        comment, r, x, y, vx, vy, xmin, xmax, ymin, ymax, x_new, y_new, vx_new,
        vy_new):
    p = Particle(r, (x, y), (vx, vy))
    p.bounce((xmin, xmax, ymin, ymax))
    assert p.x + p.r <= xmax
    assert p.x - p.r >= xmin
    assert p.y + p.r <= ymax
    assert p.y - p.r >= ymin
def test_Particle_bounce_should_be_elastic(comment, r, x, y, vx, vy, xmin,
                                           xmax, ymin, ymax, x_new, y_new,
                                           vx_new, vy_new):
    p = Particle(r, (x, y), (vx, vy))
    p.bounce((xmin, xmax, ymin, ymax))
    assert p.x == x_new
    assert p.y == y_new
    assert p.vx == vx_new
    assert p.vy == vy_new
예제 #3
0
def test_bounce_should_leave_Particle_within_boundaries(
    comment,
    r,x,y,vx,vy,
    xmin, xmax,   ymin, ymax,
    x_new, y_new, vx_new, vy_new
    ):

    p = Particle(r, (x,y), (vx,vy), COL)
    p.bounce((xmin, xmax, ymin, ymax))
    assert p.p.x + p.r <= xmax
    assert p.p.x - p.r >= xmin
    assert p.p.y + p.r <= ymax
    assert p.p.y - p.r >= ymin
예제 #4
0
def test_Particle_bounce_should_be_elastic(
    comment,
    r,
    x,y,vx,vy,
    xmin, xmax,   ymin, ymax,
    x_new, y_new, vx_new, vy_new
    ):
    
    p = Particle(r, (x,y), (vx,vy), COL)
    p.bounce((xmin, xmax, ymin, ymax))
    assert p.p.x ==  x_new
    assert p.p.y ==  y_new
    assert p.v.x == vx_new
    assert p.v.y == vy_new