public void Equality8() { var a = new UnitPowers(new[] { new UnitPower(Meter, 1), new UnitPower(Second, 1) }); var b = new UnitPowers(new[] { new UnitPower(Second, 1), new UnitPower(Meter, 1) }); Assert.IsTrue(a == b); }
public void DimensionSingle() { var x = new UnitPowers(Meter, 1); Assert.IsTrue(x.IsDimensionLess == false); Assert.IsTrue(x.Count == 1); }
public void Dimensionless() { var x = new UnitPowers(); Assert.IsTrue(x.IsDimensionLess == true); Assert.IsTrue(x.Count == 0); }
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 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 MeterPerMeter() { var a = new UnitPowers(Meter, 1); var x = a / a; Assert.IsTrue(x.IsDimensionLess == true); Assert.IsTrue(x.Count == 0); }
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); }
public void MeterTimesMeter() { var a = new UnitPowers(Meter, 1); var x = a * a; Assert.IsTrue(x.IsDimensionLess == false); Assert.IsTrue(x.Count == 1); Assert.IsTrue(x.Powers[0].Unit == Meter); Assert.IsTrue(x.Powers[0].Power == 2); }
public void SecondPerMeter_Sorting() { var a = new UnitPowers(Meter, 1); var b = new UnitPowers(Second, 1); var x = b / a; Assert.IsTrue(x.IsDimensionLess == false); Assert.IsTrue(x.Count == 2); Assert.IsTrue(x.Powers[0].Unit == Second); Assert.IsTrue(x.Powers[0].Power == 1); Assert.IsTrue(x.Powers[1].Unit == Meter); Assert.IsTrue(x.Powers[1].Power == -1); }
public void MeterPerSecond() { var a = new UnitPowers(Meter, 1); var b = new UnitPowers(Second, 1); var x = a / b; Assert.IsTrue(x.IsDimensionLess == false); Assert.IsTrue(x.Count == 2); Assert.IsTrue(x.Powers[0].Unit == Meter); Assert.IsTrue(x.Powers[0].Power == 1); Assert.IsTrue(x.Powers[1].Unit == Second); Assert.IsTrue(x.Powers[1].Power == -1); }
public void DimensionlessToStringIsEmpty() { var a = new UnitPowers(); Assert.IsTrue(a.ToString() == ""); }