about summary refs log tree commit diff
path: root/Utilities/LibMatrix.EventTypes.BasicTests/Program.cs
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/LibMatrix.EventTypes.BasicTests/Program.cs
parentAdd all projects to sln (diff)
downloadLibMatrix-2a37322d78c9ce1d27cbc12e24dd918407a931e3.tar.xz
Update dependencies, some tests, other things dev/event-rewrite
Diffstat (limited to 'Utilities/LibMatrix.EventTypes.BasicTests/Program.cs')
-rw-r--r--Utilities/LibMatrix.EventTypes.BasicTests/Program.cs77
1 files changed, 45 insertions, 32 deletions
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