• Runs the simulation until the given time, then compares the state variables against the given expected state variables, using the given tolerance. Optionally checks that energy has been constant from start to finish of the test run. See checkResult for details about specifying the expected results. If any expected results are given, or the constant energy test is done, then prints a message saying that the current test has passed.

    If expected results are not provided, the simulation is run for the specified time with no tests being done. Tests are only done for the expected results provided. For example, you can give null for expectedVars but still have energy tests performed. Or vice versa: give expectedVars to be checked, but no expected energy results.

    The default value for number of collision searches done is zero. To ignore collision searches, provide -1 for that argument. If that number of collision searches suddenly increases, then something has gone wrong with collision time estimation.

    Debugging: Set the debug variable before running this to see some debug output: prints state of the first object at each time step, and then the state of all objects at conclusion of the test.

    Parameters

    • sim: RigidBodySim

      the simulation being tested

    • advance: CollisionAdvance<RigidBodyCollision>

      the AdvanceStrategy for advancing the simulation thru time

    • runUntil: number

      run the simulation until this time is reached

    • Optional expectedVars: null | number[]

      the set of expected state variables, or null

    • Optional tolerance: number

      the maximum allowed difference between expected and actual state variables

    • Optional expectedEnergyDiff: number

      the expected change in total energy, or NaN if energy should not be tested

    • Optional energyTol: number

      maximum allowed difference to expected energy change

    • Optional expectedCollisions: number

      expected number of collisions, or -1 to not test number of collisions

    • Optional expectedSearches: number

      expected number of collision searches, or -1 to not test number of collision searches. Default is zero.

    Returns void

Generated using TypeDoc