Skip to content

Commit 225eea0

Browse files
committed
(GH-98) Update unit test
1 parent db8a1d1 commit 225eea0

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

Source/HttpMultipartParser.Benchmark/Program.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ static void Main(string[] args)
1212
// To debug
1313
// config = new DebugInProcessConfig();
1414

15-
var types = new[]
16-
{
17-
typeof(SubsequenceFinderBenchmark),
18-
typeof(MultipartFormDataParserBenchmark)
19-
};
20-
21-
BenchmarkSwitcher.FromTypes(types).Run(args, config);
15+
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config);
2216
}
2317
}
2418
}

Source/HttpMultipartParser.UnitTests/HttpMultipartParser.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
1111
<PackageReference Include="xunit" Version="2.4.1" />
1212
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1313
<PrivateAssets>all</PrivateAssets>

Source/HttpMultipartParser.UnitTests/SubsequenceFinderUnitTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@ public void SmokeTest()
1717
}
1818

1919
[Fact]
20-
// This unit test demonstrates the bug in the 'Search' method when the haystack contains
21-
// a subset of the needle immediately following by the needle. Specifically, notice the
22-
// '0x0D' byte in the sample haystack followed by '0x0D, 0x0A' (which corresponds to the needle).
20+
// This unit test was used to demonstrate the bug in the 'Search' method when the haystack contains
21+
// a subset of the needle immediately followed by the needle. Specifically, notice the
22+
// '0x0D' byte in the sample haystack followed by '0x0D, 0x0A' which is the sample needle.
23+
// This bug was resolved in July 2021.
2324
// See: https://github.com/Http-Multipart-Data-Parser/Http-Multipart-Data-Parser/issues/98
2425
public void Haystack_contains_subset_of_needle_followed_by_needle()
2526
{
2627
var haystack = new byte[] { 0x96, 0xC7, 0x0D, 0x0D, 0x0A, 0x2D, 0x2D, 0x63, 0x65 };
2728
var needle = new byte[] { 0x0D, 0x0A };
2829
var expectedPosition = 3;
2930

30-
var result = SubsequenceFinder.Search(haystack, needle);
31+
var result = SubsequenceFinder.Search(haystack, needle, haystack.Length);
3132

3233
Assert.Equal(expectedPosition, result);
3334
}

0 commit comments

Comments
 (0)