@@ -0,0 +1,1957 @@
+# test_wendy.py: some basic tests%0Aimport numpy%0Aimport wendy%0Adef test_energy_conservation():%0A    # Test that energy is conserved for a simple problem%0A    x= numpy.array(%5B-1.1,0.1,1.3%5D)%0A    v= numpy.array(%5B3.,2.,-5.%5D)%0A    m= numpy.array(%5B1.,1.,1.%5D)%0A    g= wendy.nbody(x,v,m,0.05)%0A    E= wendy.energy(x,v,m)%0A    cnt= 0%0A    while cnt %3C 100:%0A        tx,tv= g.next()%0A        assert numpy.fabs(wendy.energy(tx,tv,m)-E) %3C 10.**-10., %22Energy not conserved during simple N-body integration%22%0A        cnt+= 1%0A    return None%0A%0Adef test_energy_conservation_unequalmasses():%0A    # Test that energy is conserved for a simple problem%0A    x= numpy.array(%5B-1.1,0.1,1.3%5D)%0A    v= numpy.array(%5B3.,2.,-5.%5D)%0A    m= numpy.array(%5B1.,2.,3.%5D)%0A    g= wendy.nbody(x,v,m,0.05)%0A    E= wendy.energy(x,v,m)%0A    cnt= 0%0A    while cnt %3C 100:%0A        tx,tv= g.next()%0A        assert numpy.fabs(wendy.energy(tx,tv,m)-E) %3C 10.**-10., %22Energy not conserved during simple N-body integration%22%0A        cnt+= 1%0A    return None%0A%0Adef test_energy_conservation_unequalmasses_python():%0A    # Test that energy is conserved for a simple problem, using Python method%0A    x= numpy.array(%5B-1.1,0.1,1.3%5D)%0A    v= numpy.array(%5B3.,2.,-5.%5D)%0A    m= numpy.array(%5B1.,2.,3.%5D)%0A    g= wendy.nbody_python(x,v,m,0.05)%0A    E= wendy.energy(x,v,m)%0A    cnt= 0%0A    while cnt %3C 100:%0A        tx,tv= g.next()%0A        assert numpy.fabs(wendy.energy(tx,tv,m)-E) %3C 10.**-10., %22Energy not conserved during simple N-body integration%22%0A        cnt+= 1%0A    return None%0A%0Adef test_momentum_conservation_unequalmasses():%0A    # Test that momentum is conserved for a simple problem%0A    x= numpy.array(%5B-1.1,0.1,1.3%5D)%0A    v= numpy.array(%5B3.,2.,-5.%5D)%0A    m= numpy.array(%5B1.,2.,3.%5D)%0A    g= wendy.nbody(x,v,m,0.05)%0A    p= wendy.momentum(v,m)%0A    cnt= 0%0A    while cnt %3C 100:%0A        tx,tv= g.next()%0A        assert numpy.fabs(wendy.momentum(tv,m)-p) %3C 10.**-10., %22Momentum not conserved during simple N-body integration%22%0A        cnt+= 1%0A    return None%0A

Add a bunch of simple tests