-
Notifications
You must be signed in to change notification settings - Fork 22
/
acceleration_test.go
26 lines (20 loc) · 1.13 KB
/
acceleration_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package unit
import (
"testing"
)
func TestAcceleration(t *testing.T) {
// constants from https://en.wikipedia.org/wiki/Standard_gravity#Conversions
assertFloatEqual(t, 0.03280839895013123, (1 * Gal).FeetPerSecondSquared())
assertFloatEqual(t, 0.01, (1 * Gal).MetersPerSecondSquared())
assertFloatEqual(t, 1e0, (1 * Gal).CentimetersPerSecondSquared()) // alias
assertFloatEqual(t, 0.0010197162129779284, (1 * Gal).StandardGravity())
assertFloatEqual(t, 30.4800, (1 * FootPerSecondSquared).Gals())
assertFloatEqual(t, 0.304800, (1 * FootPerSecondSquared).MetersPerSecondSquared())
assertFloatEqual(t, 0.031080950171567256, (1 * FootPerSecondSquared).StandardGravity())
assertFloatEqual(t, 100.0, (1 * MeterPerSecondSquared).Gals())
assertFloatEqual(t, 3.280839895013123, (1 * MeterPerSecondSquared).FeetPerSecondSquared())
assertFloatEqual(t, 0.10197162129779283, (1 * MeterPerSecondSquared).StandardGravity())
assertFloatEqual(t, 980.665, (1 * StandardGravity).Gals())
assertFloatEqual(t, 32.17404855643044, (1 * StandardGravity).FeetPerSecondSquared())
assertFloatEqual(t, 9.80665, (1 * StandardGravity).MetersPerSecondSquared())
}