% $Id: GravForceExampleTest.oz,v 1.1 2007/10/22 06:33:58 leavens Exp leavens $ \insert 'TestingNoStop.oz' \insert 'FloatPredicates.oz' \insert 'GravForceExample.oz' {StartTesting 'GravForce'} declare %%% USING IT MassOfEarth = 5.96e24 %% UNITS: kg RadiusOfEarth = 6.37e6 %% UNITS: m DistanceToMoon = 384.4e6 %% UNITS: m MassOfMoon = 7.349e22 %% UNITS: kg RadiusOfMoon = 3.476e6 %% UNITS: m {StartTesting 'General case'} {Assert {ApproxEqual {{{GravField MassOfMoon} RadiusOfMoon} 1.0} 0.40569}} {StartTesting 'EarthsField'} EarthsField %% UNITS: m -> kg -> N = {GravField MassOfEarth} {Assert {ApproxEqual {{EarthsField 1.0e20} 1.0} 3.9753e~026}} {Assert {ApproxEqual {{EarthsField RadiusOfEarth} 1.0} 9.797}} {Assert {ApproxEqual {{EarthsField RadiusOfEarth} 100.0} 979.7}} {Assert {ApproxEqual {{EarthsField DistanceToMoon} 1.0} 0.0026903}} {Assert {ApproxEqual {{EarthsField DistanceToMoon} MassOfMoon} 1.9771e020}} {StartTesting 'ForceAtSurface'} ForceAtSurface %% UNITS: kg -> N = {EarthsField RadiusOfEarth} {Assert {ApproxEqual {ForceAtSurface 1.0} 9.797}} {Assert {ApproxEqual {ForceAtSurface 100.0} 979.7}} {Assert {ApproxEqual {ForceAtSurface MassOfMoon} 7.1998e023}}