public void Pow1() { var a = new UnitPowers(new[] { new UnitPower(Meter, 1), new UnitPower(Second, 2) }); Assert.IsTrue(a * a == a.Pow(2)); Assert.IsTrue(a * a * a == a.Pow(3)); Assert.IsTrue(a * a * a * a == a.Pow(4)); }
public void Pow2() { var a = new UnitPowers(new[] { new UnitPower(Meter, 1), new UnitPower(Second, 2) }); var r = a.Pow(2); Assert.IsTrue(r.Powers[0].Unit == Meter && r.Powers[0].Power == 2); Assert.IsTrue(r.Powers[1].Unit == Second && r.Powers[1].Power == 4); }
public void Pow3() { var a = new UnitPowers(new[] { new UnitPower(Meter, 2), new UnitPower(Second, -5) }); var r = a.Pow(-3); // different order! (positive powers first, then negative) Assert.IsTrue(r.Powers[0].Unit == Second && r.Powers[0].Power == 15); Assert.IsTrue(r.Powers[1].Unit == Meter && r.Powers[1].Power == -6); }