Schroedingers-Hat / jsphys

Libraries for physics simulation on javascript canvas
GNU Affero General Public License v3.0
11 stars 1 forks source link

Build relativity testing framework #116

Open capnrefsmmat opened 12 years ago

capnrefsmmat commented 12 years ago

This is related to issue #23.

We should have a test framework for the relativity simulator, so we have automated tests to verify that each change we make keeps the physics correct.

I have a very simple proposal for a test framework that would run the tests:

This lets us do things like create a demo, and then create a "this is what it should look like after ten seconds" demo, and compare. Or perhaps we could allow demo steps, so we'd have "run this ten seconds, reverse time, and run it backwards ten seconds, and see that we're back to where we started."

@Schroedingers-Hat: Does this sound like a useful and reasonable approach? What tests would you want to be able to run?

Schroedingers-Hat commented 12 years ago

Everything is going to be time symmetric even if we get the relativity wrong (or do something very, very wrong). The former approach sounds best (save state after 10s).

The only complicating factor I can think of is that there will be small amounts of jitter with frame-rate changes and rounding error. It shouldn't be enough to change things significantly though.

capnrefsmmat commented 12 years ago

Yeah, we can always do comparisons with small tolerances ("should be within 2% of this position") if we need to.

Schroedingers-Hat commented 12 years ago

I think there is also a tolerant equals somewhere buried within some docs that I read.