Commit 2c18b5d7 authored by Marc Gravell's avatar Marc Gravell

investigate and fix #940 - boxed args bounds fail

parent d58fd589
...@@ -45,6 +45,6 @@ public static object Literal(this string value) ...@@ -45,6 +45,6 @@ public static object Literal(this string value)
/// Obtain a pre-boxed integer if possible, else box the inbound value /// Obtain a pre-boxed integer if possible, else box the inbound value
/// </summary> /// </summary>
/// <param name="value">The value to get a pre-boxed integer for.</param> /// <param name="value">The value to get a pre-boxed integer for.</param>
public static object Boxed(this int value) => value >= BOXED_MIN && value <= BOXED_MAX ? s_Boxed[value - BOXED_MIN] : value; public static object Boxed(this int value) => value >= BOXED_MIN && value < BOXED_MAX ? s_Boxed[value - BOXED_MIN] : value;
} }
} }
using Xunit;
namespace NRediSearch.Test
{
public class Issue940
{
[Fact]
public void Paging_Boxing()
{
for(int i = -20; i < 100; i++)
{
var boxed = i.Boxed();
Assert.Equal(i, (int)boxed);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment