Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typos #34

Merged
merged 6 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
406 changes: 402 additions & 4 deletions .gitignore

Large diffs are not rendered by default.

19 changes: 17 additions & 2 deletions Source/Meadow.Units.Tests/AngleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,30 @@ public void ConstructorTests()
}
}

[Fact]
[Fact]
public void ZeroCrossTests()
{
var a1 = new Angle(270);
var a2 = a1 + new Angle(180);
Assert.Equal(90d, a2.Degrees);

var a3 = new Angle(90);
var a4 = a3 - new Angle(180);
Assert.Equal(270d, a4.Degrees);

var a5 = a3 * 5;
Assert.Equal(90d, a5.Degrees);
}

[Fact]
public void MultiplicationTests()
{
var initial = _random.NextDouble() * 360;
var operand = _random.NextDouble() * 10;

var a = new Angle(initial);
a *= operand;
Assert.Equal(initial * operand, a.Degrees);
Assert.Equal((initial * operand) % 360d, a.Degrees);
}

[Fact]
Expand Down
43 changes: 21 additions & 22 deletions Source/Meadow.Units/AbsoluteHumidity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,11 @@ [Pure] public override bool Equals(object obj)
/// <returns>A new AbsoluteHumidity object with a value of value divided by the operand</returns>
[Pure] public static AbsoluteHumidity operator /(AbsoluteHumidity value, double operand) => new (value.Value / operand);

/// <summary>
/// Returns the absolute length, that is, the length without regards to
/// negative polarity
/// </summary>
/// <returns></returns>
[Pure] public AbsoluteHumidity Abs() { return new AbsoluteHumidity(Math.Abs(this.Value)); }
/// <summary>
/// Returns the absolute value of the <see cref="AbsoluteHumidity"/>
/// </summary>
/// <returns></returns>
[Pure] public AbsoluteHumidity Abs() { return new AbsoluteHumidity(Math.Abs(this.Value)); }

/// <summary>
/// Get a string representation of the object
Expand Down Expand Up @@ -236,113 +235,113 @@ [Pure] public override bool Equals(object obj)
[Pure] public TypeCode GetTypeCode() => Value.GetTypeCode();

/// <summary>
/// Covert to boolean
/// Convert to boolean
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>bool representation of the object</returns>
[Pure] public bool ToBoolean(IFormatProvider provider) => ((IConvertible)Value).ToBoolean(provider);

/// <summary>
/// Covert to byte
/// Convert to byte
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>byte representation of the object</returns>
[Pure] public byte ToByte(IFormatProvider provider) => ((IConvertible)Value).ToByte(provider);

/// <summary>
/// Covert to char
/// Convert to char
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>char representation of the object</returns>
[Pure] public char ToChar(IFormatProvider provider) => ((IConvertible)Value).ToChar(provider);

/// <summary>
/// Covert to DateTime
/// Convert to DateTime
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>DateTime representation of the object</returns>
[Pure] public DateTime ToDateTime(IFormatProvider provider) => ((IConvertible)Value).ToDateTime(provider);

/// <summary>
/// Covert to Decimal
/// Convert to Decimal
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>Decimal representation of the object</returns>
[Pure] public decimal ToDecimal(IFormatProvider provider) => ((IConvertible)Value).ToDecimal(provider);

/// <summary>
/// Covert to double
/// Convert to double
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>double representation of the object</returns>
[Pure] public double ToDouble(IFormatProvider provider) => Value;

/// <summary>
/// Covert to in16
/// Convert to in16
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>int16 representation of the object</returns>
[Pure] public short ToInt16(IFormatProvider provider) => ((IConvertible)Value).ToInt16(provider);

/// <summary>
/// Covert to int32
/// Convert to int32
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>int32 representation of the object</returns>
[Pure] public int ToInt32(IFormatProvider provider) => ((IConvertible)Value).ToInt32(provider);

/// <summary>
/// Covert to int64
/// Convert to int64
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>int64 representation of the object</returns>
[Pure] public long ToInt64(IFormatProvider provider) => ((IConvertible)Value).ToInt64(provider);

/// <summary>
/// Covert to sbyte
/// Convert to sbyte
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>sbyte representation of the object</returns>
[Pure] public sbyte ToSByte(IFormatProvider provider) => ((IConvertible)Value).ToSByte(provider);

/// <summary>
/// Covert to float
/// Convert to float
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>float representation of the object</returns>
[Pure] public float ToSingle(IFormatProvider provider) => ((IConvertible)Value).ToSingle(provider);

/// <summary>
/// Covert to string
/// Convert to string
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>string representation of the object</returns>
[Pure] public string ToString(IFormatProvider provider) => Value.ToString(provider);

/// <summary>
/// Covert to type
/// Convert to type
/// </summary>
/// <param name="conversionType">conversion type to convert to</param>
/// <param name="provider">format provider</param>
/// <returns>type representation of the object</returns>
[Pure] public object ToType(Type conversionType, IFormatProvider provider) => ((IConvertible)Value).ToType(conversionType, provider);

/// <summary>
/// Covert to uint16
/// Convert to uint16
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>uint16 representation of the object</returns>
[Pure] public ushort ToUInt16(IFormatProvider provider) => ((IConvertible)Value).ToUInt16(provider);

