github
2058 of 3728 branches covered (55.2%)
Branch coverage included in aggregate %.
5 of 33 new or added lines in 2 files covered. (15.15%)
1925 existing lines in 247 files now uncovered.8568 of 12829 relevant lines covered (66.79%)
126110.59 hits per line
1 |
using System; |
|
2 |
|
|
3 |
namespace Zilon.Core.Common
|
|
4 |
{ |
|
5 |
public static class RangeExtensions |
|
6 |
{ |
|
7 |
public static T GetBounded<T>(this Range<T> range, T value) where T : IComparable |
|
8 |
{ |
41,774✔ |
9 |
if (range is null)
|
|
UNCOV
10
|
{ |
× |
11 |
throw new ArgumentNullException(nameof(range)); |
× |
12 |
} |
|
13 |
|
|
14 |
var cMin = value.CompareTo(range.Min); |
41,774✔ |
15 |
if (cMin <= -1) |
|
16 |
{ |
29,092✔ |
17 |
return range.Min;
|
29,092✔ |
18 |
} |
|
19 |
|
|
20 |
var cMax = value.CompareTo(range.Max); |
12,682✔ |
21 |
if (cMax >= 1) |
|
22 |
{ |
6✔ |
23 |
return range.Max;
|
6✔ |
24 |
} |
|
25 |
|
|
26 |
return value;
|
12,676✔ |
27 |
} |
41,774✔ |
28 |
} |
|
29 |
} |