public void Dimension_ComplexReduction_YieldsExpected() { var actual = (Dimension.Time * (((Dimension.Length ^ 2) * Dimension.Mass) / ((Dimension.Time ^ 2) * (Dimension.Length ^ 3)))); // T*L^2*M/(T^2*L^3) var expected = Dimension.Div(Dimension.Mass, Dimension.Mult(Dimension.Time, Dimension.Length)); // M/TL Assert.Equal(expected, actual); }
public void Dimension_MultiplePowerDimensionWithDivision_ExpandsEachPower() { var actual = ((Dimension.Length * Dimension.Time / Dimension.Mass) ^ 2); // (LT/M)^2 var expected = Dimension.Div(Dimension.Mult(Dimension.Pow(Dimension.Length, 2), Dimension.Pow(Dimension.Time, 2)), Dimension.Pow(Dimension.Mass, 2)); // L^2T^2/M^2; Assert.Equal(expected, actual); }
public void Dimension_DivisionOperationWithSameOperandsButDifferentPowerDivisor_ShouldReduceOperandsPartially() { var actual = (Dimension.Length / (Dimension.Length ^ 3)); // L/L^3 var expected = Dimension.Div(Dimension.None, Dimension.Pow(Dimension.Length, 2)); // 1/L^2 Assert.Equal(expected, actual); }
public void Dimension_PowerDimensionNegative_ReturnsDivision() { var actual = Dimension.Time ^ -2; // T^-2 var expected = Dimension.Div(Dimension.None, Dimension.Pow(Dimension.Time, 2)); // 1/T^2 Assert.Equal(expected, actual); }
public void Dimension_PowerDimensionMinus1_ReturnsDivision() { var actual = Dimension.Time ^ -1; // T^-1 var expected = Dimension.Div(Dimension.None, Dimension.Time); // 1/T Assert.Equal(expected, actual); }
public void Dimension_DivisionDimensionRearrangeDivBySimple_ReturnsCorrect() { var actual = (Dimension.Length / Dimension.ElectricCurrent) / Dimension.Time; // (L/I)/T var expected = Dimension.Div(Dimension.Length, Dimension.Mult(Dimension.Time, Dimension.ElectricCurrent)); // L/TI Assert.Equal(expected, actual); }
public void Dimension_DivisionDimensionRearrangeSimpleByDiv_ReturnsCorrect() { var actual = Dimension.Length / (Dimension.ElectricCurrent / Dimension.Time); // L/(I/T) var expected = Dimension.Div(Dimension.Mult(Dimension.Length, Dimension.Time), Dimension.ElectricCurrent); // LT/I Assert.Equal(expected, actual); }
public void Dimension_DivisionDimensionRearrangeDivByDiv_ReturnsCorrect() { var actual = (Dimension.Length / Dimension.Mass) / (Dimension.ElectricCurrent / Dimension.Time); // (L/M)/(I/T) var expected = Dimension.Div(Dimension.Mult(Dimension.Length, Dimension.Time), Dimension.Mult(Dimension.Mass, Dimension.ElectricCurrent)); // LT/MI Assert.Equal(expected, actual); }