Skip to content

Commit

Permalink
Use new language features
Browse files Browse the repository at this point in the history
  • Loading branch information
ektrah committed May 25, 2024
1 parent bed6a20 commit 32cc541
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/Formatting/NSecTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private static void Test(Algorithm a, int seedSize, KeyBlobFormat importFormat,

Assert.NotNull(blob);
Assert.Equal(blobHeader.Length + sizeof(short) + sizeof(short) + keySize, blob.Length);
Assert.Equal(blobHeader, blob.AsSpan(0, blobHeader.Length).ToArray());
Assert.Equal(blobHeader, blob[..blobHeader.Length]);
Assert.Equal(keySize, BitConverter.ToInt16(blob, blobHeader.Length));
Assert.Equal(outputSize, BitConverter.ToInt16(blob, blobHeader.Length + sizeof(short)));

Expand Down Expand Up @@ -118,7 +118,7 @@ public static void TestSharedSecret()

Assert.NotNull(blob);
Assert.Equal(blobHeader.Length + sizeof(short) + sizeof(short) + b.Length, blob.Length);
Assert.Equal(blobHeader, blob.AsSpan(0, blobHeader.Length).ToArray());
Assert.Equal(blobHeader, blob[..blobHeader.Length]);
Assert.Equal(b.Length, BitConverter.ToInt16(blob, blobHeader.Length));
Assert.Equal(0, BitConverter.ToInt16(blob, blobHeader.Length + sizeof(short)));

Expand Down
4 changes: 2 additions & 2 deletions tests/Other/Iso78164PaddingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static void DecodeCorruptedPadding(int blockSize, byte[] padded, byte[] u
{
for (var i = unpadded.Length; i < padded.Length; i++)
{
var corrupted = padded.AsSpan().ToArray();
var corrupted = padded[..];
corrupted[i] = 0xFF;
Assert.Null(Iso78164Padding.Unpad(corrupted, blockSize));
Assert.False(Iso78164Padding.Unpad(corrupted, blockSize, out var actual));
Expand All @@ -84,7 +84,7 @@ public static void DecodeInvalidLength(int blockSize, byte[] padded, byte[] unpa
{
for (var i = 1; i < blockSize; i++)
{
var corrupted = padded.AsSpan(0, padded.Length - i).ToArray();
var corrupted = padded[..^i];
Assert.Null(Iso78164Padding.Unpad(corrupted, blockSize));
Assert.False(Iso78164Padding.Unpad(corrupted, blockSize, out var actual));
Assert.True(actual.IsEmpty);
Expand Down

0 comments on commit 32cc541

Please sign in to comment.