public void HashCodeInt(Integer value, int expected) { using (Immutability.Guard(value)) { Assert.Equal(expected, value.GetHashCode()); } }
public void Log(Integer value, double baseValue, double expected) { using (Immutability.Guard(value)) { var actual = value.Log(baseValue); Assert.Equal(expected, actual, 8); } }
public void LessThan(Integer left, Integer right, bool expected) { using (Immutability.Guard(left, right)) { var actual = left < right; Assert.Equal(expected, actual); } }
public void Pow(Integer value, int power, Integer expected) { using (Immutability.Guard(value)) { var actual = value.Pow(power); Assert.Equal(expected, actual); } }
public void Sgn(Integer value, int expected) { using (Immutability.Guard(value)) { var actual = value.Sgn(); Assert.Equal(expected, actual); } }
public void ToByteArray(Integer value, byte[] expected) { using (Immutability.Guard(value)) { var actual = value.ToByteArray(); Assert.Equal(expected, actual); } }
public void Lcm(Integer left, Integer right, Integer expected) { using (Immutability.Guard(left, right)) { var actual = left.Lcm(right); Assert.Equal(expected, actual); } }
public void LessThanOrEqualInt(Integer left, int right, bool expected) { using (Immutability.Guard(left)) { var actual = left <= right; Assert.Equal(expected, actual); } }
public void String(Integer value, string expected) { using (Immutability.Guard(value)) { var actual = value.ToString(); Assert.Equal(expected, actual); } }
public void Abs(Integer value, Integer expected) { using (Immutability.Guard(value)) { var actual = value.Abs(); Assert.Equal(expected, actual); } }
public void GreaterThanOrEqual(Integer left, Integer right, bool expected) { using (Immutability.Guard(left, right)) { var actual = left >= right; Assert.Equal(expected, actual); } }
public void CastToInt64(Integer value, long expected) { using (Immutability.Guard(value)) { var actual = (long)value; Assert.Equal(expected, actual); } }
public void CastToInt32(Integer value, int expected) { using (Immutability.Guard(value)) { var actual = (int)value; Assert.Equal(expected, actual); } }
public void NotEqualsInt(Integer left, int right, bool expected) { using (Immutability.Guard(left)) { var actual = left != right; Assert.Equal(expected, actual); } }
public static void RemainderZero() { var value = (Integer)0; using (Immutability.Guard(value)) { Assert.Throws <DivideByZeroException>(() => value % value); } }
public void ModPow(Integer value, Integer power, Integer modulus, Integer expected) { using (Immutability.Guard(value, power, modulus)) { var actual = value.ModPow(power, modulus); Assert.Equal(expected, actual); } }
public static void PowInvalid() { var value = (Integer)0; using (Immutability.Guard(value)) { Assert.Throws <ArgumentOutOfRangeException>(() => value.Pow(-1)); } }
public static void EqualsNullOrInvalid() { var value = (Integer)0; using (Immutability.Guard(value)) { Assert.False(value.Equals(null)); Assert.False(value.Equals("")); } }
public void Remainder(Integer left, Integer right, Integer expected) { using (Immutability.Guard(left, right)) { var actualOp = left % right; var actualFu = left.Remainder(right); Assert.Equal(expected, actualOp); Assert.Equal(expected, actualFu); } }
public void Divide(Integer left, Integer right, Integer expected) { using (Immutability.Guard(left, right)) { var actualOp = left / right; var actualFu = left.Divide(right); Assert.Equal(expected, actualOp); Assert.Equal(expected, actualFu); } }
public void Multiply(Integer left, Integer right, Integer expected) { using (Immutability.Guard(left, right)) { var actualOp = left * right; var actualFu = left.Multiply(right); Assert.Equal(expected, actualOp); Assert.Equal(expected, actualFu); } }
public void Square(Integer value, Integer expected) { using (Immutability.Guard(value)) { var actualOp = value * value; var actualFu = value.Multiply(value); Assert.Equal(expected, actualOp); Assert.Equal(expected, actualFu); } }
public void SubtractInt(Integer left, int right, Integer expected) { using (Immutability.Guard(left)) { var actualOp = left - right; var actualFu = left.Subtract(right); Assert.Equal(expected, actualOp); Assert.Equal(expected, actualFu); } }
public void Decrement(Integer value, Integer expected) { using (Immutability.Guard(value)) { var actualOp = value; --actualOp; var actualFu = value.Decrement(); Assert.Equal(expected, actualOp); Assert.Equal(expected, actualFu); } }
public void LeftShift(Integer value, int shift, Integer expected) { using (Immutability.Guard(value)) { var actualOp = value << shift; var actualFu = value.LeftShift(shift); Assert.Equal(expected, actualOp); Assert.Equal(expected, actualFu); } }
public void CompareTo(Integer left, Integer right, int expected) { using (Immutability.Guard(left, right)) { var actual = left.CompareTo(right); var actualObj = left.CompareTo((object)right); Assert.Equal(expected, actual); Assert.Equal(expected, actualObj); } }
public void Negate(Integer value, Integer expected) { using (Immutability.Guard(value)) { var actualOp = -value; var actualFu = value.Negate(); Assert.Equal(expected, actualOp); Assert.Equal(expected, actualFu); } }
public void OnesComplement(Integer value, Integer expected) { using (Immutability.Guard(value)) { var actualOp = ~value; var actualFu = value.OnesComplement(); Assert.Equal(expected, actualOp); Assert.Equal(expected, actualFu); } }
public void BitwiseAnd(Integer left, Integer right, Integer expected) { using (Immutability.Guard(left, right)) { var actualOp = left & right; var actualFu = left.BitwiseAnd(right); Assert.Equal(expected, actualOp); Assert.Equal(expected, actualFu); } }
public static void DivRemInvalid() { var value = (Integer)0; using (Immutability.Guard(value)) { var remainder = default(Integer); Assert.Throws <DivideByZeroException>(() => value.DivRem(0, out remainder)); } }