diff --git a/MetadataProcessor.Tests/TestNFApp/Program.cs b/MetadataProcessor.Tests/TestNFApp/Program.cs index 887010c..87de2a7 100644 --- a/MetadataProcessor.Tests/TestNFApp/Program.cs +++ b/MetadataProcessor.Tests/TestNFApp/Program.cs @@ -88,6 +88,10 @@ public static void Main() Console.WriteLine("Null attributes tests"); _ = new ClassWithNullAttribs(); + // testing Span<> + Console.WriteLine("Span<> tests"); + _ = new TestingSpan(); + Console.WriteLine("Exiting TestNFApp"); } diff --git a/MetadataProcessor.Tests/TestNFApp/TestNFApp.nfproj b/MetadataProcessor.Tests/TestNFApp/TestNFApp.nfproj index f983ffa..d130183 100644 --- a/MetadataProcessor.Tests/TestNFApp/TestNFApp.nfproj +++ b/MetadataProcessor.Tests/TestNFApp/TestNFApp.nfproj @@ -36,6 +36,7 @@ + diff --git a/MetadataProcessor.Tests/TestNFApp/TestingSpan.cs b/MetadataProcessor.Tests/TestNFApp/TestingSpan.cs new file mode 100644 index 0000000..97f18b9 --- /dev/null +++ b/MetadataProcessor.Tests/TestNFApp/TestingSpan.cs @@ -0,0 +1,61 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Diagnostics; +using TestNFClassLibrary; + +namespace TestNFApp +{ + public class TestingSpan + { + public TestingSpan() + { + int length = 3; + + // base type + Console.WriteLine("+++ Span tests"); + Console.WriteLine(); + + Span numbers = new Span(new int[length]); + for (int i = 0; i < length; i++) + { + numbers[i] = i; + } + + foreach (int number in numbers) + { + Console.WriteLine($">>{number.ToString()}"); + } + + // string type + Console.WriteLine("+++ Span tests"); + Console.WriteLine(); + + Span strings = new Span(new string[length]); + for (int i = 1; i < length; i++) + { + strings[i] = $">> '{i * 10}'"; + } + + foreach (string str in strings) + { + Console.WriteLine($">> '{str}'"); + } + + // class type + Console.WriteLine("+++ Span tests"); + Span spanOfClass = new Span(new ClassOnAnotherAssembly[length]); + + for (int i = 0; i < length; i++) + { + spanOfClass[i] = new ClassOnAnotherAssembly(i * 100); + } + + foreach (ClassOnAnotherAssembly item in spanOfClass) + { + Console.WriteLine($">> '{item.DummyProperty}'"); + } + } + } +} diff --git a/MetadataProcessor.Tests/mscorlib b/MetadataProcessor.Tests/mscorlib index 6303710..3a7b785 160000 --- a/MetadataProcessor.Tests/mscorlib +++ b/MetadataProcessor.Tests/mscorlib @@ -1 +1 @@ -Subproject commit 6303710e27eb44bfe94e91bcfb1d89d73315c992 +Subproject commit 3a7b785fc3af2db0f7a257ccfdb3fd3ec60376e1