Skip to content

Commit b1df62e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into copilot/add-test-framework-for-traceparsergen-2
2 parents bcafbcc + 07a3b98 commit b1df62e

47 files changed

Lines changed: 5610 additions & 293 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.azuredevops/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version: 2
2+
3+
# Disabling dependabot on Azure DevOps as this is a mirrored repo. Updates should go through github.
4+
enable-campaigned-updates: false
5+
enable-security-updates: false

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths.
22
# See https://help.github.com/articles/about-code-owners/
33

4-
* @brianrob @cincuranet @leculver @mconnew @marklio
4+
* @brianrob @cincuranet @leculver @mconnew @marklio @StephenMolloy

.github/agents/issue-triager.md

Lines changed: 416 additions & 0 deletions
Large diffs are not rendered by default.

.pipelines/perfcollect-job.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
steps:
2-
- task: DockerInstaller@0
3-
displayName: 'Install Docker'
2+
- task: Bash@3
3+
displayName: 'Get Docker Version'
4+
inputs:
5+
targetType: inline
6+
script: 'docker --version'
47

58
- task: Bash@3
69
displayName: 'Build Containers'

PerfView.sln

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MemoryGraph", "src\MemoryGr
8383
EndProject
8484
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EtwHeapDump", "src\EtwHeapDump\EtwHeapDump.csproj", "{F266BD46-34EE-4EEB-8B21-6059F4DFC51F}"
8585
EndProject
86+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastSerialization.Tests", "src\FastSerialization.Tests\FastSerialization.Tests.csproj", "{2EC430A3-1B65-4628-B2F2-8DBEB4C03132}"
87+
EndProject
8688
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1CAEF854-2923-45FA-ACB8-6523A7E45896}"
8789
EndProject
8890
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerfView.Tutorial", "src\PerfView.Tutorial\PerfView.Tutorial.csproj", "{DE35BED9-0E03-4DAC-A003-1ACBBF816973}"

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<PropertyGroup>
2121
<!-- These are the versions of the things we are CREATING in this repository -->
22-
<ReleaseVersion>3.1.24</ReleaseVersion>
22+
<ReleaseVersion>3.1.29</ReleaseVersion>
2323
<FastSerializationVersion>$(ReleaseVersion)</FastSerializationVersion>
2424
<HeapDumpDllVersion>$(ReleaseVersion)</HeapDumpDllVersion>
2525
<MemoryGraphVersion>$(ReleaseVersion)</MemoryGraphVersion>

