diff options
Diffstat (limited to 'Test')
-rw-r--r-- | Test/Program.cs | 21 | ||||
-rw-r--r-- | Test/Test.csproj | 18 |
2 files changed, 39 insertions, 0 deletions
diff --git a/Test/Program.cs b/Test/Program.cs new file mode 100644 index 0000000..2739294 --- /dev/null +++ b/Test/Program.cs @@ -0,0 +1,21 @@ +using System.Text.Json; +using LibMatrix; +using LibMatrix.Homeservers.ImplementationDetails.Synapse.Models.Responses; + +// var src1 = new SynapseCollectionResult<EventIdResponse>(); +// var src2 = new SynapseCollectionResult<EventIdResponse>(chunkKey: "meow", nextTokenKey: "woof", prevTokenKey: "bark", totalKey: "purr"); +// +// for (int i = 0; i < 10000000; i++) { +// src1.Chunk.Add(new EventIdResponse { EventId = Guid.NewGuid().ToString() }); +// src2.Chunk.Add(new EventIdResponse { EventId = Guid.NewGuid().ToString() }); +// } +// +// File.WriteAllText("src1.json", JsonSerializer.Serialize(src1, new JsonSerializerOptions(){WriteIndented = true})); +// File.WriteAllText("src2.json", JsonSerializer.Serialize(src2, new JsonSerializerOptions(){WriteIndented = true})); + +using var stream1 = File.OpenRead("src1.json"); +var dst1 = new SynapseCollectionResult<EventIdResponse>().FromJson(stream1, (item) => { + ArgumentNullException.ThrowIfNull(item.EventId); +}); + +var a = new StateEventResponse(); \ No newline at end of file diff --git a/Test/Test.csproj b/Test/Test.csproj new file mode 100644 index 0000000..39961c1 --- /dev/null +++ b/Test/Test.csproj @@ -0,0 +1,18 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net8.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + + <ItemGroup> + <ProjectReference Include="..\LibMatrix\LibMatrix\LibMatrix.csproj" /> + </ItemGroup> + + <ItemGroup> + <PackageReference Include="BenchmarkDotNet" Version="0.14.0" /> + </ItemGroup> + +</Project> |