private unsafe static void ToStringUInt32() { int size = Unsafe.SizeOf <Vector64 <UInt32> >() / sizeof(UInt32); UInt32[] values = new UInt32[size]; for (int i = 0; i < size; i++) { values[i] = TestLibrary.Generator.GetUInt32(); } Vector64 <UInt32> vector = Vector64.Create(values[0], values[1]); string actual = vector.ToString(); string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); if (!succeeded) { TestLibrary.TestFramework.LogInformation($"Vector64UInt32ToString: Vector64<UInt32>.ToString() returned an unexpected result."); TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); TestLibrary.TestFramework.LogInformation(string.Empty); throw new Exception("One or more scenarios did not complete as expected."); } }
public void UInt32ArrayTest() { var array = new UInt32[] { 0, 1 }; var table = this.fixture.Execute(array); var ids = table.AsEnumerable().Select(x => x.Field <decimal>("Id")).ToArray(); Assert.Equal(array.Select(x => (decimal)x).ToArray(), ids); }
public void UInt32ArrayTest() { var array = new UInt32[] { 0, 1 }; var arrayXmlToCursor = new ArrayXmlToCursor(array); var table = GetDataTable(arrayXmlToCursor); var ids = table.AsEnumerable().Select(x => x.Field <decimal>("Id")).ToArray(); CollectionAssert.AreEqual(array.Select(x => (decimal)x).ToArray(), ids); }
public void FillUInt32Array_ShouldProduceDesiredResults_ForBoundedInvocation() { // Arrange. var arrayLength = 180; var floor = 100000; var ceiling = 300000; var array = new UInt32[arrayLength]; using (var randomNumberGenerator = RandomNumberGenerator.Create()) { // Act. randomNumberGenerator.FillUInt32Array(array, (UInt32)floor, (UInt32)ceiling); // Assert. array.Length.Should().Be(arrayLength); array.Select(value => Convert.ToDouble(value)).Average().Should().BeGreaterOrEqualTo(150000).And.BeLessOrEqualTo(250000); } }
override public void Ersctele(IMemoryReader DaatenKwele) { base.Ersctele(DaatenKwele); var ListeOktet = this.ListeOktet; if (null != ListeOktet) { var ListeItemListeOktet = (ListeOktet ?? new byte[0]).Skip(0xC).ToArray(); var ListeItemAnzaal = ListeItemListeOktet.Length / 4; var ListeItemRef = new UInt32[ListeItemAnzaal]; Buffer.BlockCopy(ListeOktet, 0xC, ListeItemRef, 0, ListeItemRef.Length * 4); this.ListeItemRef = ListeItemRef.Select((ItemRef) => (Int64)ItemRef).ToArray(); } }