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); } }
int IComparable <IntFloat> .CompareTo(IntFloat other) { if (other == null) { return(0); } if (this.Integer != other.Integer) { return(Integer.CompareTo(other.Integer)); } else { return(Floater.CompareTo(other.Floater)); } }
public int CompareTo(int value) { switch (Type) { case VariableType.Empty: return(-1); case VariableType.Null: return(-1); case VariableType.Boolean: return((Boolean ? 1 : 0).CompareTo(value)); case VariableType.Integer: return(Integer.CompareTo(value)); case VariableType.Number: return(Number.CompareTo(value)); default: return(1); } }
public int CompareTo(bool value) { switch (Type) { case VariableType.Empty: return(-1); case VariableType.Null: return(-1); case VariableType.Boolean: return(Boolean == value ? 0 : (value ? 1 : -1)); case VariableType.Integer: return(Integer.CompareTo(value ? 1 : 0)); case VariableType.Number: return(Number.CompareTo(value ? 1.0f : 0.0f)); default: return(1); } }