mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-09 09:34:49 +09:00
Updating generic math to support user-defined checked operators (#67714)
* Uncomment the user-defined checked operators for generic math * Change SA1000 to be a suggestion until https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3478 can be resolved * Regenerating the System.Runtime ref assembly * Adding tests covering user-defined checked operators in generic math * Remove the checked() context from integer division, since there is no behavioral difference on .NET * Ensure the doc comments around user-defined checked operators are uncommented * Fix some doc comments that shouldn't have been uncommented yet
This commit is contained in:
parent
c093bb8f2a
commit
7c21927c25
40 changed files with 2420 additions and 1213 deletions
|
@ -866,7 +866,8 @@ dotnet_diagnostic.IL3002.severity = warning
|
|||
dotnet_diagnostic.SA0001.severity = none
|
||||
|
||||
# SA1000: Spacing around keywords
|
||||
dotnet_diagnostic.SA1000.severity = warning
|
||||
# suggestion until https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3478 is resolved
|
||||
dotnet_diagnostic.SA1000.severity = suggestion
|
||||
|
||||
# SA1001: Commas should not be preceded by whitespace
|
||||
dotnet_diagnostic.SA1001.severity = warning
|
||||
|
|
|
@ -300,8 +300,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static byte IAdditionOperators<byte, byte, byte>.operator +(byte left, byte right) => (byte)(left + right);
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_CheckedAddition(TSelf, TOther)" />
|
||||
// static byte IAdditionOperators<byte, byte, byte>.operator checked +(byte left, byte right) => checked((byte)(left + right));
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_CheckedAddition(TSelf, TOther)" />
|
||||
static byte IAdditionOperators<byte, byte, byte>.operator checked +(byte left, byte right) => checked((byte)(left + right));
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -381,8 +381,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static byte IDecrementOperators<byte>.operator --(byte value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_CheckedDecrement(TSelf)" />
|
||||
// static byte IDecrementOperators<byte>.operator checked --(byte value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_CheckedDecrement(TSelf)" />
|
||||
static byte IDecrementOperators<byte>.operator checked --(byte value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -391,8 +391,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static byte IDivisionOperators<byte, byte, byte>.operator /(byte left, byte right) => (byte)(left / right);
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static byte IDivisionOperators<byte, byte, byte>.operator checked /(byte left, byte right) => checked((byte)(left / right));
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static byte IDivisionOperators<byte, byte, byte>.operator checked /(byte left, byte right) => (byte)(left / right);
|
||||
|
||||
//
|
||||
// IEqualityOperators
|
||||
|
@ -411,8 +411,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static byte IIncrementOperators<byte>.operator ++(byte value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static byte IIncrementOperators<byte>.operator checked ++(byte value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static byte IIncrementOperators<byte>.operator checked ++(byte value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -445,8 +445,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static byte IMultiplyOperators<byte, byte, byte>.operator *(byte left, byte right) => (byte)(left * right);
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static byte IMultiplyOperators<byte, byte, byte>.operator checked *(byte left, byte right) => checked((byte)(left * right));
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static byte IMultiplyOperators<byte, byte, byte>.operator checked *(byte left, byte right) => checked((byte)(left * right));
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -937,8 +937,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static byte ISubtractionOperators<byte, byte, byte>.operator -(byte left, byte right) => (byte)(left - right);
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static byte ISubtractionOperators<byte, byte, byte>.operator checked -(byte left, byte right) => checked((byte)(left - right));
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static byte ISubtractionOperators<byte, byte, byte>.operator checked -(byte left, byte right) => checked((byte)(left - right));
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -947,8 +947,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static byte IUnaryNegationOperators<byte, byte>.operator -(byte value) => (byte)(-value);
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static byte IUnaryNegationOperators<byte, byte>.operator checked -(byte value) => checked((byte)(-value));
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static byte IUnaryNegationOperators<byte, byte>.operator checked -(byte value) => checked((byte)(-value));
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -1068,8 +1068,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static char IAdditionOperators<char, char, char>.operator +(char left, char right) => (char) (left + right);
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static char IAdditionOperators<char, char, char>.operator checked +(char left, char right) => checked((char)(left + right));
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static char IAdditionOperators<char, char, char>.operator checked +(char left, char right) => checked((char)(left + right));
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -1149,8 +1149,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static char IDecrementOperators<char>.operator --(char value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_CheckedDecrement(TSelf)" />
|
||||
// static char IDecrementOperators<char>.operator checked --(char value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_CheckedDecrement(TSelf)" />
|
||||
static char IDecrementOperators<char>.operator checked --(char value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -1159,8 +1159,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static char IDivisionOperators<char, char, char>.operator /(char left, char right) => (char)(left / right);
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static char IDivisionOperators<char, char, char>.operator /(char left, char right) => checked((char)(left / right));
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static char IDivisionOperators<char, char, char>.operator checked /(char left, char right) => (char)(left / right);
|
||||
|
||||
//
|
||||
// IEqualityOperators
|
||||
|
@ -1179,8 +1179,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static char IIncrementOperators<char>.operator ++(char value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static char IIncrementOperators<char>.operator checked ++(char value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static char IIncrementOperators<char>.operator checked ++(char value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -1213,8 +1213,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static char IMultiplyOperators<char, char, char>.operator *(char left, char right) => (char)(left * right);
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static char IMultiplyOperators<char, char, char>.operator checked *(char left, char right) => checked((char)(left * right));
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static char IMultiplyOperators<char, char, char>.operator checked *(char left, char right) => checked((char)(left * right));
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -1733,8 +1733,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static char ISubtractionOperators<char, char, char>.operator -(char left, char right) => (char)(left - right);
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static char ISubtractionOperators<char, char, char>.operator checked -(char left, char right) => checked((char)(left - right));
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static char ISubtractionOperators<char, char, char>.operator checked -(char left, char right) => checked((char)(left - right));
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -1743,8 +1743,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static char IUnaryNegationOperators<char, char>.operator -(char value) => (char)(-value);
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static char IUnaryNegationOperators<char, char>.operator checked -(char value) => checked((char)(-value));
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static char IUnaryNegationOperators<char, char>.operator checked -(char value) => checked((char)(-value));
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -1511,8 +1511,8 @@ namespace System
|
|||
// IAdditionOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static DateTime IAdditionOperators<DateTime, TimeSpan, DateTime>.operator checked +(DateTime left, TimeSpan right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static DateTime IAdditionOperators<DateTime, TimeSpan, DateTime>.operator checked +(DateTime left, TimeSpan right) => left + right;
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -1550,10 +1550,10 @@ namespace System
|
|||
// ISubtractionOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static DateTime ISubtractionOperators<DateTime, TimeSpan, DateTime>.operator checked -(DateTime left, TimeSpan right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static DateTime ISubtractionOperators<DateTime, TimeSpan, DateTime>.operator checked -(DateTime left, TimeSpan right) => left - right;
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static TimeSpan ISubtractionOperators<DateTime, DateTime, TimeSpan>.operator checked -(DateTime left, DateTime right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static TimeSpan ISubtractionOperators<DateTime, DateTime, TimeSpan>.operator checked -(DateTime left, DateTime right) => left - right;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -867,8 +867,8 @@ namespace System
|
|||
// IAdditionOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static DateTimeOffset IAdditionOperators<DateTimeOffset, TimeSpan, DateTimeOffset>.operator checked +(DateTimeOffset left, TimeSpan right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static DateTimeOffset IAdditionOperators<DateTimeOffset, TimeSpan, DateTimeOffset>.operator checked +(DateTimeOffset left, TimeSpan right) => left + right;
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -906,10 +906,10 @@ namespace System
|
|||
// ISubtractionOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static DateTimeOffset ISubtractionOperators<DateTimeOffset, TimeSpan, DateTimeOffset>.operator checked -(DateTimeOffset left, TimeSpan right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static DateTimeOffset ISubtractionOperators<DateTimeOffset, TimeSpan, DateTimeOffset>.operator checked -(DateTimeOffset left, TimeSpan right) => left - right;
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static TimeSpan ISubtractionOperators<DateTimeOffset, DateTimeOffset, TimeSpan>.operator checked -(DateTimeOffset left, DateTimeOffset right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static TimeSpan ISubtractionOperators<DateTimeOffset, DateTimeOffset, TimeSpan>.operator checked -(DateTimeOffset left, DateTimeOffset right) => left - right;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1082,8 +1082,8 @@ namespace System
|
|||
// IAdditionOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static decimal IAdditionOperators<decimal, decimal, decimal>.operator checked +(decimal left, decimal right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static decimal IAdditionOperators<decimal, decimal, decimal>.operator checked +(decimal left, decimal right) => left + right;
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -1096,22 +1096,22 @@ namespace System
|
|||
// IDecrementOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_CheckedDecrement(TSelf)" />
|
||||
// static decimal IDecrementOperators<decimal>.operator checked --(decimal value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_CheckedDecrement(TSelf)" />
|
||||
static decimal IDecrementOperators<decimal>.operator checked --(decimal value) => --value;
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static decimal IDivisionOperators<decimal, decimal, decimal>.operator checked /(decimal left, decimal right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static decimal IDivisionOperators<decimal, decimal, decimal>.operator checked /(decimal left, decimal right) => left / right;
|
||||
|
||||
//
|
||||
// IIncrementOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static decimal IIncrementOperators<decimal>.operator checked ++(decimal value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static decimal IIncrementOperators<decimal>.operator checked ++(decimal value) => ++value;
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -1134,8 +1134,8 @@ namespace System
|
|||
// IMultiplyOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// public static decimal operator checked *(decimal left, decimal right) => checked(left * right);
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
public static decimal operator checked *(decimal left, decimal right) => left * right;
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -1504,14 +1504,14 @@ namespace System
|
|||
// ISubtractionOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static decimal ISubtractionOperators<decimal, decimal, decimal>.operator checked -(decimal left, decimal right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static decimal ISubtractionOperators<decimal, decimal, decimal>.operator checked -(decimal left, decimal right) => left - right;
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static decimal IUnaryNegationOperators<decimal, decimal>.operator checked -(decimal value) => checked(-value);
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static decimal IUnaryNegationOperators<decimal, decimal>.operator checked -(decimal value) => -value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -491,8 +491,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static double IAdditionOperators<double, double, double>.operator +(double left, double right) => left + right;
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static double IAdditionOperators<double, double, double>.operator checked +(double left, double right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static double IAdditionOperators<double, double, double>.operator checked +(double left, double right) => left + right;
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -560,8 +560,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static double IDecrementOperators<double>.operator --(double value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_CheckedDecrement(TSelf)" />
|
||||
// static double IDecrementOperators<double>.operator checked --(double value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_CheckedDecrement(TSelf)" />
|
||||
static double IDecrementOperators<double>.operator checked --(double value) => --value;
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -570,8 +570,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static double IDivisionOperators<double, double, double>.operator /(double left, double right) => left / right;
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static double IDivisionOperators<double, double, double>.operator checked /(double left, double right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static double IDivisionOperators<double, double, double>.operator checked /(double left, double right) => left / right;
|
||||
|
||||
//
|
||||
// IExponentialFunctions
|
||||
|
@ -716,8 +716,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static double IIncrementOperators<double>.operator ++(double value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static double IIncrementOperators<double>.operator checked ++(double value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static double IIncrementOperators<double>.operator checked ++(double value) => ++value;
|
||||
|
||||
//
|
||||
// ILogarithmicFunctions
|
||||
|
@ -772,10 +772,10 @@ namespace System
|
|||
//
|
||||
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static double IMultiplyOperators<double, double, double>.operator *(double left, double right) => (double)(left * right);
|
||||
static double IMultiplyOperators<double, double, double>.operator *(double left, double right) => left * right;
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static double IMultiplyOperators<double, double, double>.operator checked *(double left, double right) => checked((double)(left * right));
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static double IMultiplyOperators<double, double, double>.operator checked *(double left, double right) => left * right;
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -1153,10 +1153,10 @@ namespace System
|
|||
//
|
||||
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static double ISubtractionOperators<double, double, double>.operator -(double left, double right) => (double)(left - right);
|
||||
static double ISubtractionOperators<double, double, double>.operator -(double left, double right) => left - right;
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static double ISubtractionOperators<double, double, double>.operator checked -(double left, double right) => checked((double)(left - right));
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static double ISubtractionOperators<double, double, double>.operator checked -(double left, double right) => left - right;
|
||||
|
||||
//
|
||||
// ITrigonometricFunctions
|
||||
|
@ -1212,10 +1212,10 @@ namespace System
|
|||
//
|
||||
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static double IUnaryNegationOperators<double, double>.operator -(double value) => (double)(-value);
|
||||
static double IUnaryNegationOperators<double, double>.operator -(double value) => -value;
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static double IUnaryNegationOperators<double, double>.operator checked -(double value) => checked((double)(-value));
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static double IUnaryNegationOperators<double, double>.operator checked -(double value) => -value;
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -715,8 +715,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
public static Half operator +(Half left, Half right) => (Half)((float)left + (float)right);
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static Half IAdditionOperators<Half, Half, Half>.operator checked +(Half left, Half right) => checked((Half)((float)left + (float)right));
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static Half IAdditionOperators<Half, Half, Half>.operator checked +(Half left, Half right) => left + right;
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -789,13 +789,8 @@ namespace System
|
|||
return (Half)tmp;
|
||||
}
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_CheckedDecrement(TSelf)" />
|
||||
// static Half IDecrementOperators<Half>.operator checked --(Half value)
|
||||
// {
|
||||
// var tmp = (float)value;
|
||||
// --tmp;
|
||||
// return (Half)tmp;
|
||||
// }
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_CheckedDecrement(TSelf)" />
|
||||
static Half IDecrementOperators<Half>.operator checked --(Half value) => --value;
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -804,8 +799,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
public static Half operator /(Half left, Half right) => (Half)((float)left / (float)right);
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static Half IDivisionOperators<Half, Half, Half>.operator checked /(Half left, Half right) => checked((Half)((float)left / (float)right));
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static Half IDivisionOperators<Half, Half, Half>.operator checked /(Half left, Half right) => left / right;
|
||||
|
||||
//
|
||||
// IExponentialFunctions
|
||||
|
@ -943,13 +938,8 @@ namespace System
|
|||
return (Half)tmp;
|
||||
}
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static Half IIncrementOperators<Half>.operator checked ++(Half value)
|
||||
// {
|
||||
// var tmp = (float)value;
|
||||
// ++tmp;
|
||||
// return (Half)tmp;
|
||||
// }
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static Half IIncrementOperators<Half>.operator checked ++(Half value) => ++value;
|
||||
|
||||
//
|
||||
// ILogarithmicFunctions
|
||||
|
@ -994,8 +984,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
public static Half operator *(Half left, Half right) => (Half)((float)left * (float)right);
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static Half IMultiplyOperators<Half, Half, Half>.operator checked *(Half left, Half right) => checked((Half)((float)left * (float)right));
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static Half IMultiplyOperators<Half, Half, Half>.operator checked *(Half left, Half right) => left * right;
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -1375,8 +1365,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
public static Half operator -(Half left, Half right) => (Half)((float)left - (float)right);
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static Half ISubtractionOperators<Half, Half, Half>.operator checked -(Half left, Half right) => checked((Half)((float)left - (float)right));
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static Half ISubtractionOperators<Half, Half, Half>.operator checked -(Half left, Half right) => left - right;
|
||||
|
||||
//
|
||||
// ITrigonometricFunctions
|
||||
|
@ -1438,8 +1428,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
public static Half operator -(Half value) => (Half)(-(float)value);
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static Half IUnaryNegationOperators<Half, Half>.operator checked -(Half value) => checked((Half)(-(float)value));
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static Half IUnaryNegationOperators<Half, Half>.operator checked -(Half value) => -value;
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -306,8 +306,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static short IAdditionOperators<short, short, short>.operator +(short left, short right) => (short)(left + right);
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static short IAdditionOperators<short, short, short>.operator checked +(short left, short right) => checked((short)(left + right));
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static short IAdditionOperators<short, short, short>.operator checked +(short left, short right) => checked((short)(left + right));
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -394,8 +394,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static short IDecrementOperators<short>.operator --(short value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
// static short IDecrementOperators<short>.operator checked --(short value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static short IDecrementOperators<short>.operator checked --(short value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -404,8 +404,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static short IDivisionOperators<short, short, short>.operator /(short left, short right) => (short)(left / right);
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static short IDivisionOperators<short, short, short>.operator checked /(short left, short right) => checked((short)(left / right));
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static short IDivisionOperators<short, short, short>.operator checked /(short left, short right) => (short)(left / right);
|
||||
|
||||
//
|
||||
// IEqualityOperators
|
||||
|
@ -424,8 +424,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static short IIncrementOperators<short>.operator ++(short value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static short IIncrementOperators<short>.operator checked ++(short value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static short IIncrementOperators<short>.operator checked ++(short value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -458,8 +458,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static short IMultiplyOperators<short, short, short>.operator *(short left, short right) => (short)(left * right);
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static short IMultiplyOperators<short, short, short>.operator checked *(short left, short right) => checked((short)(left * right));
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static short IMultiplyOperators<short, short, short>.operator checked *(short left, short right) => checked((short)(left * right));
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -1011,8 +1011,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static short ISubtractionOperators<short, short, short>.operator -(short left, short right) => (short)(left - right);
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static short ISubtractionOperators<short, short, short>.operator checked -(short left, short right) => checked((short)(left - right));
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static short ISubtractionOperators<short, short, short>.operator checked -(short left, short right) => checked((short)(left - right));
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -1021,8 +1021,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static short IUnaryNegationOperators<short, short>.operator -(short value) => (short)(-value);
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static short IUnaryNegationOperators<short, short>.operator checked -(short value) => checked((short)(-value));
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static short IUnaryNegationOperators<short, short>.operator checked -(short value) => checked((short)(-value));
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -298,8 +298,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static int IAdditionOperators<int, int, int>.operator +(int left, int right) => left + right;
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static int IAdditionOperators<int, int, int>.operator checked +(int left, int right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static int IAdditionOperators<int, int, int>.operator checked +(int left, int right) => checked(left + right);
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -386,8 +386,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static int IDecrementOperators<int>.operator --(int value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
// static int IDecrementOperators<int>.operator checked --(int value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static int IDecrementOperators<int>.operator checked --(int value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -396,8 +396,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static int IDivisionOperators<int, int, int>.operator /(int left, int right) => left / right;
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static int IDivisionOperators<int, int, int>.operator checked /(int left, int right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static int IDivisionOperators<int, int, int>.operator checked /(int left, int right) => left / right;
|
||||
|
||||
//
|
||||
// IEqualityOperators
|
||||
|
@ -416,8 +416,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static int IIncrementOperators<int>.operator ++(int value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static int IIncrementOperators<int>.operator checked ++(int value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static int IIncrementOperators<int>.operator checked ++(int value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -450,8 +450,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static int IMultiplyOperators<int, int, int>.operator *(int left, int right) => left * right;
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static int IMultiplyOperators<int, int, int>.operator checked *(int left, int right) => checked(left * right);
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static int IMultiplyOperators<int, int, int>.operator checked *(int left, int right) => checked(left * right);
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -975,8 +975,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static int ISubtractionOperators<int, int, int>.operator -(int left, int right) => left - right;
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static int ISubtractionOperators<int, int, int>.operator checked -(int left, int right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static int ISubtractionOperators<int, int, int>.operator checked -(int left, int right) => checked(left - right);
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -985,8 +985,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static int IUnaryNegationOperators<int, int>.operator -(int value) => -value;
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static int IUnaryNegationOperators<int, int>.operator checked -(int value) => checked(-value);
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static int IUnaryNegationOperators<int, int>.operator checked -(int value) => checked(-value);
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -285,8 +285,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static long IAdditionOperators<long, long, long>.operator +(long left, long right) => left + right;
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static long IAdditionOperators<long, long, long>.operator checked +(long left, long right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static long IAdditionOperators<long, long, long>.operator checked +(long left, long right) => checked(left + right);
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -373,8 +373,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static long IDecrementOperators<long>.operator --(long value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
// static long IDecrementOperators<long>.operator checked --(long value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static long IDecrementOperators<long>.operator checked --(long value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -383,8 +383,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static long IDivisionOperators<long, long, long>.operator /(long left, long right) => left / right;
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static long IDivisionOperators<long, long, long>.operator checked /(long left, long right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static long IDivisionOperators<long, long, long>.operator checked /(long left, long right) => left / right;
|
||||
|
||||
//
|
||||
// IEqualityOperators
|
||||
|
@ -403,8 +403,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static long IIncrementOperators<long>.operator ++(long value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static long IIncrementOperators<long>.operator checked ++(long value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static long IIncrementOperators<long>.operator checked ++(long value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -437,8 +437,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static long IMultiplyOperators<long, long, long>.operator *(long left, long right) => left * right;
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static long IMultiplyOperators<long, long, long>.operator checked *(long left, long right) => checked(left * right);
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static long IMultiplyOperators<long, long, long>.operator checked *(long left, long right) => checked(left * right);
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -933,8 +933,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static long ISubtractionOperators<long, long, long>.operator -(long left, long right) => left - right;
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static long ISubtractionOperators<long, long, long>.operator checked -(long left, long right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static long ISubtractionOperators<long, long, long>.operator checked -(long left, long right) => checked(left - right);
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -943,8 +943,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static long IUnaryNegationOperators<long, long>.operator -(long value) => -value;
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static long IUnaryNegationOperators<long, long>.operator checked -(long value) => checked(-value);
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static long IUnaryNegationOperators<long, long>.operator checked -(long value) => checked(-value);
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -270,8 +270,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static nint IAdditionOperators<nint, nint, nint>.operator +(nint left, nint right) => left + right;
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static nint IAdditionOperators<nint, nint, nint>.operator checked +(nint left, nint right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static nint IAdditionOperators<nint, nint, nint>.operator checked +(nint left, nint right) => checked(left + right);
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -416,8 +416,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static nint IDecrementOperators<nint>.operator --(nint value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
// static nint IDecrementOperators<nint>.operator checked --(nint value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static nint IDecrementOperators<nint>.operator checked --(nint value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -426,8 +426,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static nint IDivisionOperators<nint, nint, nint>.operator /(nint left, nint right) => left / right;
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static nint IDivisionOperators<nint, nint, nint>.operator checked /(nint left, nint right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static nint IDivisionOperators<nint, nint, nint>.operator checked /(nint left, nint right) => left / right;
|
||||
|
||||
//
|
||||
// IIncrementOperators
|
||||
|
@ -436,8 +436,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static nint IIncrementOperators<nint>.operator ++(nint value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static nint IIncrementOperators<nint>.operator checked ++(nint value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static nint IIncrementOperators<nint>.operator checked ++(nint value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -470,8 +470,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static nint IMultiplyOperators<nint, nint, nint>.operator *(nint left, nint right) => left * right;
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static nint IMultiplyOperators<nint, nint, nint>.operator checked *(nint left, nint right) => checked(left * right);
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static nint IMultiplyOperators<nint, nint, nint>.operator checked *(nint left, nint right) => checked(left * right);
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -965,8 +965,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static nint ISubtractionOperators<nint, nint, nint>.operator -(nint left, nint right) => left - right;
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static nint ISubtractionOperators<nint, nint, nint>.operator checked -(nint left, nint right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static nint ISubtractionOperators<nint, nint, nint>.operator checked -(nint left, nint right) => checked(left - right);
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -975,8 +975,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static nint IUnaryNegationOperators<nint, nint>.operator -(nint value) => -value;
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static nint IUnaryNegationOperators<nint, nint>.operator checked -(nint value) => checked(-value);
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static nint IUnaryNegationOperators<nint, nint>.operator checked -(nint value) => checked(-value);
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -16,11 +16,11 @@ namespace System.Numerics
|
|||
/// <returns>The sum of <paramref name="left" /> and <paramref name="right" />.</returns>
|
||||
static abstract TResult operator +(TSelf left, TOther right);
|
||||
|
||||
// /// <summary>Adds two values together to compute their sum.</summary>
|
||||
// /// <param name="left">The value to which <paramref name="right" /> is added.</param>
|
||||
// /// <param name="right">The value which is added to <paramref name="left" />.</param>
|
||||
// /// <returns>The sum of <paramref name="left" /> and <paramref name="right" />.</returns>
|
||||
// /// <exception cref="OverflowException">The sum of <paramref name="left" /> and <paramref name="right" /> is not representable by <typeparamref name="TResult" />.</exception>
|
||||
// static abstract TResult operator checked +(TSelf left, TOther right);
|
||||
/// <summary>Adds two values together to compute their sum.</summary>
|
||||
/// <param name="left">The value to which <paramref name="right" /> is added.</param>
|
||||
/// <param name="right">The value which is added to <paramref name="left" />.</param>
|
||||
/// <returns>The sum of <paramref name="left" /> and <paramref name="right" />.</returns>
|
||||
/// <exception cref="OverflowException">The sum of <paramref name="left" /> and <paramref name="right" /> is not representable by <typeparamref name="TResult" />.</exception>
|
||||
static abstract TResult operator checked +(TSelf left, TOther right);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ namespace System.Numerics
|
|||
/// <returns>The result of decrementing <paramref name="value" />.</returns>
|
||||
static abstract TSelf operator --(TSelf value);
|
||||
|
||||
// /// <summary>Decrements a value.</summary>
|
||||
// /// <param name="value">The value to decrement.</param>
|
||||
// /// <returns>The result of decrementing <paramref name="value" />.</returns>
|
||||
// /// <exception cref="OverflowException">The result of decrementing <paramref name="value" /> is not representable by <typeparamref name="TSelf" />.</exception>
|
||||
// static abstract TSelf operator checked --(TSelf value);
|
||||
/// <summary>Decrements a value.</summary>
|
||||
/// <param name="value">The value to decrement.</param>
|
||||
/// <returns>The result of decrementing <paramref name="value" />.</returns>
|
||||
/// <exception cref="OverflowException">The result of decrementing <paramref name="value" /> is not representable by <typeparamref name="TSelf" />.</exception>
|
||||
static abstract TSelf operator checked --(TSelf value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@ namespace System.Numerics
|
|||
/// <returns>The quotient of <paramref name="left" /> divided-by <paramref name="right" />.</returns>
|
||||
static abstract TResult operator /(TSelf left, TOther right);
|
||||
|
||||
// /// <summary>Divides two values together to compute their quotient.</summary>
|
||||
// /// <param name="left">The value which <paramref name="right" /> divides.</param>
|
||||
// /// <param name="right">The value which divides <paramref name="left" />.</param>
|
||||
// /// <returns>The quotient of <paramref name="left" /> divided-by <paramref name="right" />.</returns>
|
||||
// /// <exception cref="OverflowException">The quotient of <paramref name="left" /> divided-by <paramref name="right" /> is not representable by <typeparamref name="TResult" />.</exception>
|
||||
// static abstract TResult operator checked /(TSelf left, TOther right);
|
||||
/// <summary>Divides two values together to compute their quotient.</summary>
|
||||
/// <param name="left">The value which <paramref name="right" /> divides.</param>
|
||||
/// <param name="right">The value which divides <paramref name="left" />.</param>
|
||||
/// <returns>The quotient of <paramref name="left" /> divided-by <paramref name="right" />.</returns>
|
||||
/// <exception cref="OverflowException">The quotient of <paramref name="left" /> divided-by <paramref name="right" /> is not representable by <typeparamref name="TResult" />.</exception>
|
||||
static abstract TResult operator checked /(TSelf left, TOther right);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ namespace System.Numerics
|
|||
/// <returns>The result of incrementing <paramref name="value" />.</returns>
|
||||
static abstract TSelf operator ++(TSelf value);
|
||||
|
||||
// /// <summary>Increments a value.</summary>
|
||||
// /// <param name="value">The value to increment.</param>
|
||||
// /// <returns>The result of incrementing <paramref name="value" />.</returns>
|
||||
// /// <exception cref="OverflowException">The result of incrementing <paramref name="value" /> is not representable by <typeparamref name="TSelf" />.</exception>
|
||||
// static abstract TSelf operator checked ++(TSelf value);
|
||||
/// <summary>Increments a value.</summary>
|
||||
/// <param name="value">The value to increment.</param>
|
||||
/// <returns>The result of incrementing <paramref name="value" />.</returns>
|
||||
/// <exception cref="OverflowException">The result of incrementing <paramref name="value" /> is not representable by <typeparamref name="TSelf" />.</exception>
|
||||
static abstract TSelf operator checked ++(TSelf value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@ namespace System.Numerics
|
|||
/// <returns>The product of <paramref name="left" /> divided-by <paramref name="right" />.</returns>
|
||||
static abstract TResult operator *(TSelf left, TOther right);
|
||||
|
||||
// /// <summary>Multiplies two values together to compute their product.</summary>
|
||||
// /// <param name="left">The value which <paramref name="right" /> multiplies.</param>
|
||||
// /// <param name="right">The value which multiplies <paramref name="left" />.</param>
|
||||
// /// <returns>The product of <paramref name="left" /> divided-by <paramref name="right" />.</returns>
|
||||
// /// <exception cref="OverflowException">The product of <paramref name="left" /> multiplied-by <paramref name="right" /> is not representable by <typeparamref name="TResult" />.</exception>
|
||||
// static abstract TResult operator checked *(TSelf left, TOther right);
|
||||
/// <summary>Multiplies two values together to compute their product.</summary>
|
||||
/// <param name="left">The value which <paramref name="right" /> multiplies.</param>
|
||||
/// <param name="right">The value which multiplies <paramref name="left" />.</param>
|
||||
/// <returns>The product of <paramref name="left" /> divided-by <paramref name="right" />.</returns>
|
||||
/// <exception cref="OverflowException">The product of <paramref name="left" /> multiplied-by <paramref name="right" /> is not representable by <typeparamref name="TResult" />.</exception>
|
||||
static abstract TResult operator checked *(TSelf left, TOther right);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@ namespace System.Numerics
|
|||
/// <returns>The difference of <paramref name="right" /> subtracted from <paramref name="left" />.</returns>
|
||||
static abstract TResult operator -(TSelf left, TOther right);
|
||||
|
||||
// /// <summary>Subtracts two values to compute their difference.</summary>
|
||||
// /// <param name="left">The value from which <paramref name="right" /> is subtracted.</param>
|
||||
// /// <param name="right">The value which is subtracted from <paramref name="left" />.</param>
|
||||
// /// <returns>The difference of <paramref name="right" /> subtracted from <paramref name="left" />.</returns>
|
||||
// /// <exception cref="OverflowException">The difference of <paramref name="right" /> subtracted from <paramref name="left" /> is not representable by <typeparamref name="TResult" />.</exception>
|
||||
// static abstract TResult operator checked -(TSelf left, TOther right);
|
||||
/// <summary>Subtracts two values to compute their difference.</summary>
|
||||
/// <param name="left">The value from which <paramref name="right" /> is subtracted.</param>
|
||||
/// <param name="right">The value which is subtracted from <paramref name="left" />.</param>
|
||||
/// <returns>The difference of <paramref name="right" /> subtracted from <paramref name="left" />.</returns>
|
||||
/// <exception cref="OverflowException">The difference of <paramref name="right" /> subtracted from <paramref name="left" /> is not representable by <typeparamref name="TResult" />.</exception>
|
||||
static abstract TResult operator checked -(TSelf left, TOther right);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ namespace System.Numerics
|
|||
/// <returns>The unary negation of <paramref name="value" />.</returns>
|
||||
static abstract TResult operator -(TSelf value);
|
||||
|
||||
// /// <summary>Computes the unary negation of a value.</summary>
|
||||
// /// <param name="value">The value for which to compute its unary negation.</param>
|
||||
// /// <returns>The unary negation of <paramref name="value" />.</returns>
|
||||
// /// <exception cref="OverflowException">The unary negation of <paramref name="value" /> is not representable by <typeparamref name="TResult" />.</exception>
|
||||
// static abstract TResult operator checked -(TSelf value);
|
||||
/// <summary>Computes the unary negation of a value.</summary>
|
||||
/// <param name="value">The value for which to compute its unary negation.</param>
|
||||
/// <returns>The unary negation of <paramref name="value" />.</returns>
|
||||
/// <exception cref="OverflowException">The unary negation of <paramref name="value" /> is not representable by <typeparamref name="TResult" />.</exception>
|
||||
static abstract TResult operator checked -(TSelf value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -314,8 +314,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static sbyte IAdditionOperators<sbyte, sbyte, sbyte>.operator +(sbyte left, sbyte right) => (sbyte)(left + right);
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static sbyte IAdditionOperators<sbyte, sbyte, sbyte>.operator checked +(sbyte left, sbyte right) => checked((sbyte)(left + right));
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static sbyte IAdditionOperators<sbyte, sbyte, sbyte>.operator checked +(sbyte left, sbyte right) => checked((sbyte)(left + right));
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -402,8 +402,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static sbyte IDecrementOperators<sbyte>.operator --(sbyte value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
// static sbyte IDecrementOperators<sbyte>.operator checked --(sbyte value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static sbyte IDecrementOperators<sbyte>.operator checked --(sbyte value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -412,8 +412,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static sbyte IDivisionOperators<sbyte, sbyte, sbyte>.operator /(sbyte left, sbyte right) => (sbyte)(left / right);
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static sbyte IDivisionOperators<sbyte, sbyte, sbyte>.operator checked /(sbyte left, sbyte right) => checked((sbyte)(left / right));
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static sbyte IDivisionOperators<sbyte, sbyte, sbyte>.operator checked /(sbyte left, sbyte right) => (sbyte)(left / right);
|
||||
|
||||
//
|
||||
// IEqualityOperators
|
||||
|
@ -432,8 +432,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static sbyte IIncrementOperators<sbyte>.operator ++(sbyte value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static sbyte IIncrementOperators<sbyte>.operator checked ++(sbyte value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static sbyte IIncrementOperators<sbyte>.operator checked ++(sbyte value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -466,8 +466,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static sbyte IMultiplyOperators<sbyte, sbyte, sbyte>.operator *(sbyte left, sbyte right) => (sbyte)(left * right);
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static sbyte IMultiplyOperators<sbyte, sbyte, sbyte>.operator checked *(sbyte left, sbyte right) => checked((sbyte)(left * right));
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static sbyte IMultiplyOperators<sbyte, sbyte, sbyte>.operator checked *(sbyte left, sbyte right) => checked((sbyte)(left * right));
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -1038,8 +1038,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static sbyte ISubtractionOperators<sbyte, sbyte, sbyte>.operator -(sbyte left, sbyte right) => (sbyte)(left - right);
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static sbyte ISubtractionOperators<sbyte, sbyte, sbyte>.operator checked -(sbyte left, sbyte right) => checked((sbyte)(left - right));
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static sbyte ISubtractionOperators<sbyte, sbyte, sbyte>.operator checked -(sbyte left, sbyte right) => checked((sbyte)(left - right));
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -1048,8 +1048,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static sbyte IUnaryNegationOperators<sbyte, sbyte>.operator -(sbyte value) => (sbyte)(-value);
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static sbyte IUnaryNegationOperators<sbyte, sbyte>.operator checked -(sbyte value) => checked((sbyte)(-value));
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static sbyte IUnaryNegationOperators<sbyte, sbyte>.operator checked -(sbyte value) => checked((sbyte)(-value));
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -486,8 +486,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static float IAdditionOperators<float, float, float>.operator +(float left, float right) => left + right;
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static float IAdditionOperators<float, float, float>.operator checked +(float left, float right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static float IAdditionOperators<float, float, float>.operator checked +(float left, float right) => left + right;
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -555,8 +555,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static float IDecrementOperators<float>.operator --(float value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
// static float IDecrementOperators<float>.operator checked --(float value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static float IDecrementOperators<float>.operator checked --(float value) => --value;
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -565,8 +565,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static float IDivisionOperators<float, float, float>.operator /(float left, float right) => left / right;
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static float IDivisionOperators<float, float, float>.operator checked /(float left, float right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static float IDivisionOperators<float, float, float>.operator checked /(float left, float right) => left / right;
|
||||
|
||||
//
|
||||
// IExponentialFunctions
|
||||
|
@ -711,8 +711,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static float IIncrementOperators<float>.operator ++(float value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static float IIncrementOperators<float>.operator checked ++(float value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static float IIncrementOperators<float>.operator checked ++(float value) => ++value;
|
||||
|
||||
//
|
||||
// ILogarithmicFunctions
|
||||
|
@ -767,10 +767,10 @@ namespace System
|
|||
//
|
||||
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static float IMultiplyOperators<float, float, float>.operator *(float left, float right) => (float)(left * right);
|
||||
static float IMultiplyOperators<float, float, float>.operator *(float left, float right) => left * right;
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static float IMultiplyOperators<float, float, float>.operator checked *(float left, float right) => checked((float)(left * right));
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static float IMultiplyOperators<float, float, float>.operator checked *(float left, float right) => left * right;
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -1148,10 +1148,10 @@ namespace System
|
|||
//
|
||||
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static float ISubtractionOperators<float, float, float>.operator -(float left, float right) => (float)(left - right);
|
||||
static float ISubtractionOperators<float, float, float>.operator -(float left, float right) => left - right;
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static float ISubtractionOperators<float, float, float>.operator checked -(float left, float right) => checked((float)(left - right));
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static float ISubtractionOperators<float, float, float>.operator checked -(float left, float right) => left - right;
|
||||
|
||||
//
|
||||
// ITrigonometricFunctions
|
||||
|
@ -1207,10 +1207,10 @@ namespace System
|
|||
//
|
||||
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static float IUnaryNegationOperators<float, float>.operator -(float value) => (float)(-value);
|
||||
static float IUnaryNegationOperators<float, float>.operator -(float value) => -value;
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static float IUnaryNegationOperators<float, float>.operator checked -(float value) => checked((float)(-value));
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static float IUnaryNegationOperators<float, float>.operator checked -(float value) => -value;
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -932,5 +932,12 @@ namespace System
|
|||
|
||||
/// <inheritdoc cref="ISpanParsable{TSelf}.TryParse(ReadOnlySpan{char}, IFormatProvider?, out TSelf)" />
|
||||
public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out TimeOnly result) => TryParse(s, provider, DateTimeStyles.None, out result);
|
||||
|
||||
//
|
||||
// ISubtractionOperators
|
||||
//
|
||||
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static TimeSpan ISubtractionOperators<TimeOnly, TimeOnly, TimeSpan>.operator checked -(TimeOnly left, TimeOnly right) => left - right;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -519,8 +519,8 @@ namespace System
|
|||
// IAdditionOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static TimeSpan IAdditionOperators<TimeSpan, TimeSpan, TimeSpan>.operator checked +(TimeSpan left, TimeSpan right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static TimeSpan IAdditionOperators<TimeSpan, TimeSpan, TimeSpan>.operator checked +(TimeSpan left, TimeSpan right) => left + right;
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -533,11 +533,11 @@ namespace System
|
|||
// IDivisionOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static TimeSpan IDivisionOperators<TimeSpan, double, TimeSpan>.operator checked /(TimeSpan left, double right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static TimeSpan IDivisionOperators<TimeSpan, double, TimeSpan>.operator checked /(TimeSpan left, double right) => left / right;
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static double IDivisionOperators<TimeSpan, TimeSpan, double>.operator checked /(TimeSpan left, TimeSpan right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static double IDivisionOperators<TimeSpan, TimeSpan, double>.operator checked /(TimeSpan left, TimeSpan right) => left / right;
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -558,21 +558,21 @@ namespace System
|
|||
// IMultiplyOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static TimeSpan IMultiplyOperators<TimeSpan, double, TimeSpan>.operator checked *(TimeSpan left, double right) => checked(left * right);
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static TimeSpan IMultiplyOperators<TimeSpan, double, TimeSpan>.operator checked *(TimeSpan left, double right) => left * right;
|
||||
|
||||
//
|
||||
// ISubtractionOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static TimeSpan ISubtractionOperators<TimeSpan, TimeSpan, TimeSpan>.operator checked -(TimeSpan left, TimeSpan right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static TimeSpan ISubtractionOperators<TimeSpan, TimeSpan, TimeSpan>.operator checked -(TimeSpan left, TimeSpan right) => left - right;
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
//
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static TimeSpan IUnaryNegationOperators<TimeSpan, TimeSpan>.operator checked -(TimeSpan value) => checked(-value);
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static TimeSpan IUnaryNegationOperators<TimeSpan, TimeSpan>.operator checked -(TimeSpan value) => -value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -294,8 +294,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static ushort IAdditionOperators<ushort, ushort, ushort>.operator +(ushort left, ushort right) => (ushort)(left + right);
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static ushort IAdditionOperators<ushort, ushort, ushort>.operator checked +(ushort left, ushort right) => checked((ushort)(left + right));
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static ushort IAdditionOperators<ushort, ushort, ushort>.operator checked +(ushort left, ushort right) => checked((ushort)(left + right));
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -375,8 +375,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static ushort IDecrementOperators<ushort>.operator --(ushort value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
// static ushort IDecrementOperators<ushort>.operator checked --(ushort value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static ushort IDecrementOperators<ushort>.operator checked --(ushort value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -385,8 +385,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static ushort IDivisionOperators<ushort, ushort, ushort>.operator /(ushort left, ushort right) => (ushort)(left / right);
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static ushort IDivisionOperators<ushort, ushort, ushort>.operator checked /(ushort left, ushort right) => checked((ushort)(left / right));
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static ushort IDivisionOperators<ushort, ushort, ushort>.operator checked /(ushort left, ushort right) => (ushort)(left / right);
|
||||
|
||||
//
|
||||
// IEqualityOperators
|
||||
|
@ -405,8 +405,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static ushort IIncrementOperators<ushort>.operator ++(ushort value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static ushort IIncrementOperators<ushort>.operator checked ++(ushort value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static ushort IIncrementOperators<ushort>.operator checked ++(ushort value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -439,8 +439,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static ushort IMultiplyOperators<ushort, ushort, ushort>.operator *(ushort left, ushort right) => (ushort)(left * right);
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static ushort IMultiplyOperators<ushort, ushort, ushort>.operator checked *(ushort left, ushort right) => checked((ushort)(left * right));
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static ushort IMultiplyOperators<ushort, ushort, ushort>.operator checked *(ushort left, ushort right) => checked((ushort)(left * right));
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -911,8 +911,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static ushort ISubtractionOperators<ushort, ushort, ushort>.operator -(ushort left, ushort right) => (ushort)(left - right);
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static ushort ISubtractionOperators<ushort, ushort, ushort>.operator checked -(ushort left, ushort right) => checked((ushort)(left - right));
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static ushort ISubtractionOperators<ushort, ushort, ushort>.operator checked -(ushort left, ushort right) => checked((ushort)(left - right));
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -921,8 +921,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static ushort IUnaryNegationOperators<ushort, ushort>.operator -(ushort value) => (ushort)(-value);
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static ushort IUnaryNegationOperators<ushort, ushort>.operator checked -(ushort value) => checked((ushort)(-value));
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static ushort IUnaryNegationOperators<ushort, ushort>.operator checked -(ushort value) => checked((ushort)(-value));
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -280,8 +280,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static uint IAdditionOperators<uint, uint, uint>.operator +(uint left, uint right) => left + right;
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static uint IAdditionOperators<uint, uint, uint>.operator checked +(uint left, uint right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static uint IAdditionOperators<uint, uint, uint>.operator checked +(uint left, uint right) => checked(left + right);
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -361,8 +361,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static uint IDecrementOperators<uint>.operator --(uint value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
// static uint IDecrementOperators<uint>.operator checked --(uint value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static uint IDecrementOperators<uint>.operator checked --(uint value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -371,8 +371,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static uint IDivisionOperators<uint, uint, uint>.operator /(uint left, uint right) => left / right;
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static uint IDivisionOperators<uint, uint, uint>.operator checked /(uint left, uint right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static uint IDivisionOperators<uint, uint, uint>.operator checked /(uint left, uint right) => left / right;
|
||||
|
||||
//
|
||||
// IEqualityOperators
|
||||
|
@ -391,8 +391,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static uint IIncrementOperators<uint>.operator ++(uint value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static uint IIncrementOperators<uint>.operator checked ++(uint value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static uint IIncrementOperators<uint>.operator checked ++(uint value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -425,8 +425,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static uint IMultiplyOperators<uint, uint, uint>.operator *(uint left, uint right) => left * right;
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static uint IMultiplyOperators<uint, uint, uint>.operator checked *(uint left, uint right) => checked(left * right);
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static uint IMultiplyOperators<uint, uint, uint>.operator checked *(uint left, uint right) => checked(left * right);
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -887,8 +887,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static uint ISubtractionOperators<uint, uint, uint>.operator -(uint left, uint right) => left - right;
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static uint ISubtractionOperators<uint, uint, uint>.operator checked -(uint left, uint right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static uint ISubtractionOperators<uint, uint, uint>.operator checked -(uint left, uint right) => checked(left - right);
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -897,8 +897,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static uint IUnaryNegationOperators<uint, uint>.operator -(uint value) => 0u - value;
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static uint IUnaryNegationOperators<uint, uint>.operator checked -(uint value) => checked(0u - value);
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static uint IUnaryNegationOperators<uint, uint>.operator checked -(uint value) => checked(0u - value);
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -279,8 +279,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static ulong IAdditionOperators<ulong, ulong, ulong>.operator +(ulong left, ulong right) => left + right;
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static ulong IAdditionOperators<ulong, ulong, ulong>.operator checked +(ulong left, ulong right) => checked(left + right);
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static ulong IAdditionOperators<ulong, ulong, ulong>.operator checked +(ulong left, ulong right) => checked(left + right);
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -360,8 +360,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static ulong IDecrementOperators<ulong>.operator --(ulong value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
// static ulong IDecrementOperators<ulong>.operator checked --(ulong value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static ulong IDecrementOperators<ulong>.operator checked --(ulong value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -370,8 +370,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static ulong IDivisionOperators<ulong, ulong, ulong>.operator /(ulong left, ulong right) => left / right;
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static ulong IDivisionOperators<ulong, ulong, ulong>.operator checked /(ulong left, ulong right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static ulong IDivisionOperators<ulong, ulong, ulong>.operator checked /(ulong left, ulong right) => left / right;
|
||||
|
||||
//
|
||||
// IEqualityOperators
|
||||
|
@ -390,8 +390,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static ulong IIncrementOperators<ulong>.operator ++(ulong value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static ulong IIncrementOperators<ulong>.operator checked ++(ulong value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static ulong IIncrementOperators<ulong>.operator checked ++(ulong value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -424,8 +424,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static ulong IMultiplyOperators<ulong, ulong, ulong>.operator *(ulong left, ulong right) => left * right;
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static ulong IMultiplyOperators<ulong, ulong, ulong>.operator checked *(ulong left, ulong right) => checked(left * right);
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static ulong IMultiplyOperators<ulong, ulong, ulong>.operator checked *(ulong left, ulong right) => checked(left * right);
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -866,8 +866,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static ulong ISubtractionOperators<ulong, ulong, ulong>.operator -(ulong left, ulong right) => left - right;
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static ulong ISubtractionOperators<ulong, ulong, ulong>.operator checked -(ulong left, ulong right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static ulong ISubtractionOperators<ulong, ulong, ulong>.operator checked -(ulong left, ulong right) => checked(left - right);
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -876,8 +876,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static ulong IUnaryNegationOperators<ulong, ulong>.operator -(ulong value) => 0UL - value;
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static ulong IUnaryNegationOperators<ulong, ulong>.operator checked -(ulong value) => checked(0UL - value);
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static ulong IUnaryNegationOperators<ulong, ulong>.operator checked -(ulong value) => checked(0UL - value);
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
|
@ -262,8 +262,8 @@ namespace System
|
|||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static nuint IAdditionOperators<nuint, nuint, nuint>.operator +(nuint left, nuint right) => (nuint)(left + right);
|
||||
|
||||
// /// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
// static nuint IAdditionOperators<nuint, nuint, nuint>.operator checked +(nuint left, nuint right) => checked((nuint)(left + right));
|
||||
/// <inheritdoc cref="IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
|
||||
static nuint IAdditionOperators<nuint, nuint, nuint>.operator checked +(nuint left, nuint right) => checked((nuint)(left + right));
|
||||
|
||||
//
|
||||
// IAdditiveIdentity
|
||||
|
@ -413,8 +413,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static nuint IDecrementOperators<nuint>.operator --(nuint value) => --value;
|
||||
|
||||
// /// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
// static nuint IDecrementOperators<nuint>.operator checked --(nuint value) => checked(--value);
|
||||
/// <inheritdoc cref="IDecrementOperators{TSelf}.op_Decrement(TSelf)" />
|
||||
static nuint IDecrementOperators<nuint>.operator checked --(nuint value) => checked(--value);
|
||||
|
||||
//
|
||||
// IDivisionOperators
|
||||
|
@ -423,8 +423,8 @@ namespace System
|
|||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_Division(TSelf, TOther)" />
|
||||
static nuint IDivisionOperators<nuint, nuint, nuint>.operator /(nuint left, nuint right) => left / right;
|
||||
|
||||
// /// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
// static nuint IDivisionOperators<nuint, nuint, nuint>.operator checked /(nuint left, nuint right) => checked(left / right);
|
||||
/// <inheritdoc cref="IDivisionOperators{TSelf, TOther, TResult}.op_CheckedDivision(TSelf, TOther)" />
|
||||
static nuint IDivisionOperators<nuint, nuint, nuint>.operator checked /(nuint left, nuint right) => left / right;
|
||||
|
||||
//
|
||||
// IIncrementOperators
|
||||
|
@ -433,8 +433,8 @@ namespace System
|
|||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_Increment(TSelf)" />
|
||||
static nuint IIncrementOperators<nuint>.operator ++(nuint value) => ++value;
|
||||
|
||||
// /// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
// static nuint IIncrementOperators<nuint>.operator checked ++(nuint value) => checked(++value);
|
||||
/// <inheritdoc cref="IIncrementOperators{TSelf}.op_CheckedIncrement(TSelf)" />
|
||||
static nuint IIncrementOperators<nuint>.operator checked ++(nuint value) => checked(++value);
|
||||
|
||||
//
|
||||
// IMinMaxValue
|
||||
|
@ -467,8 +467,8 @@ namespace System
|
|||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_Multiply(TSelf, TOther)" />
|
||||
static nuint IMultiplyOperators<nuint, nuint, nuint>.operator *(nuint left, nuint right) => left * right;
|
||||
|
||||
// /// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
// static nuint IMultiplyOperators<nuint, nuint, nuint>.operator checked *(nuint left, nuint right) => checked(left * right);
|
||||
/// <inheritdoc cref="IMultiplyOperators{TSelf, TOther, TResult}.op_CheckedMultiply(TSelf, TOther)" />
|
||||
static nuint IMultiplyOperators<nuint, nuint, nuint>.operator checked *(nuint left, nuint right) => checked(left * right);
|
||||
|
||||
//
|
||||
// INumber
|
||||
|
@ -900,8 +900,8 @@ namespace System
|
|||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_Subtraction(TSelf, TOther)" />
|
||||
static nuint ISubtractionOperators<nuint, nuint, nuint>.operator -(nuint left, nuint right) => left - right;
|
||||
|
||||
// /// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
// static nuint ISubtractionOperators<nuint, nuint, nuint>.operator checked -(nuint left, nuint right) => checked(left - right);
|
||||
/// <inheritdoc cref="ISubtractionOperators{TSelf, TOther, TResult}.op_CheckedSubtraction(TSelf, TOther)" />
|
||||
static nuint ISubtractionOperators<nuint, nuint, nuint>.operator checked -(nuint left, nuint right) => checked(left - right);
|
||||
|
||||
//
|
||||
// IUnaryNegationOperators
|
||||
|
@ -910,8 +910,8 @@ namespace System
|
|||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_UnaryNegation(TSelf)" />
|
||||
static nuint IUnaryNegationOperators<nuint, nuint>.operator -(nuint value) => (nuint)0 - value;
|
||||
|
||||
// /// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
// static nuint IUnaryNegationOperators<nuint, nuint>.operator checked -(nuint value) => checked((nuint)0 - value);
|
||||
/// <inheritdoc cref="IUnaryNegationOperators{TSelf, TResult}.op_CheckedUnaryNegation(TSelf)" />
|
||||
static nuint IUnaryNegationOperators<nuint, nuint>.operator checked -(nuint value) => checked((nuint)0 - value);
|
||||
|
||||
//
|
||||
// IUnaryPlusOperators
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -55,6 +55,17 @@ namespace System.Tests
|
|||
Assert.Equal((byte)0x00, AdditionOperatorsHelper<byte, byte, byte>.op_Addition((byte)0xFF, (byte)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
Assert.Equal((byte)0x01, AdditionOperatorsHelper<byte, byte, byte>.op_CheckedAddition((byte)0x00, (byte)1));
|
||||
Assert.Equal((byte)0x02, AdditionOperatorsHelper<byte, byte, byte>.op_CheckedAddition((byte)0x01, (byte)1));
|
||||
Assert.Equal((byte)0x80, AdditionOperatorsHelper<byte, byte, byte>.op_CheckedAddition((byte)0x7F, (byte)1));
|
||||
Assert.Equal((byte)0x81, AdditionOperatorsHelper<byte, byte, byte>.op_CheckedAddition((byte)0x80, (byte)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<byte, byte, byte>.op_CheckedAddition((byte)0xFF, (byte)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -215,6 +226,17 @@ namespace System.Tests
|
|||
Assert.Equal((byte)0xFE, DecrementOperatorsHelper<byte>.op_Decrement((byte)0xFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
Assert.Equal((byte)0x00, DecrementOperatorsHelper<byte>.op_CheckedDecrement((byte)0x01));
|
||||
Assert.Equal((byte)0x7E, DecrementOperatorsHelper<byte>.op_CheckedDecrement((byte)0x7F));
|
||||
Assert.Equal((byte)0x7F, DecrementOperatorsHelper<byte>.op_Decrement((byte)0x80));
|
||||
Assert.Equal((byte)0xFE, DecrementOperatorsHelper<byte>.op_CheckedDecrement((byte)0xFF));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<byte>.op_CheckedDecrement((byte)0x00));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -223,6 +245,20 @@ namespace System.Tests
|
|||
Assert.Equal((byte)0x3F, DivisionOperatorsHelper<byte, byte, byte>.op_Division((byte)0x7F, (byte)2));
|
||||
Assert.Equal((byte)0x40, DivisionOperatorsHelper<byte, byte, byte>.op_Division((byte)0x80, (byte)2));
|
||||
Assert.Equal((byte)0x7F, DivisionOperatorsHelper<byte, byte, byte>.op_Division((byte)0xFF, (byte)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<byte, byte, byte>.op_Division((byte)0x01, (byte)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
Assert.Equal((byte)0x00, DivisionOperatorsHelper<byte, byte, byte>.op_CheckedDivision((byte)0x00, (byte)2));
|
||||
Assert.Equal((byte)0x00, DivisionOperatorsHelper<byte, byte, byte>.op_CheckedDivision((byte)0x01, (byte)2));
|
||||
Assert.Equal((byte)0x3F, DivisionOperatorsHelper<byte, byte, byte>.op_CheckedDivision((byte)0x7F, (byte)2));
|
||||
Assert.Equal((byte)0x40, DivisionOperatorsHelper<byte, byte, byte>.op_CheckedDivision((byte)0x80, (byte)2));
|
||||
Assert.Equal((byte)0x7F, DivisionOperatorsHelper<byte, byte, byte>.op_CheckedDivision((byte)0xFF, (byte)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<byte, byte, byte>.op_CheckedDivision((byte)0x01, (byte)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -255,6 +291,17 @@ namespace System.Tests
|
|||
Assert.Equal((byte)0x00, IncrementOperatorsHelper<byte>.op_Increment((byte)0xFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
Assert.Equal((byte)0x01, IncrementOperatorsHelper<byte>.op_CheckedIncrement((byte)0x00));
|
||||
Assert.Equal((byte)0x02, IncrementOperatorsHelper<byte>.op_CheckedIncrement((byte)0x01));
|
||||
Assert.Equal((byte)0x80, IncrementOperatorsHelper<byte>.op_Increment((byte)0x7F));
|
||||
Assert.Equal((byte)0x81, IncrementOperatorsHelper<byte>.op_CheckedIncrement((byte)0x80));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<byte>.op_CheckedIncrement((byte)0xFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -263,6 +310,8 @@ namespace System.Tests
|
|||
Assert.Equal((byte)0x01, ModulusOperatorsHelper<byte, byte, byte>.op_Modulus((byte)0x7F, (byte)2));
|
||||
Assert.Equal((byte)0x00, ModulusOperatorsHelper<byte, byte, byte>.op_Modulus((byte)0x80, (byte)2));
|
||||
Assert.Equal((byte)0x01, ModulusOperatorsHelper<byte, byte, byte>.op_Modulus((byte)0xFF, (byte)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<byte, byte, byte>.op_Modulus((byte)0x01, (byte)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -275,6 +324,17 @@ namespace System.Tests
|
|||
Assert.Equal((byte)0xFE, MultiplyOperatorsHelper<byte, byte, byte>.op_Multiply((byte)0xFF, (byte)2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
Assert.Equal((byte)0x00, MultiplyOperatorsHelper<byte, byte, byte>.op_CheckedMultiply((byte)0x00, (byte)2));
|
||||
Assert.Equal((byte)0x02, MultiplyOperatorsHelper<byte, byte, byte>.op_CheckedMultiply((byte)0x01, (byte)2));
|
||||
Assert.Equal((byte)0xFE, MultiplyOperatorsHelper<byte, byte, byte>.op_CheckedMultiply((byte)0x7F, (byte)2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<byte, byte, byte>.op_CheckedMultiply((byte)0x80, (byte)2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<byte, byte, byte>.op_CheckedMultiply((byte)0xFF, (byte)2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
{
|
||||
|
@ -1003,7 +1063,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
Assert.Equal((byte)0x00, ShiftOperatorsHelper<byte, byte>.op_LeftShift((byte)0x00, 1));
|
||||
|
@ -1033,6 +1092,17 @@ namespace System.Tests
|
|||
Assert.Equal((byte)0xFE, SubtractionOperatorsHelper<byte, byte, byte>.op_Subtraction((byte)0xFF, (byte)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
Assert.Equal((byte)0x00, SubtractionOperatorsHelper<byte, byte, byte>.op_CheckedSubtraction((byte)0x01, (byte)1));
|
||||
Assert.Equal((byte)0x7E, SubtractionOperatorsHelper<byte, byte, byte>.op_CheckedSubtraction((byte)0x7F, (byte)1));
|
||||
Assert.Equal((byte)0x7F, SubtractionOperatorsHelper<byte, byte, byte>.op_CheckedSubtraction((byte)0x80, (byte)1));
|
||||
Assert.Equal((byte)0xFE, SubtractionOperatorsHelper<byte, byte, byte>.op_CheckedSubtraction((byte)0xFF, (byte)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<byte, byte, byte>.op_CheckedSubtraction((byte)0x00, (byte)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1043,6 +1113,17 @@ namespace System.Tests
|
|||
Assert.Equal((byte)0x01, UnaryNegationOperatorsHelper<byte, byte>.op_UnaryNegation((byte)0xFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
Assert.Equal((byte)0x00, UnaryNegationOperatorsHelper<byte, byte>.op_CheckedUnaryNegation((byte)0x00));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<byte, byte>.op_CheckedUnaryNegation((byte)0x01));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<byte, byte>.op_CheckedUnaryNegation((byte)0x7F));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<byte, byte>.op_CheckedUnaryNegation((byte)0x80));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<byte, byte>.op_CheckedUnaryNegation((byte)0xFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
|
@ -54,6 +54,17 @@ namespace System.Tests
|
|||
Assert.Equal((char)0x0000, AdditionOperatorsHelper<char, char, char>.op_Addition((char)0xFFFF, (char)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
Assert.Equal((char)0x0001, AdditionOperatorsHelper<char, char, char>.op_CheckedAddition((char)0x0000, (char)1));
|
||||
Assert.Equal((char)0x0002, AdditionOperatorsHelper<char, char, char>.op_CheckedAddition((char)0x0001, (char)1));
|
||||
Assert.Equal((char)0x8000, AdditionOperatorsHelper<char, char, char>.op_CheckedAddition((char)0x7FFF, (char)1));
|
||||
Assert.Equal((char)0x8001, AdditionOperatorsHelper<char, char, char>.op_CheckedAddition((char)0x8000, (char)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<char, char, char>.op_CheckedAddition((char)0xFFFF, (char)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -214,6 +225,17 @@ namespace System.Tests
|
|||
Assert.Equal((char)0xFFFE, DecrementOperatorsHelper<char>.op_Decrement((char)0xFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
Assert.Equal((char)0x0000, DecrementOperatorsHelper<char>.op_CheckedDecrement((char)0x0001));
|
||||
Assert.Equal((char)0x7FFE, DecrementOperatorsHelper<char>.op_CheckedDecrement((char)0x7FFF));
|
||||
Assert.Equal((char)0x7FFF, DecrementOperatorsHelper<char>.op_CheckedDecrement((char)0x8000));
|
||||
Assert.Equal((char)0xFFFE, DecrementOperatorsHelper<char>.op_CheckedDecrement((char)0xFFFF));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<char>.op_CheckedDecrement((char)0x0000));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -222,6 +244,20 @@ namespace System.Tests
|
|||
Assert.Equal((char)0x3FFF, DivisionOperatorsHelper<char, char, char>.op_Division((char)0x7FFF, (char)2));
|
||||
Assert.Equal((char)0x4000, DivisionOperatorsHelper<char, char, char>.op_Division((char)0x8000, (char)2));
|
||||
Assert.Equal((char)0x7FFF, DivisionOperatorsHelper<char, char, char>.op_Division((char)0xFFFF, (char)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<char, char, char>.op_Division((char)0x0001, (char)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
Assert.Equal((char)0x0000, DivisionOperatorsHelper<char, char, char>.op_CheckedDivision((char)0x0000, (char)2));
|
||||
Assert.Equal((char)0x0000, DivisionOperatorsHelper<char, char, char>.op_CheckedDivision((char)0x0001, (char)2));
|
||||
Assert.Equal((char)0x3FFF, DivisionOperatorsHelper<char, char, char>.op_CheckedDivision((char)0x7FFF, (char)2));
|
||||
Assert.Equal((char)0x4000, DivisionOperatorsHelper<char, char, char>.op_CheckedDivision((char)0x8000, (char)2));
|
||||
Assert.Equal((char)0x7FFF, DivisionOperatorsHelper<char, char, char>.op_CheckedDivision((char)0xFFFF, (char)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<char, char, char>.op_CheckedDivision((char)0x0001, (char)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -254,6 +290,17 @@ namespace System.Tests
|
|||
Assert.Equal((char)0x0000, IncrementOperatorsHelper<char>.op_Increment((char)0xFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
Assert.Equal((char)0x0001, IncrementOperatorsHelper<char>.op_CheckedIncrement((char)0x0000));
|
||||
Assert.Equal((char)0x0002, IncrementOperatorsHelper<char>.op_CheckedIncrement((char)0x0001));
|
||||
Assert.Equal((char)0x8000, IncrementOperatorsHelper<char>.op_CheckedIncrement((char)0x7FFF));
|
||||
Assert.Equal((char)0x8001, IncrementOperatorsHelper<char>.op_CheckedIncrement((char)0x8000));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<char>.op_CheckedIncrement((char)0xFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -262,6 +309,8 @@ namespace System.Tests
|
|||
Assert.Equal((char)0x0001, ModulusOperatorsHelper<char, char, char>.op_Modulus((char)0x7FFF, (char)2));
|
||||
Assert.Equal((char)0x0000, ModulusOperatorsHelper<char, char, char>.op_Modulus((char)0x8000, (char)2));
|
||||
Assert.Equal((char)0x0001, ModulusOperatorsHelper<char, char, char>.op_Modulus((char)0xFFFF, (char)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<char, char, char>.op_Modulus((char)0x0001, (char)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -274,6 +323,17 @@ namespace System.Tests
|
|||
Assert.Equal((char)0xFFFE, MultiplyOperatorsHelper<char, char, char>.op_Multiply((char)0xFFFF, (char)2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
Assert.Equal((char)0x0000, MultiplyOperatorsHelper<char, char, char>.op_CheckedMultiply((char)0x0000, (char)2));
|
||||
Assert.Equal((char)0x0002, MultiplyOperatorsHelper<char, char, char>.op_CheckedMultiply((char)0x0001, (char)2));
|
||||
Assert.Equal((char)0xFFFE, MultiplyOperatorsHelper<char, char, char>.op_CheckedMultiply((char)0x7FFF, (char)2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<char, char, char>.op_CheckedMultiply((char)0x8000, (char)2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<char, char, char>.op_CheckedMultiply((char)0xFFFF, (char)2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
{
|
||||
|
@ -1002,7 +1062,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
Assert.Equal((char)0x0000, ShiftOperatorsHelper<char, char>.op_LeftShift((char)0x0000, 1));
|
||||
|
@ -1032,6 +1091,17 @@ namespace System.Tests
|
|||
Assert.Equal((char)0xFFFE, SubtractionOperatorsHelper<char, char, char>.op_Subtraction((char)0xFFFF, (char)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
Assert.Equal((char)0x0000, SubtractionOperatorsHelper<char, char, char>.op_CheckedSubtraction((char)0x0001, (char)1));
|
||||
Assert.Equal((char)0x7FFE, SubtractionOperatorsHelper<char, char, char>.op_CheckedSubtraction((char)0x7FFF, (char)1));
|
||||
Assert.Equal((char)0x7FFF, SubtractionOperatorsHelper<char, char, char>.op_CheckedSubtraction((char)0x8000, (char)1));
|
||||
Assert.Equal((char)0xFFFE, SubtractionOperatorsHelper<char, char, char>.op_CheckedSubtraction((char)0xFFFF, (char)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<char, char, char>.op_CheckedSubtraction((char)0x0000, (char)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1042,6 +1112,17 @@ namespace System.Tests
|
|||
Assert.Equal((char)0x0001, UnaryNegationOperatorsHelper<char, char>.op_UnaryNegation((char)0xFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
Assert.Equal((char)0x0000, UnaryNegationOperatorsHelper<char, char>.op_CheckedUnaryNegation((char)0x0000));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<char, char>.op_CheckedUnaryNegation((char)0x0001));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<char, char>.op_CheckedUnaryNegation((char)0x7FFF));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<char, char>.op_CheckedUnaryNegation((char)0x8000));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<char, char>.op_CheckedUnaryNegation((char)0xFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace System.Tests
|
||||
{
|
||||
|
@ -11,6 +10,8 @@ namespace System.Tests
|
|||
where TSelf : IAdditionOperators<TSelf, TOther, TResult>
|
||||
{
|
||||
public static TResult op_Addition(TSelf left, TOther right) => left + right;
|
||||
|
||||
public static TResult op_CheckedAddition(TSelf left, TOther right) => checked(left + right);
|
||||
}
|
||||
|
||||
public static class AdditiveIdentityHelper<TSelf, TResult>
|
||||
|
@ -71,12 +72,16 @@ namespace System.Tests
|
|||
where TSelf : IDecrementOperators<TSelf>
|
||||
{
|
||||
public static TSelf op_Decrement(TSelf value) => --value;
|
||||
|
||||
public static TSelf op_CheckedDecrement(TSelf value) => checked(--value);
|
||||
}
|
||||
|
||||
public static class DivisionOperatorsHelper<TSelf, TOther, TResult>
|
||||
where TSelf : IDivisionOperators<TSelf, TOther, TResult>
|
||||
{
|
||||
public static TResult op_Division(TSelf left, TOther right) => left / right;
|
||||
|
||||
public static TResult op_CheckedDivision(TSelf left, TOther right) => checked(left / right);
|
||||
}
|
||||
|
||||
public static class EqualityOperatorsHelper<TSelf, TOther>
|
||||
|
@ -91,6 +96,8 @@ namespace System.Tests
|
|||
where TSelf : IIncrementOperators<TSelf>
|
||||
{
|
||||
public static TSelf op_Increment(TSelf value) => ++value;
|
||||
|
||||
public static TSelf op_CheckedIncrement(TSelf value) => checked(++value);
|
||||
}
|
||||
|
||||
public static class MinMaxValueHelper<TSelf>
|
||||
|
@ -107,18 +114,20 @@ namespace System.Tests
|
|||
public static TResult op_Modulus(TSelf left, TOther right) => left % right;
|
||||
}
|
||||
|
||||
public static class MultiplyOperatorsHelper<TSelf, TOther, TResult>
|
||||
where TSelf : IMultiplyOperators<TSelf, TOther, TResult>
|
||||
{
|
||||
public static TResult op_Multiply(TSelf left, TOther right) => left * right;
|
||||
}
|
||||
|
||||
public static class MultiplicativeIdentityHelper<TSelf, TResult>
|
||||
where TSelf : IMultiplicativeIdentity<TSelf, TResult>
|
||||
{
|
||||
public static TResult MultiplicativeIdentity => TSelf.MultiplicativeIdentity;
|
||||
}
|
||||
|
||||
public static class MultiplyOperatorsHelper<TSelf, TOther, TResult>
|
||||
where TSelf : IMultiplyOperators<TSelf, TOther, TResult>
|
||||
{
|
||||
public static TResult op_Multiply(TSelf left, TOther right) => left * right;
|
||||
|
||||
public static TResult op_CheckedMultiply(TSelf left, TOther right) => checked(left * right);
|
||||
}
|
||||
|
||||
public static class NumberBaseHelper<TSelf>
|
||||
where TSelf : INumberBase<TSelf>
|
||||
{
|
||||
|
@ -211,12 +220,16 @@ namespace System.Tests
|
|||
where TSelf : ISubtractionOperators<TSelf, TOther, TResult>
|
||||
{
|
||||
public static TResult op_Subtraction(TSelf left, TOther right) => left - right;
|
||||
|
||||
public static TResult op_CheckedSubtraction(TSelf left, TOther right) => checked(left - right);
|
||||
}
|
||||
|
||||
public static class UnaryNegationOperatorsHelper<TSelf, TResult>
|
||||
where TSelf : IUnaryNegationOperators<TSelf, TResult>
|
||||
{
|
||||
public static TResult op_UnaryNegation(TSelf value) => -value;
|
||||
|
||||
public static TResult op_CheckedUnaryNegation(TSelf value) => checked(-value);
|
||||
}
|
||||
|
||||
public static class UnaryPlusOperatorsHelper<TSelf, TResult>
|
||||
|
|
|
@ -61,6 +61,17 @@ namespace System.Tests
|
|||
Assert.Equal((short)0x0000, AdditionOperatorsHelper<short, short, short>.op_Addition(unchecked((short)0xFFFF), (short)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
Assert.Equal((short)0x0001, AdditionOperatorsHelper<short, short, short>.op_CheckedAddition((short)0x0000, (short)1));
|
||||
Assert.Equal((short)0x0002, AdditionOperatorsHelper<short, short, short>.op_CheckedAddition((short)0x0001, (short)1));
|
||||
Assert.Equal(unchecked((short)0x8001), AdditionOperatorsHelper<short, short, short>.op_CheckedAddition(unchecked((short)0x8000), (short)1));
|
||||
Assert.Equal((short)0x0000, AdditionOperatorsHelper<short, short, short>.op_CheckedAddition(unchecked((short)0xFFFF), (short)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<short, short, short>.op_CheckedAddition((short)0x7FFF, (short)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -221,6 +232,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((short)0xFFFE), DecrementOperatorsHelper<short>.op_Decrement(unchecked((short)0xFFFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
Assert.Equal(unchecked((short)0xFFFF), DecrementOperatorsHelper<short>.op_CheckedDecrement((short)0x0000));
|
||||
Assert.Equal((short)0x0000, DecrementOperatorsHelper<short>.op_CheckedDecrement((short)0x0001));
|
||||
Assert.Equal((short)0x7FFE, DecrementOperatorsHelper<short>.op_CheckedDecrement((short)0x7FFF));
|
||||
Assert.Equal(unchecked((short)0xFFFE), DecrementOperatorsHelper<short>.op_CheckedDecrement(unchecked((short)0xFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<short>.op_CheckedDecrement(unchecked((short)0x8000)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -229,6 +251,20 @@ namespace System.Tests
|
|||
Assert.Equal((short)0x3FFF, DivisionOperatorsHelper<short, short, short>.op_Division((short)0x7FFF, (short)2));
|
||||
Assert.Equal(unchecked((short)0xC000), DivisionOperatorsHelper<short, short, short>.op_Division(unchecked((short)0x8000), (short)2));
|
||||
Assert.Equal((short)0x0000, DivisionOperatorsHelper<short, short, short>.op_Division(unchecked((short)0xFFFF), (short)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<short, short, short>.op_Division((short)0x0001, (short)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
Assert.Equal((short)0x0000, DivisionOperatorsHelper<short, short, short>.op_CheckedDivision((short)0x0000, (short)2));
|
||||
Assert.Equal((short)0x0000, DivisionOperatorsHelper<short, short, short>.op_CheckedDivision((short)0x0001, (short)2));
|
||||
Assert.Equal((short)0x3FFF, DivisionOperatorsHelper<short, short, short>.op_CheckedDivision((short)0x7FFF, (short)2));
|
||||
Assert.Equal(unchecked((short)0xC000), DivisionOperatorsHelper<short, short, short>.op_CheckedDivision(unchecked((short)0x8000), (short)2));
|
||||
Assert.Equal((short)0x0000, DivisionOperatorsHelper<short, short, short>.op_CheckedDivision(unchecked((short)0xFFFF), (short)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<short, short, short>.op_CheckedDivision((short)0x0001, (short)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -261,6 +297,17 @@ namespace System.Tests
|
|||
Assert.Equal((short)0x0000, IncrementOperatorsHelper<short>.op_Increment(unchecked((short)0xFFFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
Assert.Equal((short)0x0001, IncrementOperatorsHelper<short>.op_CheckedIncrement((short)0x0000));
|
||||
Assert.Equal((short)0x0002, IncrementOperatorsHelper<short>.op_CheckedIncrement((short)0x0001));
|
||||
Assert.Equal(unchecked((short)0x8001), IncrementOperatorsHelper<short>.op_CheckedIncrement(unchecked((short)0x8000)));
|
||||
Assert.Equal((short)0x0000, IncrementOperatorsHelper<short>.op_CheckedIncrement(unchecked((short)0xFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<short>.op_CheckedIncrement((short)0x7FFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -269,6 +316,8 @@ namespace System.Tests
|
|||
Assert.Equal((short)0x0001, ModulusOperatorsHelper<short, short, short>.op_Modulus((short)0x7FFF, (short)2));
|
||||
Assert.Equal((short)0x0000, ModulusOperatorsHelper<short, short, short>.op_Modulus(unchecked((short)0x8000), (short)2));
|
||||
Assert.Equal(unchecked((short)0xFFFF), ModulusOperatorsHelper<short, short, short>.op_Modulus(unchecked((short)0xFFFF), (short)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<short, short, short>.op_Modulus((short)0x0001, (short)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -281,6 +330,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((short)0xFFFE), MultiplyOperatorsHelper<short, short, short>.op_Multiply(unchecked((short)0xFFFF), (short)2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
Assert.Equal((short)0x0000, MultiplyOperatorsHelper<short, short, short>.op_CheckedMultiply((short)0x0000, (short)2));
|
||||
Assert.Equal((short)0x0002, MultiplyOperatorsHelper<short, short, short>.op_CheckedMultiply((short)0x0001, (short)2));
|
||||
Assert.Equal(unchecked((short)0xFFFE), MultiplyOperatorsHelper<short, short, short>.op_CheckedMultiply(unchecked((short)0xFFFF), (short)2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<short, short, short>.op_CheckedMultiply((short)0x7FFF, (short)2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<short, short, short>.op_CheckedMultiply(unchecked((short)0x8000), (short)2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
{
|
||||
|
@ -1009,7 +1069,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
Assert.Equal((short)0x0000, ShiftOperatorsHelper<short, short>.op_LeftShift((short)0x0000, 1));
|
||||
|
@ -1039,6 +1098,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((short)0xFFFE), SubtractionOperatorsHelper<short, short, short>.op_Subtraction(unchecked((short)0xFFFF), (short)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
Assert.Equal(unchecked((short)0xFFFF), SubtractionOperatorsHelper<short, short, short>.op_CheckedSubtraction((short)0x0000, (short)1));
|
||||
Assert.Equal((short)0x0000, SubtractionOperatorsHelper<short, short, short>.op_CheckedSubtraction((short)0x0001, (short)1));
|
||||
Assert.Equal((short)0x7FFE, SubtractionOperatorsHelper<short, short, short>.op_CheckedSubtraction((short)0x7FFF, (short)1));
|
||||
Assert.Equal(unchecked((short)0xFFFE), SubtractionOperatorsHelper<short, short, short>.op_CheckedSubtraction(unchecked((short)0xFFFF), (short)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<short, short, short>.op_CheckedSubtraction(unchecked((short)0x8000), (short)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1049,6 +1119,17 @@ namespace System.Tests
|
|||
Assert.Equal((short)0x0001, UnaryNegationOperatorsHelper<short, short>.op_UnaryNegation(unchecked((short)0xFFFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
Assert.Equal((short)0x0000, UnaryNegationOperatorsHelper<short, short>.op_CheckedUnaryNegation((short)0x0000));
|
||||
Assert.Equal(unchecked((short)0xFFFF), UnaryNegationOperatorsHelper<short, short>.op_CheckedUnaryNegation((short)0x0001));
|
||||
Assert.Equal(unchecked((short)0x8001), UnaryNegationOperatorsHelper<short, short>.op_CheckedUnaryNegation((short)0x7FFF));
|
||||
Assert.Equal((short)0x0001, UnaryNegationOperatorsHelper<short, short>.op_CheckedUnaryNegation(unchecked((short)0xFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<short, short>.op_CheckedUnaryNegation(unchecked((short)0x8000)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
|
@ -61,6 +61,17 @@ namespace System.Tests
|
|||
Assert.Equal((int)0x00000000, AdditionOperatorsHelper<int, int, int>.op_Addition(unchecked((int)0xFFFFFFFF), 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
Assert.Equal((int)0x00000001, AdditionOperatorsHelper<int, int, int>.op_CheckedAddition((int)0x00000000, 1));
|
||||
Assert.Equal((int)0x00000002, AdditionOperatorsHelper<int, int, int>.op_CheckedAddition((int)0x00000001, 1));
|
||||
Assert.Equal(unchecked((int)0x80000001), AdditionOperatorsHelper<int, int, int>.op_CheckedAddition(unchecked((int)0x80000000), 1));
|
||||
Assert.Equal((int)0x00000000, AdditionOperatorsHelper<int, int, int>.op_CheckedAddition(unchecked((int)0xFFFFFFFF), 1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<int, int, int>.op_CheckedAddition((int)0x7FFFFFFF, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -221,6 +232,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((int)0xFFFFFFFE), DecrementOperatorsHelper<int>.op_Decrement(unchecked((int)0xFFFFFFFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
Assert.Equal(unchecked((int)0xFFFFFFFF), DecrementOperatorsHelper<int>.op_CheckedDecrement((int)0x00000000));
|
||||
Assert.Equal((int)0x00000000, DecrementOperatorsHelper<int>.op_CheckedDecrement((int)0x00000001));
|
||||
Assert.Equal((int)0x7FFFFFFE, DecrementOperatorsHelper<int>.op_CheckedDecrement((int)0x7FFFFFFF));
|
||||
Assert.Equal(unchecked((int)0xFFFFFFFE), DecrementOperatorsHelper<int>.op_CheckedDecrement(unchecked((int)0xFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<int>.op_CheckedDecrement(unchecked((int)0x80000000)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -229,6 +251,20 @@ namespace System.Tests
|
|||
Assert.Equal((int)0x3FFFFFFF, DivisionOperatorsHelper<int, int, int>.op_Division((int)0x7FFFFFFF, 2));
|
||||
Assert.Equal(unchecked((int)0xC0000000), DivisionOperatorsHelper<int, int, int>.op_Division(unchecked((int)0x80000000), 2));
|
||||
Assert.Equal((int)0x00000000, DivisionOperatorsHelper<int, int, int>.op_Division(unchecked((int)0xFFFFFFFF), 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<int, int, int>.op_Division((int)0x00000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
Assert.Equal((int)0x00000000, DivisionOperatorsHelper<int, int, int>.op_CheckedDivision((int)0x00000000, 2));
|
||||
Assert.Equal((int)0x00000000, DivisionOperatorsHelper<int, int, int>.op_CheckedDivision((int)0x00000001, 2));
|
||||
Assert.Equal((int)0x3FFFFFFF, DivisionOperatorsHelper<int, int, int>.op_CheckedDivision((int)0x7FFFFFFF, 2));
|
||||
Assert.Equal(unchecked((int)0xC0000000), DivisionOperatorsHelper<int, int, int>.op_CheckedDivision(unchecked((int)0x80000000), 2));
|
||||
Assert.Equal((int)0x00000000, DivisionOperatorsHelper<int, int, int>.op_CheckedDivision(unchecked((int)0xFFFFFFFF), 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<int, int, int>.op_CheckedDivision((int)0x00000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -261,6 +297,17 @@ namespace System.Tests
|
|||
Assert.Equal((int)0x00000000, IncrementOperatorsHelper<int>.op_Increment(unchecked((int)0xFFFFFFFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
Assert.Equal((int)0x00000001, IncrementOperatorsHelper<int>.op_CheckedIncrement((int)0x00000000));
|
||||
Assert.Equal((int)0x00000002, IncrementOperatorsHelper<int>.op_CheckedIncrement((int)0x00000001));
|
||||
Assert.Equal(unchecked((int)0x80000001), IncrementOperatorsHelper<int>.op_CheckedIncrement(unchecked((int)0x80000000)));
|
||||
Assert.Equal((int)0x00000000, IncrementOperatorsHelper<int>.op_CheckedIncrement(unchecked((int)0xFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<int>.op_CheckedIncrement((int)0x7FFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -269,6 +316,8 @@ namespace System.Tests
|
|||
Assert.Equal((int)0x00000001, ModulusOperatorsHelper<int, int, int>.op_Modulus((int)0x7FFFFFFF, 2));
|
||||
Assert.Equal((int)0x00000000, ModulusOperatorsHelper<int, int, int>.op_Modulus(unchecked((int)0x80000000), 2));
|
||||
Assert.Equal(unchecked((int)0xFFFFFFFF), ModulusOperatorsHelper<int, int, int>.op_Modulus(unchecked((int)0xFFFFFFFF), 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<int, int, int>.op_Modulus((int)0x00000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -281,6 +330,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((int)0xFFFFFFFE), MultiplyOperatorsHelper<int, int, int>.op_Multiply(unchecked((int)0xFFFFFFFF), 2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
Assert.Equal((int)0x00000000, MultiplyOperatorsHelper<int, int, int>.op_CheckedMultiply((int)0x00000000, 2));
|
||||
Assert.Equal((int)0x00000002, MultiplyOperatorsHelper<int, int, int>.op_CheckedMultiply((int)0x00000001, 2));
|
||||
Assert.Equal(unchecked((int)0xFFFFFFFE), MultiplyOperatorsHelper<int, int, int>.op_CheckedMultiply(unchecked((int)0xFFFFFFFF), 2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<int, int, int>.op_CheckedMultiply((int)0x7FFFFFFF, 2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<int, int, int>.op_CheckedMultiply(unchecked((int)0x80000000), 2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
{
|
||||
|
@ -1009,7 +1069,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
Assert.Equal((int)0x00000000, ShiftOperatorsHelper<int, int>.op_LeftShift((int)0x00000000, 1));
|
||||
|
@ -1039,6 +1098,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((int)0xFFFFFFFE), SubtractionOperatorsHelper<int, int, int>.op_Subtraction(unchecked((int)0xFFFFFFFF), 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
Assert.Equal(unchecked((int)0xFFFFFFFF), SubtractionOperatorsHelper<int, int, int>.op_CheckedSubtraction((int)0x00000000, 1));
|
||||
Assert.Equal((int)0x00000000, SubtractionOperatorsHelper<int, int, int>.op_CheckedSubtraction((int)0x00000001, 1));
|
||||
Assert.Equal((int)0x7FFFFFFE, SubtractionOperatorsHelper<int, int, int>.op_CheckedSubtraction((int)0x7FFFFFFF, 1));
|
||||
Assert.Equal(unchecked((int)0xFFFFFFFE), SubtractionOperatorsHelper<int, int, int>.op_CheckedSubtraction(unchecked((int)0xFFFFFFFF), 1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<int, int, int>.op_CheckedSubtraction(unchecked((int)0x80000000), 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1049,6 +1119,17 @@ namespace System.Tests
|
|||
Assert.Equal((int)0x00000001, UnaryNegationOperatorsHelper<int, int>.op_UnaryNegation(unchecked((int)0xFFFFFFFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
Assert.Equal((int)0x00000000, UnaryNegationOperatorsHelper<int, int>.op_CheckedUnaryNegation((int)0x00000000));
|
||||
Assert.Equal(unchecked((int)0xFFFFFFFF), UnaryNegationOperatorsHelper<int, int>.op_CheckedUnaryNegation((int)0x00000001));
|
||||
Assert.Equal(unchecked((int)0x80000001), UnaryNegationOperatorsHelper<int, int>.op_CheckedUnaryNegation((int)0x7FFFFFFF));
|
||||
Assert.Equal((int)0x00000001, UnaryNegationOperatorsHelper<int, int>.op_CheckedUnaryNegation(unchecked((int)0xFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<int, int>.op_CheckedUnaryNegation(unchecked((int)0x80000000)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
|
@ -61,6 +61,17 @@ namespace System.Tests
|
|||
Assert.Equal((long)0x0000000000000000, AdditionOperatorsHelper<long, long, long>.op_Addition(unchecked((long)0xFFFFFFFFFFFFFFFF), 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
Assert.Equal((long)0x0000000000000001, AdditionOperatorsHelper<long, long, long>.op_CheckedAddition((long)0x0000000000000000, 1));
|
||||
Assert.Equal((long)0x0000000000000002, AdditionOperatorsHelper<long, long, long>.op_CheckedAddition((long)0x0000000000000001, 1));
|
||||
Assert.Equal(unchecked((long)0x8000000000000001), AdditionOperatorsHelper<long, long, long>.op_CheckedAddition(unchecked((long)0x8000000000000000), 1));
|
||||
Assert.Equal((long)0x0000000000000000, AdditionOperatorsHelper<long, long, long>.op_CheckedAddition(unchecked((long)0xFFFFFFFFFFFFFFFF), 1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<long, long, long>.op_CheckedAddition((long)0x7FFFFFFFFFFFFFFF, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -221,6 +232,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFE), DecrementOperatorsHelper<long>.op_Decrement(unchecked((long)0xFFFFFFFFFFFFFFFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), DecrementOperatorsHelper<long>.op_CheckedDecrement((long)0x0000000000000000));
|
||||
Assert.Equal((long)0x0000000000000000, DecrementOperatorsHelper<long>.op_CheckedDecrement((long)0x0000000000000001));
|
||||
Assert.Equal((long)0x7FFFFFFFFFFFFFFE, DecrementOperatorsHelper<long>.op_CheckedDecrement((long)0x7FFFFFFFFFFFFFFF));
|
||||
Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFE), DecrementOperatorsHelper<long>.op_CheckedDecrement(unchecked((long)0xFFFFFFFFFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<long>.op_CheckedDecrement(unchecked((long)0x8000000000000000)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -229,6 +251,20 @@ namespace System.Tests
|
|||
Assert.Equal((long)0x3FFFFFFFFFFFFFFF, DivisionOperatorsHelper<long, long, long>.op_Division((long)0x7FFFFFFFFFFFFFFF, 2));
|
||||
Assert.Equal(unchecked((long)0xC000000000000000), DivisionOperatorsHelper<long, long, long>.op_Division(unchecked((long)0x8000000000000000), 2));
|
||||
Assert.Equal((long)0x0000000000000000, DivisionOperatorsHelper<long, long, long>.op_Division(unchecked((long)0xFFFFFFFFFFFFFFFF), 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<long, long, long>.op_Division((long)0x0000000000000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
Assert.Equal((long)0x0000000000000000, DivisionOperatorsHelper<long, long, long>.op_CheckedDivision((long)0x0000000000000000, 2));
|
||||
Assert.Equal((long)0x0000000000000000, DivisionOperatorsHelper<long, long, long>.op_CheckedDivision((long)0x0000000000000001, 2));
|
||||
Assert.Equal((long)0x3FFFFFFFFFFFFFFF, DivisionOperatorsHelper<long, long, long>.op_CheckedDivision((long)0x7FFFFFFFFFFFFFFF, 2));
|
||||
Assert.Equal(unchecked((long)0xC000000000000000), DivisionOperatorsHelper<long, long, long>.op_CheckedDivision(unchecked((long)0x8000000000000000), 2));
|
||||
Assert.Equal((long)0x0000000000000000, DivisionOperatorsHelper<long, long, long>.op_CheckedDivision(unchecked((long)0xFFFFFFFFFFFFFFFF), 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<long, long, long>.op_CheckedDivision((long)0x0000000000000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -261,6 +297,17 @@ namespace System.Tests
|
|||
Assert.Equal((long)0x0000000000000000, IncrementOperatorsHelper<long>.op_Increment(unchecked((long)0xFFFFFFFFFFFFFFFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
Assert.Equal((long)0x0000000000000001, IncrementOperatorsHelper<long>.op_CheckedIncrement((long)0x0000000000000000));
|
||||
Assert.Equal((long)0x0000000000000002, IncrementOperatorsHelper<long>.op_CheckedIncrement((long)0x0000000000000001));
|
||||
Assert.Equal(unchecked((long)0x8000000000000001), IncrementOperatorsHelper<long>.op_CheckedIncrement(unchecked((long)0x8000000000000000)));
|
||||
Assert.Equal((long)0x0000000000000000, IncrementOperatorsHelper<long>.op_CheckedIncrement(unchecked((long)0xFFFFFFFFFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<long>.op_CheckedIncrement((long)0x7FFFFFFFFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -269,6 +316,8 @@ namespace System.Tests
|
|||
Assert.Equal((long)0x0000000000000001, ModulusOperatorsHelper<long, long, long>.op_Modulus((long)0x7FFFFFFFFFFFFFFF, 2));
|
||||
Assert.Equal((long)0x0000000000000000, ModulusOperatorsHelper<long, long, long>.op_Modulus(unchecked((long)0x8000000000000000), 2));
|
||||
Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), ModulusOperatorsHelper<long, long, long>.op_Modulus(unchecked((long)0xFFFFFFFFFFFFFFFF), 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<long, long, long>.op_Modulus((long)0x0000000000000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -281,6 +330,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFE), MultiplyOperatorsHelper<long, long, long>.op_Multiply(unchecked((long)0xFFFFFFFFFFFFFFFF), 2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
Assert.Equal((long)0x0000000000000000, MultiplyOperatorsHelper<long, long, long>.op_CheckedMultiply((long)0x0000000000000000, 2));
|
||||
Assert.Equal((long)0x0000000000000002, MultiplyOperatorsHelper<long, long, long>.op_CheckedMultiply((long)0x0000000000000001, 2));
|
||||
Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFE), MultiplyOperatorsHelper<long, long, long>.op_CheckedMultiply(unchecked((long)0xFFFFFFFFFFFFFFFF), 2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<long, long, long>.op_CheckedMultiply((long)0x7FFFFFFFFFFFFFFF, 2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<long, long, long>.op_CheckedMultiply(unchecked((long)0x8000000000000000), 2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
{
|
||||
|
@ -1009,7 +1069,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
Assert.Equal((long)0x0000000000000000, ShiftOperatorsHelper<long, long>.op_LeftShift((long)0x0000000000000000, 1));
|
||||
|
@ -1039,6 +1098,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFE), SubtractionOperatorsHelper<long, long, long>.op_Subtraction(unchecked((long)0xFFFFFFFFFFFFFFFF), 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), SubtractionOperatorsHelper<long, long, long>.op_CheckedSubtraction((long)0x0000000000000000, 1));
|
||||
Assert.Equal((long)0x0000000000000000, SubtractionOperatorsHelper<long, long, long>.op_CheckedSubtraction((long)0x0000000000000001, 1));
|
||||
Assert.Equal((long)0x7FFFFFFFFFFFFFFE, SubtractionOperatorsHelper<long, long, long>.op_CheckedSubtraction((long)0x7FFFFFFFFFFFFFFF, 1));
|
||||
Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFE), SubtractionOperatorsHelper<long, long, long>.op_CheckedSubtraction(unchecked((long)0xFFFFFFFFFFFFFFFF), 1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<long, long, long>.op_CheckedSubtraction(unchecked((long)0x8000000000000000), 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1049,6 +1119,17 @@ namespace System.Tests
|
|||
Assert.Equal((long)0x0000000000000001, UnaryNegationOperatorsHelper<long, long>.op_UnaryNegation(unchecked((long)0xFFFFFFFFFFFFFFFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
Assert.Equal((long)0x0000000000000000, UnaryNegationOperatorsHelper<long, long>.op_CheckedUnaryNegation((long)0x0000000000000000));
|
||||
Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), UnaryNegationOperatorsHelper<long, long>.op_CheckedUnaryNegation((long)0x0000000000000001));
|
||||
Assert.Equal(unchecked((long)0x8000000000000001), UnaryNegationOperatorsHelper<long, long>.op_CheckedUnaryNegation((long)0x7FFFFFFFFFFFFFFF));
|
||||
Assert.Equal((long)0x0000000000000001, UnaryNegationOperatorsHelper<long, long>.op_CheckedUnaryNegation(unchecked((long)0xFFFFFFFFFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<long, long>.op_CheckedUnaryNegation(unchecked((long)0x8000000000000000)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
|
@ -93,6 +93,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nint)0x0000000000000001), AdditionOperatorsHelper<nint, nint, nint>.op_CheckedAddition(unchecked((nint)0x0000000000000000), (nint)1));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000002), AdditionOperatorsHelper<nint, nint, nint>.op_CheckedAddition(unchecked((nint)0x0000000000000001), (nint)1));
|
||||
Assert.Equal(unchecked((nint)0x8000000000000001), AdditionOperatorsHelper<nint, nint, nint>.op_CheckedAddition(unchecked((nint)0x8000000000000000), (nint)1));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), AdditionOperatorsHelper<nint, nint, nint>.op_CheckedAddition(unchecked((nint)0xFFFFFFFFFFFFFFFF), (nint)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<nint, nint, nint>.op_CheckedAddition(unchecked((nint)0x7FFFFFFFFFFFFFFF), (nint)1));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nint)0x00000001, AdditionOperatorsHelper<nint, nint, nint>.op_CheckedAddition((nint)0x00000000, (nint)1));
|
||||
Assert.Equal((nint)0x00000002, AdditionOperatorsHelper<nint, nint, nint>.op_CheckedAddition((nint)0x00000001, (nint)1));
|
||||
Assert.Equal(unchecked((nint)0x80000001), AdditionOperatorsHelper<nint, nint, nint>.op_CheckedAddition(unchecked((nint)0x80000000), (nint)1));
|
||||
Assert.Equal((nint)0x00000000, AdditionOperatorsHelper<nint, nint, nint>.op_CheckedAddition(unchecked((nint)0xFFFFFFFF), (nint)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<nint, nint, nint>.op_CheckedAddition((nint)0x7FFFFFFF, (nint)1));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -429,6 +452,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFF), DecrementOperatorsHelper<nint>.op_CheckedDecrement(unchecked((nint)0x0000000000000000)));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), DecrementOperatorsHelper<nint>.op_CheckedDecrement(unchecked((nint)0x0000000000000001)));
|
||||
Assert.Equal(unchecked((nint)0x7FFFFFFFFFFFFFFE), DecrementOperatorsHelper<nint>.op_CheckedDecrement(unchecked((nint)0x7FFFFFFFFFFFFFFF)));
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFE), DecrementOperatorsHelper<nint>.op_CheckedDecrement(unchecked((nint)0xFFFFFFFFFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<nint>.op_CheckedDecrement(unchecked((nint)0x8000000000000000)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFF), DecrementOperatorsHelper<nint>.op_CheckedDecrement((nint)0x00000000));
|
||||
Assert.Equal((nint)0x00000000, DecrementOperatorsHelper<nint>.op_CheckedDecrement((nint)0x00000001));
|
||||
Assert.Equal((nint)0x7FFFFFFE, DecrementOperatorsHelper<nint>.op_CheckedDecrement((nint)0x7FFFFFFF));
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFE), DecrementOperatorsHelper<nint>.op_CheckedDecrement(unchecked((nint)0xFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<nint>.op_CheckedDecrement(unchecked((nint)0x80000000)));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -439,6 +485,8 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((nint)0x3FFFFFFFFFFFFFFF), DivisionOperatorsHelper<nint, nint, nint>.op_Division(unchecked((nint)0x7FFFFFFFFFFFFFFF), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0xC000000000000000), DivisionOperatorsHelper<nint, nint, nint>.op_Division(unchecked((nint)0x8000000000000000), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), DivisionOperatorsHelper<nint, nint, nint>.op_Division(unchecked((nint)0xFFFFFFFFFFFFFFFF), (nint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<nint, nint, nint>.op_Division(unchecked((nint)0x0000000000000001), (nint)0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -447,6 +495,33 @@ namespace System.Tests
|
|||
Assert.Equal((nint)0x3FFFFFFF, DivisionOperatorsHelper<nint, nint, nint>.op_Division((nint)0x7FFFFFFF, (nint)2));
|
||||
Assert.Equal(unchecked((nint)0xC0000000), DivisionOperatorsHelper<nint, nint, nint>.op_Division(unchecked((nint)0x80000000), (nint)2));
|
||||
Assert.Equal((nint)0x00000000, DivisionOperatorsHelper<nint, nint, nint>.op_Division(unchecked((nint)0xFFFFFFFF), (nint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<nint, nint, nint>.op_Division((nint)0x00000001, (nint)0));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision(unchecked((nint)0x0000000000000000), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision(unchecked((nint)0x0000000000000001), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0x3FFFFFFFFFFFFFFF), DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision(unchecked((nint)0x7FFFFFFFFFFFFFFF), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0xC000000000000000), DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision(unchecked((nint)0x8000000000000000), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision(unchecked((nint)0xFFFFFFFFFFFFFFFF), (nint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision(unchecked((nint)0x0000000000000001), (nint)0));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nint)0x00000000, DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision((nint)0x00000000, (nint)2));
|
||||
Assert.Equal((nint)0x00000000, DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision((nint)0x00000001, (nint)2));
|
||||
Assert.Equal((nint)0x3FFFFFFF, DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision((nint)0x7FFFFFFF, (nint)2));
|
||||
Assert.Equal(unchecked((nint)0xC0000000), DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision(unchecked((nint)0x80000000), (nint)2));
|
||||
Assert.Equal((nint)0x00000000, DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision(unchecked((nint)0xFFFFFFFF), (nint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<nint, nint, nint>.op_CheckedDivision((nint)0x00000001, (nint)0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -513,6 +588,30 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nint)0x0000000000000001), IncrementOperatorsHelper<nint>.op_CheckedIncrement(unchecked((nint)0x0000000000000000)));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000002), IncrementOperatorsHelper<nint>.op_CheckedIncrement(unchecked((nint)0x0000000000000001)));
|
||||
Assert.Equal(unchecked((nint)0x8000000000000001), IncrementOperatorsHelper<nint>.op_CheckedIncrement(unchecked((nint)0x8000000000000000)));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), IncrementOperatorsHelper<nint>.op_CheckedIncrement(unchecked((nint)0xFFFFFFFFFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<nint>.op_CheckedIncrement(unchecked((nint)0x7FFFFFFFFFFFFFFF)));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nint)0x00000001, IncrementOperatorsHelper<nint>.op_CheckedIncrement((nint)0x00000000));
|
||||
Assert.Equal((nint)0x00000002, IncrementOperatorsHelper<nint>.op_CheckedIncrement((nint)0x00000001));
|
||||
Assert.Equal(unchecked((nint)0x80000001), IncrementOperatorsHelper<nint>.op_CheckedIncrement(unchecked((nint)0x80000000)));
|
||||
Assert.Equal((nint)0x00000000, IncrementOperatorsHelper<nint>.op_CheckedIncrement(unchecked((nint)0xFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<nint>.op_CheckedIncrement((nint)0x7FFFFFFF));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -523,6 +622,8 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((nint)0x0000000000000001), ModulusOperatorsHelper<nint, nint, nint>.op_Modulus(unchecked((nint)0x7FFFFFFFFFFFFFFF), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), ModulusOperatorsHelper<nint, nint, nint>.op_Modulus(unchecked((nint)0x8000000000000000), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFF), ModulusOperatorsHelper<nint, nint, nint>.op_Modulus(unchecked((nint)0xFFFFFFFFFFFFFFFF), (nint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<nint, nint, nint>.op_Modulus(unchecked((nint)0x0000000000000001), (nint)0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -531,6 +632,8 @@ namespace System.Tests
|
|||
Assert.Equal((nint)0x00000001, ModulusOperatorsHelper<nint, nint, nint>.op_Modulus((nint)0x7FFFFFFF, (nint)2));
|
||||
Assert.Equal((nint)0x00000000, ModulusOperatorsHelper<nint, nint, nint>.op_Modulus(unchecked((nint)0x80000000), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFF), ModulusOperatorsHelper<nint, nint, nint>.op_Modulus(unchecked((nint)0xFFFFFFFF), (nint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<nint, nint, nint>.op_Modulus((nint)0x00000001, (nint)0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -555,6 +658,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), MultiplyOperatorsHelper<nint, nint, nint>.op_CheckedMultiply(unchecked((nint)0x0000000000000000), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000002), MultiplyOperatorsHelper<nint, nint, nint>.op_CheckedMultiply(unchecked((nint)0x0000000000000001), (nint)2));
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFE), MultiplyOperatorsHelper<nint, nint, nint>.op_CheckedMultiply(unchecked((nint)0xFFFFFFFFFFFFFFFF), (nint)2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<nint, nint, nint>.op_CheckedMultiply(unchecked((nint)0x7FFFFFFFFFFFFFFF), (nint)2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<nint, nint, nint>.op_CheckedMultiply(unchecked((nint)0x8000000000000000), (nint)2));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nint)0x00000000, MultiplyOperatorsHelper<nint, nint, nint>.op_CheckedMultiply((nint)0x00000000, (nint)2));
|
||||
Assert.Equal((nint)0x00000002, MultiplyOperatorsHelper<nint, nint, nint>.op_CheckedMultiply((nint)0x00000001, (nint)2));
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFE), MultiplyOperatorsHelper<nint, nint, nint>.op_CheckedMultiply(unchecked((nint)0xFFFFFFFF), (nint)2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<nint, nint, nint>.op_CheckedMultiply((nint)0x7FFFFFFF, (nint)2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<nint, nint, nint>.op_CheckedMultiply(unchecked((nint)0x80000000), (nint)2));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
{
|
||||
|
@ -1519,7 +1645,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
|
@ -1582,6 +1707,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFF), SubtractionOperatorsHelper<nint, nint, nint>.op_CheckedSubtraction(unchecked((nint)0x0000000000000000), (nint)1));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), SubtractionOperatorsHelper<nint, nint, nint>.op_CheckedSubtraction(unchecked((nint)0x0000000000000001), (nint)1));
|
||||
Assert.Equal(unchecked((nint)0x7FFFFFFFFFFFFFFE), SubtractionOperatorsHelper<nint, nint, nint>.op_CheckedSubtraction(unchecked((nint)0x7FFFFFFFFFFFFFFF), (nint)1));
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFE), SubtractionOperatorsHelper<nint, nint, nint>.op_CheckedSubtraction(unchecked((nint)0xFFFFFFFFFFFFFFFF), (nint)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<nint, nint, nint>.op_CheckedSubtraction(unchecked((nint)0x8000000000000000), (nint)1));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFF), SubtractionOperatorsHelper<nint, nint, nint>.op_CheckedSubtraction((nint)0x00000000, (nint)1));
|
||||
Assert.Equal((nint)0x00000000, SubtractionOperatorsHelper<nint, nint, nint>.op_CheckedSubtraction((nint)0x00000001, (nint)1));
|
||||
Assert.Equal((nint)0x7FFFFFFE, SubtractionOperatorsHelper<nint, nint, nint>.op_CheckedSubtraction((nint)0x7FFFFFFF, (nint)1));
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFE), SubtractionOperatorsHelper<nint, nint, nint>.op_CheckedSubtraction(unchecked((nint)0xFFFFFFFF), (nint)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<nint, nint, nint>.op_CheckedSubtraction(unchecked((nint)0x80000000), (nint)1));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1603,6 +1751,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nint)0x0000000000000000), UnaryNegationOperatorsHelper<nint, nint>.op_CheckedUnaryNegation(unchecked((nint)0x0000000000000000)));
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFF), UnaryNegationOperatorsHelper<nint, nint>.op_CheckedUnaryNegation(unchecked((nint)0x0000000000000001)));
|
||||
Assert.Equal(unchecked((nint)0x8000000000000001), UnaryNegationOperatorsHelper<nint, nint>.op_CheckedUnaryNegation(unchecked((nint)0x7FFFFFFFFFFFFFFF)));
|
||||
Assert.Equal(unchecked((nint)0x0000000000000001), UnaryNegationOperatorsHelper<nint, nint>.op_CheckedUnaryNegation(unchecked((nint)0xFFFFFFFFFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<nint, nint>.op_CheckedUnaryNegation(unchecked((nint)0x8000000000000000)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nint)0x00000000, UnaryNegationOperatorsHelper<nint, nint>.op_CheckedUnaryNegation((nint)0x00000000));
|
||||
Assert.Equal(unchecked((nint)0xFFFFFFFF), UnaryNegationOperatorsHelper<nint, nint>.op_CheckedUnaryNegation((nint)0x00000001));
|
||||
Assert.Equal(unchecked((nint)0x80000001), UnaryNegationOperatorsHelper<nint, nint>.op_CheckedUnaryNegation((nint)0x7FFFFFFF));
|
||||
Assert.Equal((nint)0x00000001, UnaryNegationOperatorsHelper<nint, nint>.op_CheckedUnaryNegation(unchecked((nint)0xFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<nint, nint>.op_CheckedUnaryNegation(unchecked((nint)0x80000000)));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
|
@ -61,6 +61,17 @@ namespace System.Tests
|
|||
Assert.Equal((sbyte)0x00, AdditionOperatorsHelper<sbyte, sbyte, sbyte>.op_Addition(unchecked((sbyte)0xFF), (sbyte)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
Assert.Equal((sbyte)0x01, AdditionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedAddition((sbyte)0x00, (sbyte)1));
|
||||
Assert.Equal((sbyte)0x02, AdditionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedAddition((sbyte)0x01, (sbyte)1));
|
||||
Assert.Equal(unchecked((sbyte)0x81), AdditionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedAddition(unchecked((sbyte)0x80), (sbyte)1));
|
||||
Assert.Equal((sbyte)0x00, AdditionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedAddition(unchecked((sbyte)0xFF), (sbyte)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedAddition((sbyte)0x7F, (sbyte)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -221,6 +232,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((sbyte)0xFE), DecrementOperatorsHelper<sbyte>.op_Decrement(unchecked((sbyte)0xFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
Assert.Equal(unchecked((sbyte)0xFF), DecrementOperatorsHelper<sbyte>.op_CheckedDecrement((sbyte)0x00));
|
||||
Assert.Equal((sbyte)0x00, DecrementOperatorsHelper<sbyte>.op_CheckedDecrement((sbyte)0x01));
|
||||
Assert.Equal((sbyte)0x7E, DecrementOperatorsHelper<sbyte>.op_CheckedDecrement((sbyte)0x7F));
|
||||
Assert.Equal(unchecked((sbyte)0xFE), DecrementOperatorsHelper<sbyte>.op_CheckedDecrement(unchecked((sbyte)0xFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<sbyte>.op_CheckedDecrement(unchecked((sbyte)0x80)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -229,6 +251,20 @@ namespace System.Tests
|
|||
Assert.Equal((sbyte)0x3F, DivisionOperatorsHelper<sbyte, sbyte, sbyte>.op_Division((sbyte)0x7F, (sbyte)2));
|
||||
Assert.Equal(unchecked((sbyte)0xC0), DivisionOperatorsHelper<sbyte, sbyte, sbyte>.op_Division(unchecked((sbyte)0x80), (sbyte)2));
|
||||
Assert.Equal((sbyte)0x00, DivisionOperatorsHelper<sbyte, sbyte, sbyte>.op_Division(unchecked((sbyte)0xFF), (sbyte)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<sbyte, sbyte, sbyte>.op_Division((sbyte)0x01, (sbyte)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
Assert.Equal((sbyte)0x00, DivisionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedDivision((sbyte)0x00, (sbyte)2));
|
||||
Assert.Equal((sbyte)0x00, DivisionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedDivision((sbyte)0x01, (sbyte)2));
|
||||
Assert.Equal((sbyte)0x3F, DivisionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedDivision((sbyte)0x7F, (sbyte)2));
|
||||
Assert.Equal(unchecked((sbyte)0xC0), DivisionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedDivision(unchecked((sbyte)0x80), (sbyte)2));
|
||||
Assert.Equal((sbyte)0x00, DivisionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedDivision(unchecked((sbyte)0xFF), (sbyte)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedDivision((sbyte)0x01, (sbyte)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -261,6 +297,17 @@ namespace System.Tests
|
|||
Assert.Equal((sbyte)0x00, IncrementOperatorsHelper<sbyte>.op_Increment(unchecked((sbyte)0xFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
Assert.Equal((sbyte)0x01, IncrementOperatorsHelper<sbyte>.op_CheckedIncrement((sbyte)0x00));
|
||||
Assert.Equal((sbyte)0x02, IncrementOperatorsHelper<sbyte>.op_CheckedIncrement((sbyte)0x01));
|
||||
Assert.Equal(unchecked((sbyte)0x81), IncrementOperatorsHelper<sbyte>.op_CheckedIncrement(unchecked((sbyte)0x80)));
|
||||
Assert.Equal((sbyte)0x00, IncrementOperatorsHelper<sbyte>.op_CheckedIncrement(unchecked((sbyte)0xFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<sbyte>.op_CheckedIncrement((sbyte)0x7F));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -269,6 +316,8 @@ namespace System.Tests
|
|||
Assert.Equal((sbyte)0x01, ModulusOperatorsHelper<sbyte, sbyte, sbyte>.op_Modulus((sbyte)0x7F, (sbyte)2));
|
||||
Assert.Equal((sbyte)0x00, ModulusOperatorsHelper<sbyte, sbyte, sbyte>.op_Modulus(unchecked((sbyte)0x80), (sbyte)2));
|
||||
Assert.Equal(unchecked((sbyte)0xFF), ModulusOperatorsHelper<sbyte, sbyte, sbyte>.op_Modulus(unchecked((sbyte)0xFF), (sbyte)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<sbyte, sbyte, sbyte>.op_Modulus((sbyte)0x01, (sbyte)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -281,6 +330,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((sbyte)0xFE), MultiplyOperatorsHelper<sbyte, sbyte, sbyte>.op_Multiply(unchecked((sbyte)0xFF), (sbyte)2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
Assert.Equal((sbyte)0x00, MultiplyOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedMultiply((sbyte)0x00, (sbyte)2));
|
||||
Assert.Equal((sbyte)0x02, MultiplyOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedMultiply((sbyte)0x01, (sbyte)2));
|
||||
Assert.Equal(unchecked((sbyte)0xFE), MultiplyOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedMultiply(unchecked((sbyte)0xFF), (sbyte)2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedMultiply((sbyte)0x7F, (sbyte)2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedMultiply(unchecked((sbyte)0x80), (sbyte)2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
{
|
||||
|
@ -1009,7 +1069,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
Assert.Equal((sbyte)0x00, ShiftOperatorsHelper<sbyte, sbyte>.op_LeftShift((sbyte)0x00, 1));
|
||||
|
@ -1039,6 +1098,17 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((sbyte)0xFE), SubtractionOperatorsHelper<sbyte, sbyte, sbyte>.op_Subtraction(unchecked((sbyte)0xFF), (sbyte)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
Assert.Equal(unchecked((sbyte)0xFF), SubtractionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedSubtraction((sbyte)0x00, (sbyte)1));
|
||||
Assert.Equal((sbyte)0x00, SubtractionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedSubtraction((sbyte)0x01, (sbyte)1));
|
||||
Assert.Equal((sbyte)0x7E, SubtractionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedSubtraction((sbyte)0x7F, (sbyte)1));
|
||||
Assert.Equal(unchecked((sbyte)0xFE), SubtractionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedSubtraction(unchecked((sbyte)0xFF), (sbyte)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<sbyte, sbyte, sbyte>.op_CheckedSubtraction(unchecked((sbyte)0x80), (sbyte)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1049,6 +1119,17 @@ namespace System.Tests
|
|||
Assert.Equal((sbyte)0x01, UnaryNegationOperatorsHelper<sbyte, sbyte>.op_UnaryNegation(unchecked((sbyte)0xFF)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
Assert.Equal((sbyte)0x00, UnaryNegationOperatorsHelper<sbyte, sbyte>.op_CheckedUnaryNegation((sbyte)0x00));
|
||||
Assert.Equal(unchecked((sbyte)0xFF), UnaryNegationOperatorsHelper<sbyte, sbyte>.op_CheckedUnaryNegation((sbyte)0x01));
|
||||
Assert.Equal(unchecked((sbyte)0x81), UnaryNegationOperatorsHelper<sbyte, sbyte>.op_CheckedUnaryNegation((sbyte)0x7F));
|
||||
Assert.Equal((sbyte)0x01, UnaryNegationOperatorsHelper<sbyte, sbyte>.op_CheckedUnaryNegation(unchecked((sbyte)0xFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<sbyte, sbyte>.op_CheckedUnaryNegation(unchecked((sbyte)0x80)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
|
@ -55,6 +55,17 @@ namespace System.Tests
|
|||
Assert.Equal((ushort)0x0000, AdditionOperatorsHelper<ushort, ushort, ushort>.op_Addition((ushort)0xFFFF, (ushort)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
Assert.Equal((ushort)0x0001, AdditionOperatorsHelper<ushort, ushort, ushort>.op_CheckedAddition((ushort)0x0000, (ushort)1));
|
||||
Assert.Equal((ushort)0x0002, AdditionOperatorsHelper<ushort, ushort, ushort>.op_CheckedAddition((ushort)0x0001, (ushort)1));
|
||||
Assert.Equal((ushort)0x8000, AdditionOperatorsHelper<ushort, ushort, ushort>.op_CheckedAddition((ushort)0x7FFF, (ushort)1));
|
||||
Assert.Equal((ushort)0x8001, AdditionOperatorsHelper<ushort, ushort, ushort>.op_CheckedAddition((ushort)0x8000, (ushort)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<ushort, ushort, ushort>.op_CheckedAddition((ushort)0xFFFF, (ushort)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -215,6 +226,17 @@ namespace System.Tests
|
|||
Assert.Equal((ushort)0xFFFE, DecrementOperatorsHelper<ushort>.op_Decrement((ushort)0xFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
Assert.Equal((ushort)0x0000, DecrementOperatorsHelper<ushort>.op_CheckedDecrement((ushort)0x0001));
|
||||
Assert.Equal((ushort)0x7FFE, DecrementOperatorsHelper<ushort>.op_CheckedDecrement((ushort)0x7FFF));
|
||||
Assert.Equal((ushort)0x7FFF, DecrementOperatorsHelper<ushort>.op_CheckedDecrement((ushort)0x8000));
|
||||
Assert.Equal((ushort)0xFFFE, DecrementOperatorsHelper<ushort>.op_CheckedDecrement((ushort)0xFFFF));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<ushort>.op_CheckedDecrement((ushort)0x0000));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -223,6 +245,20 @@ namespace System.Tests
|
|||
Assert.Equal((ushort)0x3FFF, DivisionOperatorsHelper<ushort, ushort, ushort>.op_Division((ushort)0x7FFF, (ushort)2));
|
||||
Assert.Equal((ushort)0x4000, DivisionOperatorsHelper<ushort, ushort, ushort>.op_Division((ushort)0x8000, (ushort)2));
|
||||
Assert.Equal((ushort)0x7FFF, DivisionOperatorsHelper<ushort, ushort, ushort>.op_Division((ushort)0xFFFF, (ushort)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<ushort, ushort, ushort>.op_Division((ushort)0x0001, (ushort)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
Assert.Equal((ushort)0x0000, DivisionOperatorsHelper<ushort, ushort, ushort>.op_CheckedDivision((ushort)0x0000, (ushort)2));
|
||||
Assert.Equal((ushort)0x0000, DivisionOperatorsHelper<ushort, ushort, ushort>.op_CheckedDivision((ushort)0x0001, (ushort)2));
|
||||
Assert.Equal((ushort)0x3FFF, DivisionOperatorsHelper<ushort, ushort, ushort>.op_CheckedDivision((ushort)0x7FFF, (ushort)2));
|
||||
Assert.Equal((ushort)0x4000, DivisionOperatorsHelper<ushort, ushort, ushort>.op_CheckedDivision((ushort)0x8000, (ushort)2));
|
||||
Assert.Equal((ushort)0x7FFF, DivisionOperatorsHelper<ushort, ushort, ushort>.op_CheckedDivision((ushort)0xFFFF, (ushort)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<ushort, ushort, ushort>.op_CheckedDivision((ushort)0x0001, (ushort)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -255,6 +291,17 @@ namespace System.Tests
|
|||
Assert.Equal((ushort)0x0000, IncrementOperatorsHelper<ushort>.op_Increment((ushort)0xFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
Assert.Equal((ushort)0x0001, IncrementOperatorsHelper<ushort>.op_CheckedIncrement((ushort)0x0000));
|
||||
Assert.Equal((ushort)0x0002, IncrementOperatorsHelper<ushort>.op_CheckedIncrement((ushort)0x0001));
|
||||
Assert.Equal((ushort)0x8000, IncrementOperatorsHelper<ushort>.op_CheckedIncrement((ushort)0x7FFF));
|
||||
Assert.Equal((ushort)0x8001, IncrementOperatorsHelper<ushort>.op_CheckedIncrement((ushort)0x8000));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<ushort>.op_CheckedIncrement((ushort)0xFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -263,6 +310,8 @@ namespace System.Tests
|
|||
Assert.Equal((ushort)0x0001, ModulusOperatorsHelper<ushort, ushort, ushort>.op_Modulus((ushort)0x7FFF, (ushort)2));
|
||||
Assert.Equal((ushort)0x0000, ModulusOperatorsHelper<ushort, ushort, ushort>.op_Modulus((ushort)0x8000, (ushort)2));
|
||||
Assert.Equal((ushort)0x0001, ModulusOperatorsHelper<ushort, ushort, ushort>.op_Modulus((ushort)0xFFFF, (ushort)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<ushort, ushort, ushort>.op_Modulus((ushort)0x0001, (ushort)0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -275,6 +324,17 @@ namespace System.Tests
|
|||
Assert.Equal((ushort)0xFFFE, MultiplyOperatorsHelper<ushort, ushort, ushort>.op_Multiply((ushort)0xFFFF, (ushort)2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
Assert.Equal((ushort)0x0000, MultiplyOperatorsHelper<ushort, ushort, ushort>.op_CheckedMultiply((ushort)0x0000, (ushort)2));
|
||||
Assert.Equal((ushort)0x0002, MultiplyOperatorsHelper<ushort, ushort, ushort>.op_CheckedMultiply((ushort)0x0001, (ushort)2));
|
||||
Assert.Equal((ushort)0xFFFE, MultiplyOperatorsHelper<ushort, ushort, ushort>.op_CheckedMultiply((ushort)0x7FFF, (ushort)2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<ushort, ushort, ushort>.op_CheckedMultiply((ushort)0x8000, (ushort)2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<ushort, ushort, ushort>.op_CheckedMultiply((ushort)0xFFFF, (ushort)2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
{
|
||||
|
@ -1003,7 +1063,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
Assert.Equal((ushort)0x0000, ShiftOperatorsHelper<ushort, ushort>.op_LeftShift((ushort)0x0000, 1));
|
||||
|
@ -1033,6 +1092,17 @@ namespace System.Tests
|
|||
Assert.Equal((ushort)0xFFFE, SubtractionOperatorsHelper<ushort, ushort, ushort>.op_Subtraction((ushort)0xFFFF, (ushort)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
Assert.Equal((ushort)0x0000, SubtractionOperatorsHelper<ushort, ushort, ushort>.op_CheckedSubtraction((ushort)0x0001, (ushort)1));
|
||||
Assert.Equal((ushort)0x7FFE, SubtractionOperatorsHelper<ushort, ushort, ushort>.op_CheckedSubtraction((ushort)0x7FFF, (ushort)1));
|
||||
Assert.Equal((ushort)0x7FFF, SubtractionOperatorsHelper<ushort, ushort, ushort>.op_CheckedSubtraction((ushort)0x8000, (ushort)1));
|
||||
Assert.Equal((ushort)0xFFFE, SubtractionOperatorsHelper<ushort, ushort, ushort>.op_CheckedSubtraction((ushort)0xFFFF, (ushort)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<ushort, ushort, ushort>.op_CheckedSubtraction((ushort)0x0000, (ushort)1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1043,6 +1113,17 @@ namespace System.Tests
|
|||
Assert.Equal((ushort)0x0001, UnaryNegationOperatorsHelper<ushort, ushort>.op_UnaryNegation((ushort)0xFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
Assert.Equal((ushort)0x0000, UnaryNegationOperatorsHelper<ushort, ushort>.op_CheckedUnaryNegation((ushort)0x0000));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<ushort, ushort>.op_CheckedUnaryNegation((ushort)0x0001));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<ushort, ushort>.op_CheckedUnaryNegation((ushort)0x7FFF));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<ushort, ushort>.op_CheckedUnaryNegation((ushort)0x8000));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<ushort, ushort>.op_CheckedUnaryNegation((ushort)0xFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
|
@ -55,6 +55,18 @@ namespace System.Tests
|
|||
Assert.Equal((uint)0x00000000, AdditionOperatorsHelper<uint, uint, uint>.op_Addition((uint)0xFFFFFFFF, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
Assert.Equal((uint)0x00000001, AdditionOperatorsHelper<uint, uint, uint>.op_CheckedAddition((uint)0x00000000, 1));
|
||||
Assert.Equal((uint)0x00000002, AdditionOperatorsHelper<uint, uint, uint>.op_CheckedAddition((uint)0x00000001, 1));
|
||||
Assert.Equal((uint)0x80000000, AdditionOperatorsHelper<uint, uint, uint>.op_CheckedAddition((uint)0x7FFFFFFF, 1));
|
||||
Assert.Equal((uint)0x80000001, AdditionOperatorsHelper<uint, uint, uint>.op_CheckedAddition((uint)0x80000000, 1));
|
||||
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<uint, uint, uint>.op_CheckedAddition((uint)0xFFFFFFFF, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -215,6 +227,17 @@ namespace System.Tests
|
|||
Assert.Equal((uint)0xFFFFFFFE, DecrementOperatorsHelper<uint>.op_Decrement((uint)0xFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
Assert.Equal((uint)0x00000000, DecrementOperatorsHelper<uint>.op_CheckedDecrement((uint)0x00000001));
|
||||
Assert.Equal((uint)0x7FFFFFFE, DecrementOperatorsHelper<uint>.op_CheckedDecrement((uint)0x7FFFFFFF));
|
||||
Assert.Equal((uint)0x7FFFFFFF, DecrementOperatorsHelper<uint>.op_CheckedDecrement((uint)0x80000000));
|
||||
Assert.Equal((uint)0xFFFFFFFE, DecrementOperatorsHelper<uint>.op_CheckedDecrement((uint)0xFFFFFFFF));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<uint>.op_CheckedDecrement((uint)0x00000000));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -223,6 +246,20 @@ namespace System.Tests
|
|||
Assert.Equal((uint)0x3FFFFFFF, DivisionOperatorsHelper<uint, uint, uint>.op_Division((uint)0x7FFFFFFF, 2));
|
||||
Assert.Equal((uint)0x40000000, DivisionOperatorsHelper<uint, uint, uint>.op_Division((uint)0x80000000, 2));
|
||||
Assert.Equal((uint)0x7FFFFFFF, DivisionOperatorsHelper<uint, uint, uint>.op_Division((uint)0xFFFFFFFF, 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<uint, uint, uint>.op_Division((uint)0x00000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
Assert.Equal((uint)0x00000000, DivisionOperatorsHelper<uint, uint, uint>.op_CheckedDivision((uint)0x00000000, 2));
|
||||
Assert.Equal((uint)0x00000000, DivisionOperatorsHelper<uint, uint, uint>.op_CheckedDivision((uint)0x00000001, 2));
|
||||
Assert.Equal((uint)0x3FFFFFFF, DivisionOperatorsHelper<uint, uint, uint>.op_CheckedDivision((uint)0x7FFFFFFF, 2));
|
||||
Assert.Equal((uint)0x40000000, DivisionOperatorsHelper<uint, uint, uint>.op_CheckedDivision((uint)0x80000000, 2));
|
||||
Assert.Equal((uint)0x7FFFFFFF, DivisionOperatorsHelper<uint, uint, uint>.op_CheckedDivision((uint)0xFFFFFFFF, 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<uint, uint, uint>.op_CheckedDivision((uint)0x00000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -255,6 +292,17 @@ namespace System.Tests
|
|||
Assert.Equal((uint)0x00000000, IncrementOperatorsHelper<uint>.op_Increment((uint)0xFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
Assert.Equal((uint)0x00000001, IncrementOperatorsHelper<uint>.op_CheckedIncrement((uint)0x00000000));
|
||||
Assert.Equal((uint)0x00000002, IncrementOperatorsHelper<uint>.op_CheckedIncrement((uint)0x00000001));
|
||||
Assert.Equal((uint)0x80000000, IncrementOperatorsHelper<uint>.op_CheckedIncrement((uint)0x7FFFFFFF));
|
||||
Assert.Equal((uint)0x80000001, IncrementOperatorsHelper<uint>.op_CheckedIncrement((uint)0x80000000));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<uint>.op_CheckedIncrement((uint)0xFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -263,6 +311,8 @@ namespace System.Tests
|
|||
Assert.Equal((uint)0x00000001, ModulusOperatorsHelper<uint, uint, uint>.op_Modulus((uint)0x7FFFFFFF, 2));
|
||||
Assert.Equal((uint)0x00000000, ModulusOperatorsHelper<uint, uint, uint>.op_Modulus((uint)0x80000000, 2));
|
||||
Assert.Equal((uint)0x00000001, ModulusOperatorsHelper<uint, uint, uint>.op_Modulus((uint)0xFFFFFFFF, 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<uint, uint, uint>.op_Modulus((uint)0x00000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -275,6 +325,17 @@ namespace System.Tests
|
|||
Assert.Equal((uint)0xFFFFFFFE, MultiplyOperatorsHelper<uint, uint, uint>.op_Multiply((uint)0xFFFFFFFF, 2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
Assert.Equal((uint)0x00000000, MultiplyOperatorsHelper<uint, uint, uint>.op_CheckedMultiply((uint)0x00000000, 2));
|
||||
Assert.Equal((uint)0x00000002, MultiplyOperatorsHelper<uint, uint, uint>.op_CheckedMultiply((uint)0x00000001, 2));
|
||||
Assert.Equal((uint)0xFFFFFFFE, MultiplyOperatorsHelper<uint, uint, uint>.op_CheckedMultiply((uint)0x7FFFFFFF, 2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<uint, uint, uint>.op_CheckedMultiply((uint)0x80000000, 2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<uint, uint, uint>.op_CheckedMultiply((uint)0xFFFFFFFF, 2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
{
|
||||
|
@ -1003,7 +1064,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
Assert.Equal((uint)0x00000000, ShiftOperatorsHelper<uint, uint>.op_LeftShift((uint)0x00000000, 1));
|
||||
|
@ -1033,6 +1093,17 @@ namespace System.Tests
|
|||
Assert.Equal((uint)0xFFFFFFFE, SubtractionOperatorsHelper<uint, uint, uint>.op_Subtraction((uint)0xFFFFFFFF, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
Assert.Equal((uint)0x00000000, SubtractionOperatorsHelper<uint, uint, uint>.op_CheckedSubtraction((uint)0x00000001, 1));
|
||||
Assert.Equal((uint)0x7FFFFFFE, SubtractionOperatorsHelper<uint, uint, uint>.op_CheckedSubtraction((uint)0x7FFFFFFF, 1));
|
||||
Assert.Equal((uint)0x7FFFFFFF, SubtractionOperatorsHelper<uint, uint, uint>.op_CheckedSubtraction((uint)0x80000000, 1));
|
||||
Assert.Equal((uint)0xFFFFFFFE, SubtractionOperatorsHelper<uint, uint, uint>.op_CheckedSubtraction((uint)0xFFFFFFFF, 1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<uint, uint, uint>.op_CheckedSubtraction((uint)0x00000000, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1043,6 +1114,17 @@ namespace System.Tests
|
|||
Assert.Equal((uint)0x00000001, UnaryNegationOperatorsHelper<uint, uint>.op_UnaryNegation((uint)0xFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
Assert.Equal((uint)0x00000000, UnaryNegationOperatorsHelper<uint, uint>.op_CheckedUnaryNegation((uint)0x00000000));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<uint, uint>.op_CheckedUnaryNegation((uint)0x00000001));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<uint, uint>.op_CheckedUnaryNegation((uint)0x7FFFFFFF));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<uint, uint>.op_CheckedUnaryNegation((uint)0x80000000));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<uint, uint>.op_CheckedUnaryNegation((uint)0xFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
|
@ -55,6 +55,17 @@ namespace System.Tests
|
|||
Assert.Equal((ulong)0x0000000000000000, AdditionOperatorsHelper<ulong, ulong, ulong>.op_Addition((ulong)0xFFFFFFFFFFFFFFFF, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
Assert.Equal((ulong)0x0000000000000001, AdditionOperatorsHelper<ulong, ulong, ulong>.op_CheckedAddition((ulong)0x0000000000000000, 1));
|
||||
Assert.Equal((ulong)0x0000000000000002, AdditionOperatorsHelper<ulong, ulong, ulong>.op_CheckedAddition((ulong)0x0000000000000001, 1));
|
||||
Assert.Equal((ulong)0x8000000000000000, AdditionOperatorsHelper<ulong, ulong, ulong>.op_CheckedAddition((ulong)0x7FFFFFFFFFFFFFFF, 1));
|
||||
Assert.Equal((ulong)0x8000000000000001, AdditionOperatorsHelper<ulong, ulong, ulong>.op_CheckedAddition((ulong)0x8000000000000000, 1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<ulong, ulong, ulong>.op_CheckedAddition((ulong)0xFFFFFFFFFFFFFFFF, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -215,6 +226,17 @@ namespace System.Tests
|
|||
Assert.Equal((ulong)0xFFFFFFFFFFFFFFFE, DecrementOperatorsHelper<ulong>.op_Decrement((ulong)0xFFFFFFFFFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
Assert.Equal((ulong)0x0000000000000000, DecrementOperatorsHelper<ulong>.op_CheckedDecrement((ulong)0x0000000000000001));
|
||||
Assert.Equal((ulong)0x7FFFFFFFFFFFFFFE, DecrementOperatorsHelper<ulong>.op_CheckedDecrement((ulong)0x7FFFFFFFFFFFFFFF));
|
||||
Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, DecrementOperatorsHelper<ulong>.op_CheckedDecrement((ulong)0x8000000000000000));
|
||||
Assert.Equal((ulong)0xFFFFFFFFFFFFFFFE, DecrementOperatorsHelper<ulong>.op_CheckedDecrement((ulong)0xFFFFFFFFFFFFFFFF));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<ulong>.op_CheckedDecrement((ulong)0x0000000000000000));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -223,6 +245,20 @@ namespace System.Tests
|
|||
Assert.Equal((ulong)0x3FFFFFFFFFFFFFFF, DivisionOperatorsHelper<ulong, ulong, ulong>.op_Division((ulong)0x7FFFFFFFFFFFFFFF, 2));
|
||||
Assert.Equal((ulong)0x4000000000000000, DivisionOperatorsHelper<ulong, ulong, ulong>.op_Division((ulong)0x8000000000000000, 2));
|
||||
Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, DivisionOperatorsHelper<ulong, ulong, ulong>.op_Division((ulong)0xFFFFFFFFFFFFFFFF, 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<ulong, ulong, ulong>.op_Division((ulong)0x0000000000000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
Assert.Equal((ulong)0x0000000000000000, DivisionOperatorsHelper<ulong, ulong, ulong>.op_CheckedDivision((ulong)0x0000000000000000, 2));
|
||||
Assert.Equal((ulong)0x0000000000000000, DivisionOperatorsHelper<ulong, ulong, ulong>.op_CheckedDivision((ulong)0x0000000000000001, 2));
|
||||
Assert.Equal((ulong)0x3FFFFFFFFFFFFFFF, DivisionOperatorsHelper<ulong, ulong, ulong>.op_CheckedDivision((ulong)0x7FFFFFFFFFFFFFFF, 2));
|
||||
Assert.Equal((ulong)0x4000000000000000, DivisionOperatorsHelper<ulong, ulong, ulong>.op_CheckedDivision((ulong)0x8000000000000000, 2));
|
||||
Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, DivisionOperatorsHelper<ulong, ulong, ulong>.op_CheckedDivision((ulong)0xFFFFFFFFFFFFFFFF, 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<ulong, ulong, ulong>.op_CheckedDivision((ulong)0x0000000000000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -255,6 +291,17 @@ namespace System.Tests
|
|||
Assert.Equal((ulong)0x0000000000000000, IncrementOperatorsHelper<ulong>.op_Increment((ulong)0xFFFFFFFFFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
Assert.Equal((ulong)0x0000000000000001, IncrementOperatorsHelper<ulong>.op_CheckedIncrement((ulong)0x0000000000000000));
|
||||
Assert.Equal((ulong)0x0000000000000002, IncrementOperatorsHelper<ulong>.op_CheckedIncrement((ulong)0x0000000000000001));
|
||||
Assert.Equal((ulong)0x8000000000000000, IncrementOperatorsHelper<ulong>.op_CheckedIncrement((ulong)0x7FFFFFFFFFFFFFFF));
|
||||
Assert.Equal((ulong)0x8000000000000001, IncrementOperatorsHelper<ulong>.op_CheckedIncrement((ulong)0x8000000000000000));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<ulong>.op_CheckedIncrement((ulong)0xFFFFFFFFFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -263,6 +310,8 @@ namespace System.Tests
|
|||
Assert.Equal((ulong)0x0000000000000001, ModulusOperatorsHelper<ulong, ulong, ulong>.op_Modulus((ulong)0x7FFFFFFFFFFFFFFF, 2));
|
||||
Assert.Equal((ulong)0x0000000000000000, ModulusOperatorsHelper<ulong, ulong, ulong>.op_Modulus((ulong)0x8000000000000000, 2));
|
||||
Assert.Equal((ulong)0x0000000000000001, ModulusOperatorsHelper<ulong, ulong, ulong>.op_Modulus((ulong)0xFFFFFFFFFFFFFFFF, 2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<ulong, ulong, ulong>.op_Modulus((ulong)0x0000000000000001, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -274,6 +323,17 @@ namespace System.Tests
|
|||
Assert.Equal((ulong)0x0000000000000000, MultiplyOperatorsHelper<ulong, ulong, ulong>.op_Multiply((ulong)0x8000000000000000, 2));
|
||||
Assert.Equal((ulong)0xFFFFFFFFFFFFFFFE, MultiplyOperatorsHelper<ulong, ulong, ulong>.op_Multiply((ulong)0xFFFFFFFFFFFFFFFF, 2));
|
||||
}
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
Assert.Equal((ulong)0x0000000000000000, MultiplyOperatorsHelper<ulong, ulong, ulong>.op_CheckedMultiply((ulong)0x0000000000000000, 2));
|
||||
Assert.Equal((ulong)0x0000000000000002, MultiplyOperatorsHelper<ulong, ulong, ulong>.op_CheckedMultiply((ulong)0x0000000000000001, 2));
|
||||
Assert.Equal((ulong)0xFFFFFFFFFFFFFFFE, MultiplyOperatorsHelper<ulong, ulong, ulong>.op_CheckedMultiply((ulong)0x7FFFFFFFFFFFFFFF, 2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<ulong, ulong, ulong>.op_CheckedMultiply((ulong)0x8000000000000000, 2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<ulong, ulong, ulong>.op_CheckedMultiply((ulong)0xFFFFFFFFFFFFFFFF, 2));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
|
@ -1003,7 +1063,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
Assert.Equal((ulong)0x0000000000000000, ShiftOperatorsHelper<ulong, ulong>.op_LeftShift((ulong)0x0000000000000000, 1));
|
||||
|
@ -1033,6 +1092,17 @@ namespace System.Tests
|
|||
Assert.Equal((ulong)0xFFFFFFFFFFFFFFFE, SubtractionOperatorsHelper<ulong, ulong, ulong>.op_Subtraction((ulong)0xFFFFFFFFFFFFFFFF, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
Assert.Equal((ulong)0x0000000000000000, SubtractionOperatorsHelper<ulong, ulong, ulong>.op_CheckedSubtraction((ulong)0x0000000000000001, 1));
|
||||
Assert.Equal((ulong)0x7FFFFFFFFFFFFFFE, SubtractionOperatorsHelper<ulong, ulong, ulong>.op_CheckedSubtraction((ulong)0x7FFFFFFFFFFFFFFF, 1));
|
||||
Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, SubtractionOperatorsHelper<ulong, ulong, ulong>.op_CheckedSubtraction((ulong)0x8000000000000000, 1));
|
||||
Assert.Equal((ulong)0xFFFFFFFFFFFFFFFE, SubtractionOperatorsHelper<ulong, ulong, ulong>.op_CheckedSubtraction((ulong)0xFFFFFFFFFFFFFFFF, 1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<ulong, ulong, ulong>.op_CheckedSubtraction((ulong)0x0000000000000000, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1043,6 +1113,17 @@ namespace System.Tests
|
|||
Assert.Equal((ulong)0x0000000000000001, UnaryNegationOperatorsHelper<ulong, ulong>.op_UnaryNegation((ulong)0xFFFFFFFFFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
Assert.Equal((ulong)0x0000000000000000, UnaryNegationOperatorsHelper<ulong, ulong>.op_CheckedUnaryNegation((ulong)0x0000000000000000));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<ulong, ulong>.op_CheckedUnaryNegation((ulong)0x0000000000000001));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<ulong, ulong>.op_CheckedUnaryNegation((ulong)0x7FFFFFFFFFFFFFFF));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<ulong, ulong>.op_CheckedUnaryNegation((ulong)0x8000000000000000));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<ulong, ulong>.op_CheckedUnaryNegation((ulong)0xFFFFFFFFFFFFFFFF));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
|
@ -73,6 +73,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedAdditionTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000001), AdditionOperatorsHelper<nuint, nuint, nuint>.op_CheckedAddition(unchecked((nuint)0x0000000000000000), (nuint)1));
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000002), AdditionOperatorsHelper<nuint, nuint, nuint>.op_CheckedAddition(unchecked((nuint)0x0000000000000001), (nuint)1));
|
||||
Assert.Equal(unchecked((nuint)0x8000000000000000), AdditionOperatorsHelper<nuint, nuint, nuint>.op_CheckedAddition(unchecked((nuint)0x7FFFFFFFFFFFFFFF), (nuint)1));
|
||||
Assert.Equal(unchecked((nuint)0x8000000000000001), AdditionOperatorsHelper<nuint, nuint, nuint>.op_CheckedAddition(unchecked((nuint)0x8000000000000000), (nuint)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<nuint, nuint, nuint>.op_CheckedAddition(unchecked((nuint)0xFFFFFFFFFFFFFFFF), (nuint)1));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nuint)0x00000001, AdditionOperatorsHelper<nuint, nuint, nuint>.op_CheckedAddition((nuint)0x00000000, (nuint)1));
|
||||
Assert.Equal((nuint)0x00000002, AdditionOperatorsHelper<nuint, nuint, nuint>.op_CheckedAddition((nuint)0x00000001, (nuint)1));
|
||||
Assert.Equal((nuint)0x80000000, AdditionOperatorsHelper<nuint, nuint, nuint>.op_CheckedAddition((nuint)0x7FFFFFFF, (nuint)1));
|
||||
Assert.Equal((nuint)0x80000001, AdditionOperatorsHelper<nuint, nuint, nuint>.op_CheckedAddition((nuint)0x80000000, (nuint)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => AdditionOperatorsHelper<nuint, nuint, nuint>.op_CheckedAddition((nuint)0xFFFFFFFF, (nuint)1));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void LeadingZeroCountTest()
|
||||
{
|
||||
|
@ -409,6 +432,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDecrementTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000000), DecrementOperatorsHelper<nuint>.op_CheckedDecrement(unchecked((nuint)0x0000000000000001)));
|
||||
Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFE), DecrementOperatorsHelper<nuint>.op_CheckedDecrement(unchecked((nuint)0x7FFFFFFFFFFFFFFF)));
|
||||
Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), DecrementOperatorsHelper<nuint>.op_CheckedDecrement(unchecked((nuint)0x8000000000000000)));
|
||||
Assert.Equal(unchecked((nuint)0xFFFFFFFFFFFFFFFE), DecrementOperatorsHelper<nuint>.op_CheckedDecrement(unchecked((nuint)0xFFFFFFFFFFFFFFFF)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<nuint>.op_CheckedDecrement(unchecked((nuint)0x0000000000000000)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nuint)0x00000000, DecrementOperatorsHelper<nuint>.op_CheckedDecrement((nuint)0x00000001));
|
||||
Assert.Equal((nuint)0x7FFFFFFE, DecrementOperatorsHelper<nuint>.op_CheckedDecrement((nuint)0x7FFFFFFF));
|
||||
Assert.Equal((nuint)0x7FFFFFFF, DecrementOperatorsHelper<nuint>.op_CheckedDecrement((nuint)0x80000000));
|
||||
Assert.Equal((nuint)0xFFFFFFFE, DecrementOperatorsHelper<nuint>.op_CheckedDecrement((nuint)0xFFFFFFFF));
|
||||
|
||||
Assert.Throws<OverflowException>(() => DecrementOperatorsHelper<nuint>.op_CheckedDecrement((nuint)0x00000000));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_DivisionTest()
|
||||
{
|
||||
|
@ -419,6 +465,8 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((nuint)0x3FFFFFFFFFFFFFFF), DivisionOperatorsHelper<nuint, nuint, nuint>.op_Division(unchecked((nuint)0x7FFFFFFFFFFFFFFF), (nuint)2));
|
||||
Assert.Equal(unchecked((nuint)0x4000000000000000), DivisionOperatorsHelper<nuint, nuint, nuint>.op_Division(unchecked((nuint)0x8000000000000000), (nuint)2));
|
||||
Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), DivisionOperatorsHelper<nuint, nuint, nuint>.op_Division(unchecked((nuint)0xFFFFFFFFFFFFFFFF), (nuint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<nuint, nuint, nuint>.op_Division(unchecked((nuint)0x0000000000000001), (nuint)0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -427,6 +475,33 @@ namespace System.Tests
|
|||
Assert.Equal((nuint)0x3FFFFFFF, DivisionOperatorsHelper<nuint, nuint, nuint>.op_Division((nuint)0x7FFFFFFF, (nuint)2));
|
||||
Assert.Equal((nuint)0x40000000, DivisionOperatorsHelper<nuint, nuint, nuint>.op_Division((nuint)0x80000000, (nuint)2));
|
||||
Assert.Equal((nuint)0x7FFFFFFF, DivisionOperatorsHelper<nuint, nuint, nuint>.op_Division((nuint)0xFFFFFFFF, (nuint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<nuint, nuint, nuint>.op_Division((nuint)0x00000001, (nuint)0));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedDivisionTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000000), DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision(unchecked((nuint)0x0000000000000000), (nuint)2));
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000000), DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision(unchecked((nuint)0x0000000000000001), (nuint)2));
|
||||
Assert.Equal(unchecked((nuint)0x3FFFFFFFFFFFFFFF), DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision(unchecked((nuint)0x7FFFFFFFFFFFFFFF), (nuint)2));
|
||||
Assert.Equal(unchecked((nuint)0x4000000000000000), DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision(unchecked((nuint)0x8000000000000000), (nuint)2));
|
||||
Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision(unchecked((nuint)0xFFFFFFFFFFFFFFFF), (nuint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision(unchecked((nuint)0x0000000000000001), (nuint)0));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nuint)0x00000000, DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision((nuint)0x00000000, (nuint)2));
|
||||
Assert.Equal((nuint)0x00000000, DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision((nuint)0x00000001, (nuint)2));
|
||||
Assert.Equal((nuint)0x3FFFFFFF, DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision((nuint)0x7FFFFFFF, (nuint)2));
|
||||
Assert.Equal((nuint)0x40000000, DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision((nuint)0x80000000, (nuint)2));
|
||||
Assert.Equal((nuint)0x7FFFFFFF, DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision((nuint)0xFFFFFFFF, (nuint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => DivisionOperatorsHelper<nuint, nuint, nuint>.op_CheckedDivision((nuint)0x00000001, (nuint)0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -493,6 +568,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedIncrementTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000001), IncrementOperatorsHelper<nuint>.op_CheckedIncrement(unchecked((nuint)0x0000000000000000)));
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000002), IncrementOperatorsHelper<nuint>.op_CheckedIncrement(unchecked((nuint)0x0000000000000001)));
|
||||
Assert.Equal(unchecked((nuint)0x8000000000000000), IncrementOperatorsHelper<nuint>.op_CheckedIncrement(unchecked((nuint)0x7FFFFFFFFFFFFFFF)));
|
||||
Assert.Equal(unchecked((nuint)0x8000000000000001), IncrementOperatorsHelper<nuint>.op_CheckedIncrement(unchecked((nuint)0x8000000000000000)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<nuint>.op_CheckedIncrement(unchecked((nuint)0xFFFFFFFFFFFFFFFF)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nuint)0x00000001, IncrementOperatorsHelper<nuint>.op_CheckedIncrement((nuint)0x00000000));
|
||||
Assert.Equal((nuint)0x00000002, IncrementOperatorsHelper<nuint>.op_CheckedIncrement((nuint)0x00000001));
|
||||
Assert.Equal((nuint)0x80000000, IncrementOperatorsHelper<nuint>.op_CheckedIncrement((nuint)0x7FFFFFFF));
|
||||
Assert.Equal((nuint)0x80000001, IncrementOperatorsHelper<nuint>.op_CheckedIncrement((nuint)0x80000000));
|
||||
|
||||
Assert.Throws<OverflowException>(() => IncrementOperatorsHelper<nuint>.op_CheckedIncrement((nuint)0xFFFFFFFF));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_ModulusTest()
|
||||
{
|
||||
|
@ -503,6 +601,8 @@ namespace System.Tests
|
|||
Assert.Equal(unchecked((nuint)0x0000000000000001), ModulusOperatorsHelper<nuint, nuint, nuint>.op_Modulus(unchecked((nuint)0x7FFFFFFFFFFFFFFF), (nuint)2));
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000000), ModulusOperatorsHelper<nuint, nuint, nuint>.op_Modulus(unchecked((nuint)0x8000000000000000), (nuint)2));
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000001), ModulusOperatorsHelper<nuint, nuint, nuint>.op_Modulus(unchecked((nuint)0xFFFFFFFFFFFFFFFF), (nuint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<nuint, nuint, nuint>.op_Modulus(unchecked((nuint)0x0000000000000001), (nuint)0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -511,6 +611,8 @@ namespace System.Tests
|
|||
Assert.Equal((nuint)0x00000001, ModulusOperatorsHelper<nuint, nuint, nuint>.op_Modulus((nuint)0x7FFFFFFF, (nuint)2));
|
||||
Assert.Equal((nuint)0x00000000, ModulusOperatorsHelper<nuint, nuint, nuint>.op_Modulus((nuint)0x80000000, (nuint)2));
|
||||
Assert.Equal((nuint)0x00000001, ModulusOperatorsHelper<nuint, nuint, nuint>.op_Modulus((nuint)0xFFFFFFFF, (nuint)2));
|
||||
|
||||
Assert.Throws<DivideByZeroException>(() => ModulusOperatorsHelper<nuint, nuint, nuint>.op_Modulus((nuint)0x00000001, (nuint)0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -535,6 +637,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedMultiplyTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000000), MultiplyOperatorsHelper<nuint, nuint, nuint>.op_CheckedMultiply(unchecked((nuint)0x0000000000000000), (nuint)2));
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000002), MultiplyOperatorsHelper<nuint, nuint, nuint>.op_CheckedMultiply(unchecked((nuint)0x0000000000000001), (nuint)2));
|
||||
Assert.Equal(unchecked((nuint)0xFFFFFFFFFFFFFFFE), MultiplyOperatorsHelper<nuint, nuint, nuint>.op_CheckedMultiply(unchecked((nuint)0x7FFFFFFFFFFFFFFF), (nuint)2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<nuint, nuint, nuint>.op_CheckedMultiply(unchecked((nuint)0x8000000000000000), (nuint)2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<nuint, nuint, nuint>.op_CheckedMultiply(unchecked((nuint)0xFFFFFFFFFFFFFFFF), (nuint)2));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nuint)0x00000000, MultiplyOperatorsHelper<nuint, nuint, nuint>.op_CheckedMultiply((nuint)0x00000000, (nuint)2));
|
||||
Assert.Equal((nuint)0x00000002, MultiplyOperatorsHelper<nuint, nuint, nuint>.op_CheckedMultiply((nuint)0x00000001, (nuint)2));
|
||||
Assert.Equal((nuint)0xFFFFFFFE, MultiplyOperatorsHelper<nuint, nuint, nuint>.op_CheckedMultiply((nuint)0x7FFFFFFF, (nuint)2));
|
||||
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<nuint, nuint, nuint>.op_CheckedMultiply((nuint)0x80000000, (nuint)2));
|
||||
Assert.Throws<OverflowException>(() => MultiplyOperatorsHelper<nuint, nuint, nuint>.op_CheckedMultiply((nuint)0xFFFFFFFF, (nuint)2));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void AbsTest()
|
||||
{
|
||||
|
@ -1468,7 +1593,6 @@ namespace System.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
public static void op_LeftShiftTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
|
@ -1531,6 +1655,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedSubtractionTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000000), SubtractionOperatorsHelper<nuint, nuint, nuint>.op_CheckedSubtraction(unchecked((nuint)0x0000000000000001), (nuint)1));
|
||||
Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFE), SubtractionOperatorsHelper<nuint, nuint, nuint>.op_CheckedSubtraction(unchecked((nuint)0x7FFFFFFFFFFFFFFF), (nuint)1));
|
||||
Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), SubtractionOperatorsHelper<nuint, nuint, nuint>.op_CheckedSubtraction(unchecked((nuint)0x8000000000000000), (nuint)1));
|
||||
Assert.Equal(unchecked((nuint)0xFFFFFFFFFFFFFFFE), SubtractionOperatorsHelper<nuint, nuint, nuint>.op_CheckedSubtraction(unchecked((nuint)0xFFFFFFFFFFFFFFFF), (nuint)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<nuint, nuint, nuint>.op_CheckedSubtraction(unchecked((nuint)0x0000000000000000), (nuint)1));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nuint)0x00000000, SubtractionOperatorsHelper<nuint, nuint, nuint>.op_CheckedSubtraction((nuint)0x00000001, (nuint)1));
|
||||
Assert.Equal((nuint)0x7FFFFFFE, SubtractionOperatorsHelper<nuint, nuint, nuint>.op_CheckedSubtraction((nuint)0x7FFFFFFF, (nuint)1));
|
||||
Assert.Equal((nuint)0x7FFFFFFF, SubtractionOperatorsHelper<nuint, nuint, nuint>.op_CheckedSubtraction((nuint)0x80000000, (nuint)1));
|
||||
Assert.Equal((nuint)0xFFFFFFFE, SubtractionOperatorsHelper<nuint, nuint, nuint>.op_CheckedSubtraction((nuint)0xFFFFFFFF, (nuint)1));
|
||||
|
||||
Assert.Throws<OverflowException>(() => SubtractionOperatorsHelper<nuint, nuint, nuint>.op_CheckedSubtraction((nuint)0x00000000, (nuint)1));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryNegationTest()
|
||||
{
|
||||
|
@ -1552,6 +1699,29 @@ namespace System.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_CheckedUnaryNegationTest()
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
Assert.Equal(unchecked((nuint)0x0000000000000000), UnaryNegationOperatorsHelper<nuint, nuint>.op_CheckedUnaryNegation(unchecked((nuint)0x0000000000000000)));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<nuint, nuint>.op_CheckedUnaryNegation(unchecked((nuint)0x0000000000000001)));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<nuint, nuint>.op_CheckedUnaryNegation(unchecked((nuint)0x7FFFFFFFFFFFFFFF)));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<nuint, nuint>.op_CheckedUnaryNegation(unchecked((nuint)0x8000000000000000)));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<nuint, nuint>.op_CheckedUnaryNegation(unchecked((nuint)0xFFFFFFFFFFFFFFFF)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal((nuint)0x00000000, UnaryNegationOperatorsHelper<nuint, nuint>.op_CheckedUnaryNegation((nuint)0x00000000));
|
||||
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<nuint, nuint>.op_CheckedUnaryNegation((nuint)0x00000001));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<nuint, nuint>.op_CheckedUnaryNegation((nuint)0x7FFFFFFF));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<nuint, nuint>.op_CheckedUnaryNegation((nuint)0x80000000));
|
||||
Assert.Throws<OverflowException>(() => UnaryNegationOperatorsHelper<nuint, nuint>.op_CheckedUnaryNegation((nuint)0xFFFFFFFF));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void op_UnaryPlusTest()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue