private void Range(InvocationExpressionSyntax node, Action <SymbolicConstant <T>, SymbolicConstant <T> > addRange) { if (TryGetSymbolicConstant(node.GetArgument(0).Expression, out SymbolicConstant <T> min) & TryGetSymbolicConstant(node.GetArgument(1).Expression, out SymbolicConstant <T> max)) { if (min.ConstantGreaterThan(max)) { ReportDiagnostic(SmartTestsDiagnostics.CreateMinShouldBeLessThanMax(node, min.ToString(), max.ToString())); } else if (_Root != null) { addRange(min, max); } } else { _Root = null; } }
private void Range(InvocationExpressionSyntax node, Action <T, bool, T, bool> addRange) { if (TryGetConstant(node.GetArgument(0).Expression, out T min) & TryGetConstant(node.GetArgument(1).Expression, out bool minIncluded) & TryGetConstant(node.GetArgument(2).Expression, out T max) & TryGetConstant(node.GetArgument(3).Expression, out bool maxIncluded)) { if (min.CompareTo(max) > 0) { ReportDiagnostic(SmartTestsDiagnostics.CreateMinShouldBeLessThanMax(node, min.ToString(), max.ToString())); } else if (_Root != null) { addRange(min, minIncluded, max, maxIncluded); } } else { _Root = null; } }