/// <summary>
/// Covert to uint32
/// Convert to uint32
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>uint32 representation of the object</returns>
[Pure] public uint ToUInt32(IFormatProvider provider) => ((IConvertible)Value).ToUInt32(provider);

/// <summary>
/// Covert to uint64
/// Convert to uint64
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>uint64 representation of the object</returns>
Expand Down
45 changes: 22 additions & 23 deletions Source/Meadow.Units/Acceleration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public Acceleration(Acceleration acceleration)
private readonly double Value;

/// <summary>
/// The type of units available to describe the acceleration.
/// The type of units available to describe the Acceleration.
/// </summary>
public enum UnitType
{
Expand Down Expand Up @@ -235,12 +235,11 @@ [Pure] public override bool Equals(object obj)
/// <returns>A new Acceleration object with a value of value divided by the operand</returns>
[Pure] public static Acceleration operator /(Acceleration value, double operand) => new (value.Value / operand);

/// <summary>
/// Returns the absolute length, that is, the length without regards to
/// negative polarity
/// </summary>
/// <returns></returns>
[Pure] public Acceleration Abs() { return new Acceleration(Math.Abs(this.Value)); }
/// <summary>
/// Returns the absolute value of the <see cref="Acceleration"/>
/// </summary>
/// <returns></returns>
[Pure] public Acceleration Abs() { return new Acceleration(Math.Abs(this.Value)); }

/// <summary>
/// Get a string representation of the object
Expand Down Expand Up @@ -271,113 +270,113 @@ [Pure] public override bool Equals(object obj)
[Pure] public TypeCode GetTypeCode() => Value.GetTypeCode();

/// <summary>
/// Covert to boolean
/// Convert to boolean
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>bool representation of the object</returns>
[Pure] public bool ToBoolean(IFormatProvider provider) => ((IConvertible)Value).ToBoolean(provider);

/// <summary>
/// Covert to byte
/// Convert to byte
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>byte representation of the object</returns>
[Pure] public byte ToByte(IFormatProvider provider) => ((IConvertible)Value).ToByte(provider);

/// <summary>
/// Covert to char
/// Convert to char
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>char representation of the object</returns>
[Pure] public char ToChar(IFormatProvider provider) => ((IConvertible)Value).ToChar(provider);

/// <summary>
/// Covert to DateTime
/// Convert to DateTime
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>DateTime representation of the object</returns>
[Pure] public DateTime ToDateTime(IFormatProvider provider) => ((IConvertible)Value).ToDateTime(provider);

/// <summary>
/// Covert to Decimal
/// Convert to Decimal
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>Decimal representation of the object</returns>
[Pure] public decimal ToDecimal(IFormatProvider provider) => ((IConvertible)Value).ToDecimal(provider);

/// <summary>
/// Covert to double
/// Convert to double
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>double representation of the object</returns>
[Pure] public double ToDouble(IFormatProvider provider) => Value;

/// <summary>
/// Covert to in16
/// Convert to in16
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>int16 representation of the object</returns>
[Pure] public short ToInt16(IFormatProvider provider) => ((IConvertible)Value).ToInt16(provider);

/// <summary>
/// Covert to int32
/// Convert to int32
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>int32 representation of the object</returns>
[Pure] public int ToInt32(IFormatProvider provider) => ((IConvertible)Value).ToInt32(provider);

/// <summary>
/// Covert to int64
/// Convert to int64
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>int64 representation of the object</returns>
[Pure] public long ToInt64(IFormatProvider provider) => ((IConvertible)Value).ToInt64(provider);

/// <summary>
/// Covert to sbyte
/// Convert to sbyte
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>sbyte representation of the object</returns>
[Pure] public sbyte ToSByte(IFormatProvider provider) => ((IConvertible)Value).ToSByte(provider);

/// <summary>
/// Covert to float
/// Convert to float
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>float representation of the object</returns>
[Pure] public float ToSingle(IFormatProvider provider) => ((IConvertible)Value).ToSingle(provider);

/// <summary>
/// Covert to string
/// Convert to string
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>string representation of the object</returns>
[Pure] public string ToString(IFormatProvider provider) => Value.ToString(provider);

/// <summary>
/// Covert to type
/// Convert to type
/// </summary>
/// <param name="conversionType">conversion type</param>
/// <param name="provider">format provider</param>
/// <returns>type representation of the object</returns>
[Pure] public object ToType(Type conversionType, IFormatProvider provider) => ((IConvertible)Value).ToType(conversionType, provider);

/// <summary>
/// Covert to uint16
/// Convert to uint16
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>uint16 representation of the object</returns>
[Pure] public ushort ToUInt16(IFormatProvider provider) => ((IConvertible)Value).ToUInt16(provider);

/// <summary>
/// Covert to uint32
/// Convert to uint32
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>uint32 representation of the object</returns>
[Pure] public uint ToUInt32(IFormatProvider provider) => ((IConvertible)Value).ToUInt32(provider);

/// <summary>
/// Covert to uint64
/// Convert to uint64
/// </summary>
/// <param name="provider">format provider</param>
/// <returns>uint64 representation of the object</returns>
Expand Down
2 changes: 1 addition & 1 deletion Source/Meadow.Units/Acceleration3D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Acceleration3D(Acceleration3D acceleration3D)
}

/// <summary>
/// X component of accleration
/// X component of acceleration
/// </summary>
public Acceleration X { get; set; }
/// <summary>
Expand Down
Loading
Loading