src/Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<ItemGroup>
4848
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="17.8.14" />
4949
<PackageVersion Include="xunit" Version="2.6.5" />
50+
<PackageVersion Include="xunit.abstractions" Version="2.0.3" />
5051
<PackageVersion Include="xunit.extensibility.core" Version="2.6.5" />
5152
<PackageVersion Include="xunit.extensibility.execution" Version="2.6.5" />
5253
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" />
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk">
3+
4+
<PropertyGroup>
5+
<TargetFrameworks>net462;net8.0</TargetFrameworks>
6+
<RootNamespace>FastSerializationTests</RootNamespace>
7+
<AssemblyName>FastSerializationTests</AssemblyName>
8+
<Description>Unit tests for FastSerialization.</Description>
9+
<Copyright>Copyright © Microsoft 2025</Copyright>
10+
11+
<!-- Test projects can automatically generate the necessary binding redirects -->
12+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
13+
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" />
18+
<PackageReference Include="xunit" />
19+
<PackageReference Include="xunit.abstractions" />
20+
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<ProjectReference Include="..\PerfView.TestUtilities\PerfView.TestUtilities.csproj" />
25+
<ProjectReference Include="..\FastSerialization\FastSerialization.csproj" />
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<Compile Include="..\PerfView.TestUtilities\DebugAssertionTests.cs">
30+
<Link>DebugAssertionTests.cs</Link>
31+
</Compile>
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<None Include="app.config" />
36+
<Content Include="xunit.runner.json">
37+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
38+
</Content>
39+
</ItemGroup>
40+
41+
<ItemGroup>
42+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
43+
</ItemGroup>
44+
45+
</Project>
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Xunit;
4+
5+
namespace FastSerializationTests
6+
{
7+
/// <summary>
8+
/// Tests for GrowableArray&lt;T&gt;
9+
/// </summary>
10+
public class GrowableArrayTests
11+
{
12+
[Fact]
13+
public void DefaultConstructor()
14+
{
15+
var array = new GrowableArray<int>();
16+
Assert.Equal(0, array.Count);
17+
}
18+
19+
[Fact]
20+
public void InitialSizeConstructor()
21+
{
22+
var array = new GrowableArray<int>(10);
23+
Assert.Equal(0, array.Count);
24+
}
25+
26+
[Fact]
27+
public void AddItems()
28+
{
29+
var array = new GrowableArray<int>();
30+
array.Add(1);
31+
array.Add(2);
32+
array.Add(3);
33+
34+
Assert.Equal(3, array.Count);
35+
Assert.Equal(1, array[0]);
36+
Assert.Equal(2, array[1]);
37+
Assert.Equal(3, array[2]);
38+
}
39+
40+
[Fact]
41+
public void AddManyItems()
42+
{
43+
var array = new GrowableArray<int>();
44+
for (int i = 0; i < 100; i++)
45+
{
46+
array.Add(i);
47+
}
48+
49+
Assert.Equal(100, array.Count);
50+
for (int i = 0; i < 100; i++)
51+
{
52+
Assert.Equal(i, array[i]);
53+
}
54+
}
55+
56+
[Fact]
57+
public void SetItem()
58+
{
59+
var array = new GrowableArray<string>();
60+
array.Add("First");
61+
array.Add("Second");
62+
63+
array[0] = "Modified";
64+
Assert.Equal("Modified", array[0]);
65+
Assert.Equal("Second", array[1]);
66+
}
67+
68+
[Fact]
69+
public void Clear()
70+
{
71+
var array = new GrowableArray<int>();
72+
array.Add(1);
73+
array.Add(2);
74+
array.Add(3);
75+
76+
array.Clear();
77+
Assert.Equal(0, array.Count);
78+
}
79+
80+
[Fact]
81+
public void SetCountLarger()
82+
{
83+
var array = new GrowableArray<int>();
84+
array.Add(1);
85+
array.Add(2);
86+
87+
array.Count = 5;
88+
Assert.Equal(5, array.Count);
89+
Assert.Equal(1, array[0]);
90+
Assert.Equal(2, array[1]);
91+
Assert.Equal(0, array[2]);
92+
Assert.Equal(0, array[3]);
93+
Assert.Equal(0, array[4]);
94+
}
95+
96+
[Fact]
97+
public void SetCountSmaller()
98+
{
99+
var array = new GrowableArray<int>();
100+
array.Add(1);
101+
array.Add(2);
102+
array.Add(3);
103+
array.Add(4);
104+
105+
array.Count = 2;
106+
Assert.Equal(2, array.Count);
107+
Assert.Equal(1, array[0]);
108+
Assert.Equal(2, array[1]);
109+
}
110+
111+
[Fact]
112+
public void AddRangeFromArray()
113+
{
114+
var array = new GrowableArray<int>();
115+
array.Add(1);
116+
117+
int[] toAdd = new int[] { 2, 3, 4, 5 };
118+
array.AddRange(toAdd);
119+
120+
Assert.Equal(5, array.Count);
121+
for (int i = 0; i < 5; i++)
122+
{
123+
Assert.Equal(i + 1, array[i]);
124+
}
125+
}
126+
127+
[Fact]
128+
public void AddRangeFromGrowableArray()
129+
{
130+
var array1 = new GrowableArray<string>();
131+
array1.Add("A");
132+
array1.Add("B");
133+
134+
var array2 = new GrowableArray<string>();
135+
array2.Add("C");
136+
array2.Add("D");
137+
138+
// Convert to array to add
139+
string[] toAdd = new string[array2.Count];
140+
for (int i = 0; i < array2.Count; i++)
141+
{
142+
toAdd[i] = array2[i];
143+
}
144+
array1.AddRange(toAdd);
145+
146+
Assert.Equal(4, array1.Count);
147+
Assert.Equal("A", array1[0]);
148+
Assert.Equal("B", array1[1]);
149+
Assert.Equal("C", array1[2]);
150+
Assert.Equal("D", array1[3]);
151+
}
152+
153+
[Fact]
154+
public void WorksWithReferenceTypes()
155+
{
156+
var array = new GrowableArray<string>();
157+
array.Add("Hello");
158+
array.Add(null);
159+
array.Add("World");
160+
161+
Assert.Equal(3, array.Count);
162+
Assert.Equal("Hello", array[0]);
163+
Assert.Null(array[1]);
164+
Assert.Equal("World", array[2]);
165+
}
166+
167+
[Fact]
168+
public void WorksWithValueTypes()
169+
{
170+
var array = new GrowableArray<double>();
171+
array.Add(1.5);
172+
array.Add(2.5);
173+
array.Add(3.5);
174+
175+
Assert.Equal(3, array.Count);
176+
Assert.Equal(1.5, array[0]);
177+
Assert.Equal(2.5, array[1]);
178+
Assert.Equal(3.5, array[2]);
179+
}
180+
}
181+
}

0 commit comments

Comments
 (0)