void GetInfo_throws_if_invalid_value(MemorySize memorySize) { Assert.Throws <ArgumentOutOfRangeException>(() => memorySize.GetInfo()); Assert.Throws <ArgumentOutOfRangeException>(() => memorySize.GetSize()); Assert.Throws <ArgumentOutOfRangeException>(() => memorySize.GetElementSize()); Assert.Throws <ArgumentOutOfRangeException>(() => memorySize.GetElementType()); Assert.Throws <ArgumentOutOfRangeException>(() => memorySize.IsSigned()); Assert.Throws <ArgumentOutOfRangeException>(() => memorySize.IsPacked()); Assert.Throws <ArgumentOutOfRangeException>(() => memorySize.GetElementCount()); memorySize.IsBroadcast(); // Does not throw }
void VerifyMemorySizeProperties(MemorySize memorySize, int size, int elementSize, MemorySize elementType, int elementCount, MemorySizeFlags flags) { var info = memorySize.GetInfo(); Assert.Equal(memorySize, info.MemorySize); Assert.Equal(size, info.Size); Assert.Equal(elementSize, info.ElementSize); Assert.Equal(elementType, info.ElementType); Assert.Equal((flags & MemorySizeFlags.Signed) != 0, info.IsSigned); Assert.Equal((flags & MemorySizeFlags.Broadcast) != 0, info.IsBroadcast); Assert.Equal((flags & MemorySizeFlags.Packed) != 0, info.IsPacked); Assert.Equal(elementCount, info.ElementCount); Assert.Equal(size, memorySize.GetSize()); Assert.Equal(elementSize, memorySize.GetElementSize()); Assert.Equal(elementType, memorySize.GetElementType()); Assert.Equal((flags & MemorySizeFlags.Signed) != 0, memorySize.IsSigned()); Assert.Equal((flags & MemorySizeFlags.Packed) != 0, memorySize.IsPacked()); Assert.Equal((flags & MemorySizeFlags.Broadcast) != 0, memorySize.IsBroadcast()); Assert.Equal(elementCount, memorySize.GetElementCount()); }
void Verify_FirstBroadcastMemorySize_value(MemorySize memorySize) { Assert.Equal(memorySize.IsBroadcast(), memorySize.GetInfo().IsBroadcast); }