Skip to content

Commit 4043429

Browse files
committed
Add test case for: Fixed wrong division hack #2413
1 parent 9756ae9 commit 4043429

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,21 +186,32 @@ private static void RunPredictor12Test()
186186
private static void RunPredictor13Test()
187187
{
188188
// arrange
189-
uint[] topData = { 4278193922, 4278193666 };
190-
const uint left = 4278193410;
191-
const uint expectedResult = 4278193154;
189+
uint[] topData0 = { 4278193922, 4278193666 };
190+
const uint left0 = 4278193410;
191+
const uint expectedResult0 = 4278193154;
192+
uint[] topData1 = { 4294933015, 4278219803 };
193+
const uint left1 = 4278236686;
194+
const uint expectedResult1 = 4278231571;
195+
uint actual0 = 0;
196+
uint actual1 = 0;
192197

193198
// act
194199
unsafe
195200
{
196-
fixed (uint* top = &topData[1])
201+
fixed (uint* top = &topData0[1])
197202
{
198-
uint actual = LosslessUtils.Predictor13(left, top);
203+
actual0 = LosslessUtils.Predictor13(left0, top);
204+
}
199205

200-
// assert
201-
Assert.Equal(expectedResult, actual);
206+
fixed (uint* top = &topData1[1])
207+
{
208+
actual1 = LosslessUtils.Predictor13(left1, top);
202209
}
203210
}
211+
212+
// assert
213+
Assert.Equal(expectedResult0, actual0);
214+
Assert.Equal(expectedResult1, actual1);
204215
}
205216

206217
[Fact]

0 commit comments

Comments
 (0)