about summary refs log tree commit diff
path: root/Utilities
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2024-06-03 04:59:40 +0200
committerEmma [it/its]@Rory& <root@rory.gay>2024-06-03 04:59:40 +0200
commit2a37322d78c9ce1d27cbc12e24dd918407a931e3 (patch)
treed3483edae6792bab1f10516b95779367220a2a8d /Utilities
parentAdd all projects to sln (diff)
downloadLibMatrix-dev/event-rewrite.tar.xz
Update dependencies, some tests, other things dev/event-rewrite
Diffstat (limited to 'Utilities')
-rw-r--r--Utilities/LibMatrix.EventTypes.BasicTests/LibMatrix.EventTypes.BasicTests.csproj4
-rw-r--r--Utilities/LibMatrix.EventTypes.BasicTests/Program.cs77
-rw-r--r--Utilities/LibMatrix.EventTypes.Benchmark/LibMatrix.EventTypes.Benchmark.csproj24
-rw-r--r--Utilities/LibMatrix.EventTypes.Benchmark/Program.cs37
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj4
5 files changed, 108 insertions, 38 deletions
diff --git a/Utilities/LibMatrix.EventTypes.BasicTests/LibMatrix.EventTypes.BasicTests.csproj b/Utilities/LibMatrix.EventTypes.BasicTests/LibMatrix.EventTypes.BasicTests.csproj
index b769cb7..e13103f 100644
--- a/Utilities/LibMatrix.EventTypes.BasicTests/LibMatrix.EventTypes.BasicTests.csproj
+++ b/Utilities/LibMatrix.EventTypes.BasicTests/LibMatrix.EventTypes.BasicTests.csproj
@@ -13,10 +13,6 @@
   </ItemGroup>

 

   <ItemGroup>

-    <PackageReference Include="BenchmarkDotNet" Version="0.13.12" />

-  </ItemGroup>

-

-  <ItemGroup>

     <Content Include="*.json">

       <CopyToOutputDirectory>Always</CopyToOutputDirectory>

     </Content>

diff --git a/Utilities/LibMatrix.EventTypes.BasicTests/Program.cs b/Utilities/LibMatrix.EventTypes.BasicTests/Program.cs
index 8c1e15a..d694c76 100644
--- a/Utilities/LibMatrix.EventTypes.BasicTests/Program.cs
+++ b/Utilities/LibMatrix.EventTypes.BasicTests/Program.cs
@@ -1,37 +1,50 @@
-using System.Text.Json;

+// See https://aka.ms/new-console-template for more information

+

+using System.Text.Json;

 using ArcaneLibs.Extensions;

-using BenchmarkDotNet.Attributes;

-using BenchmarkDotNet.Jobs;

-using BenchmarkDotNet.Running;

 using LibMatrix.EventTypes;

-using LibMatrix.EventTypes.Events;

-

-BenchmarkRunner.Run<Tests>();

-

-[ShortRunJob]

-[MemoryDiagnoser]

