diff --git a/README.md b/README.md index ba1bd68206..fa4045fd98 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ The following is a non-exhaustive list of features that Cosmos offers: - A basic network interface - A basic audio interface -> **Note** +> [!NOTE] > Use [embeded resources](https://cosmosos.github.io/articles/Kernel/ManifestResouceStream.html) instead of the VFS for now for assets. ## Setting it up diff --git a/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs b/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs index 7221bd96f7..df188615fa 100644 --- a/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs +++ b/Tests/Cosmos.TestRunner.Core/Engine.Helpers.cs @@ -337,10 +337,10 @@ private static string GetCosmosUserkitFolder() private void MakeIso(string objectFile, string isoFile) { - IsoMaker.Generate(objectFile, isoFile); + string response = IsoMaker.Generate(objectFile, isoFile); if (!File.Exists(isoFile)) { - throw new Exception("Error building iso"); + throw new Exception($"Error building iso: {response}"); } } } diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs b/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs index a99eb734bd..89a5b82c30 100644 --- a/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs +++ b/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs @@ -6,6 +6,7 @@ using IL2CPU.API.Attribs; using System; using System.Collections.Generic; +using System.Runtime.InteropServices; using Sys = Cosmos.System; namespace Cosmos.Compiler.Tests.TypeSystem @@ -305,6 +306,7 @@ protected override void Run() Assert.IsTrue(c != null, "Anonymous types are created correctly"); Assert.IsTrue(c.i == 1 && c.n == "Test", "Anonymous types have correct values"); + TestPackedStruct(); TestVTablesImpl(); TestGarbageCollectorMethods(); TestGarbageCollector(); @@ -339,5 +341,48 @@ private static void TestReflection() Assert.AreEqual("Int32", Type.GetType("System.Int32, System.Private.CoreLib").Name, "GetType works on Int32 with shortened assembly qualified name"); Assert.AreEqual("Int32", Type.GetType("System.Int32").Name, "GetType works on Int32 with shortened assembly qualified name"); } + + PackedStruct GetPackedStruct() + { + return new PackedStruct() + { + a = 1, + b = 2, + c = 3, + d = 4, + e = 5, + f = 6 + }; + } + + PackedStruct Re { get; set; } + private void TestPackedStruct() + { + Re = GetPackedStruct(); + + Assert.AreEqual(1, Re.a, "Correctly returned first field of struct"); + Assert.AreEqual("1", Re.a.ToString(), "Correctly returned first field of struct as string"); + Assert.AreEqual(2, Re.b, "Correctly returned second field of struct"); + Assert.AreEqual("2", Re.b.ToString(), "Correctly returned second field of struct as string"); + Assert.AreEqual(3, Re.c, "Correctly returned third field of struct"); + Assert.AreEqual("3", Re.c.ToString(), "Correctly returned third field of struct as string"); + Assert.AreEqual(4, Re.d, "Correctly returned fourth field of struct"); + Assert.AreEqual("4", Re.d.ToString(), "Correctly returned fourth field of struct as string"); + Assert.AreEqual(5, Re.e, "Correctly returned fifth field of struct"); + Assert.AreEqual("5", Re.e.ToString(), "Correctly returned fifth field of struct as string"); + Assert.AreEqual(6, Re.f, "Correctly returned sixth field of struct"); + Assert.AreEqual("6", Re.f.ToString(), "Correctly returned sixth field of struct as string"); + } + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct PackedStruct + { + public ushort a; + public uint b; + public ulong c; + public ushort d; + public ushort e; + public ulong f; } }