Log inGet started
Package

buoyancy.testSuite

This package holds more than this page lists. See all of its files in its world.

README.md

buoyancy tests

Guards what floats a hull: the arithmetic an author reasons with, the hull the water acts on, the frame rate it is independent of, and the lifecycle around it.

The submerged-fraction and waterline tests pin the contract an author actually reasons about: that density reads as the share of the hull under the surface. They assert it from both ends: the fraction rises linearly from dry to full across the hull's height, and the resting height a given density implies feeds back through the fraction to that same density. A change to either one alone breaks the pair.

The lifecycle tests cover handing a body to the physics step (the FluidForces the float states for it, with its density, damping and stated box), attaching twice (one body, reconfigured), configuring one field without disturbing the rest, releasing (the step no longer holds the body), the zero-density release that hands a body back to the physics world untouched, and the refusal of a body that already carries a FluidForces of its own.

The hull tests drop bodies into still water with the play clock held and step it with Physics.advance: a body with a box collider and no model floats at the depth its density gives at three densities; a body whose collider is shaped unlike its model floats by the collider; a ball, a capsule and a body of two child colliders float with the share their density states; a stated box and a model hull stand in for the colliders; a body floats the same in a landscape's lake (a grid of levels over a ground) and in a Water component's pool; and a body with nothing to measure (no rigid body, a sensor alone, a model hull that draws nothing) is refused, once, by a warning that names it and the ways to give it a hull, and floats once it is given the one the warning names.

The frame-rate test drops the same box at frame-rate caps of 10 and 60 with the clock running and holds both to one path, step for step, and to the resting height restingY gives.