-public class Tests {

-    // public MatrixEventCollection<MatrixEventContent> Members = [

-    //     new MatrixEvent<RoomMembershipEventContent>() {

-    //         Content = new() {

-    //             Membership = "join"

-    //         }

-    //     }

-    // ];

-

-    private static string eventJson = File.ReadAllText("test-event.json");

-    private static MatrixEvent<RoomMembershipEventContent> evt2 = JsonSerializer.Deserialize<MatrixEvent<RoomMembershipEventContent>>(eventJson);

-    [Benchmark]

-    public void Deserialise() {

-        JsonSerializer.Deserialize<MatrixEvent<RoomMembershipEventContent>>(eventJson);

+using LibMatrix.EventTypes.Abstractions;

+using LibMatrix.EventTypes.Spec;

+

+Console.WriteLine("Hello, World!");

+

+MatrixEventCollection Members = [

+     new MatrixEvent<RoomMembershipEventContent>() {

+         Content = new() {

+             Membership = "join"

+         }

+     }

+];

+

+string eventJson = File.ReadAllText("test-event.json");

+MatrixEvent<RoomMembershipEventContent> evt2 = JsonSerializer.Deserialize<MatrixEvent<RoomMembershipEventContent>>(eventJson);

+

+JsonSerializer.Deserialize<MatrixEvent<RoomMembershipEventContent>>(eventJson);

+

+evt2.ToJson();

+evt2.Content.Membership = "meow";

+

+MatrixEventCollection collection = new();

+collection.Add(new MatrixEvent<RoomMembershipEventContent>() {

+    Content = new RoomMembershipEventContent() {

+        Membership = "yes"

     }

-    [Benchmark]

-    public void Serialise() {

-        evt2.ToJson();

+});

+MatrixEventCollection<RoomMembershipEventContent> collection4 = new();

+collection4.Add(new MatrixEvent<RoomMembershipEventContent>() {

+    Content = new RoomMembershipEventContent() {

+        Membership = "yes"

     }

-    

-    [Benchmark]

-    public void Modify() {

-        evt2.Content.Membership = "meow";

+});

+

+List<MatrixEvent<BaseMatrixEventContent>> collection2 = new();

+collection2.Add(new MatrixEvent<RoomMembershipEventContent>() {

+    Content = new RoomMembershipEventContent() {

+        Membership = "yes"

     }

-}
\ No newline at end of file
+});

+

+List<BaseMatrixEventContent> collection3 = new();

+collection3.Add(new RoomMembershipEventContent() {

+    Membership = "yes"

+});
\ No newline at end of file
diff --git a/Utilities/LibMatrix.EventTypes.Benchmark/LibMatrix.EventTypes.Benchmark.csproj b/Utilities/LibMatrix.EventTypes.Benchmark/LibMatrix.EventTypes.Benchmark.csproj
new file mode 100644
index 0000000..b769cb7
--- /dev/null
+++ b/Utilities/LibMatrix.EventTypes.Benchmark/LibMatrix.EventTypes.Benchmark.csproj
@@ -0,0 +1,24 @@
+<Project Sdk="Microsoft.NET.Sdk">

+

+  <PropertyGroup>

+    <OutputType>Exe</OutputType>

+    <TargetFramework>net8.0</TargetFramework>

+    <ImplicitUsings>enable</ImplicitUsings>

+    <Nullable>enable</Nullable>

+  </PropertyGroup>

+

+  <ItemGroup>

+    <ProjectReference Include="..\..\LibMatrix.EventTypes.Abstractions\LibMatrix.EventTypes.Abstractions.csproj" />

+    <ProjectReference Include="..\..\LibMatrix.EventTypes.Spec\LibMatrix.EventTypes.Spec.csproj" />

+  </ItemGroup>

+

+  <ItemGroup>

+    <PackageReference Include="BenchmarkDotNet" Version="0.13.12" />

+  </ItemGroup>

+

+  <ItemGroup>

+    <Content Include="*.json">

+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>

+    </Content>

+  </ItemGroup>

+</Project>

diff --git a/Utilities/LibMatrix.EventTypes.Benchmark/Program.cs b/Utilities/LibMatrix.EventTypes.Benchmark/Program.cs
new file mode 100644
index 0000000..512c066
--- /dev/null
+++ b/Utilities/LibMatrix.EventTypes.Benchmark/Program.cs
@@ -0,0 +1,37 @@
+using System.Text.Json;

+using ArcaneLibs.Extensions;

+using BenchmarkDotNet.Attributes;

+using BenchmarkDotNet.Jobs;

+using BenchmarkDotNet.Running;

+using LibMatrix.EventTypes;

+using LibMatrix.EventTypes.Spec;

+

+BenchmarkRunner.Run<Tests>();

+

+[ShortRunJob]

+[MemoryDiagnoser]

+public class Tests {

+    // public MatrixEventCollection<MatrixEventContent> Members = [

+    //     new MatrixEvent<RoomMembershipEventContent>() {

+    //         Content = new() {

+    //             Membership = "join"

+    //         }

+    //     }

+    // ];

+

+    private static string eventJson = File.ReadAllText("test-event.json");

+    private static MatrixEvent<RoomMembershipEventContent> evt2 = JsonSerializer.Deserialize<MatrixEvent<RoomMembershipEventContent>>(eventJson);

+    [Benchmark]

+    public void Deserialise() {

+        JsonSerializer.Deserialize<MatrixEvent<RoomMembershipEventContent>>(eventJson);

+    }

+    [Benchmark]

+    public void Serialise() {

+        evt2.ToJson();

+    }

+    

+    [Benchmark]

+    public void Modify() {

+        evt2.Content.Membership = "meow";

+    }

+}
\ No newline at end of file
diff --git a/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj b/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj
index 89ea5af..6e67373 100644
--- a/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj
+++ b/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj
@@ -12,9 +12,9 @@
     </ItemGroup>
 
     <ItemGroup>
-        <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0"/>
+        <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
         <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>
-        <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0"/>
+        <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
     </ItemGroup>