public void TestSetVariableName() { // unittest-intervaldatastructuresetvarname IntervalStruct interval = new IntervalStruct("x", 3, 4, true, true); interval.SetVariableName("y"); Assert.AreEqual("y", interval.GetVariableName()); }
public static string PrintInterval(IntervalStruct interval, bool withVarName) { string iv = ""; if (interval.GetMinBound() == interval.GetMaxBound()) { iv = "CONST: " + interval.GetMinBound(); } else { if (withVarName) { iv += interval.GetVariableName() + " = "; } if (interval.IsLeftBoundClosed()) { iv += "["; } else { iv += "("; } if (interval.GetMinBound().ToString().Length > 12) { iv += interval.GetMinBound() + ", " + System.Environment.NewLine + " " + interval.GetMaxBound(); } else { iv += interval.GetMinBound() + ", " + interval.GetMaxBound(); } if (interval.IsRightBoundClosed()) { iv += "]"; } else { iv += ")"; } } return(iv); }