Skip to content

Commit

Permalink
Merge pull request #550 from Meerownymous/i549-gzip-test-is-proprietary
Browse files Browse the repository at this point in the history
fix: GZip test is proprietary [depends on 548]
  • Loading branch information
MSE1188 authored Oct 5, 2023
2 parents 55ef5ec + 86753af commit f28f8f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
25 changes: 10 additions & 15 deletions tests/Yaapii.Atoms.Tests/IO/GZipOutputTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using System.IO.Compression;
using Xunit;
using Yaapii.Atoms.Bytes;
using Yaapii.Atoms.Text;

namespace Yaapii.Atoms.IO.Tests
{
Expand All @@ -34,20 +35,7 @@ public sealed class GzipOutputTest
[Fact]
public void WritesToGzipOutput()
{
byte[] bytes = {
(byte) 0x1F, //GZIP Header ID1
(byte) 0x8b, //GZIP Header ID2
(byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, //Header End
(byte) 0x0B, (byte) 0xF2, (byte) 0x48, (byte) 0xCD, (byte) 0xC9, (byte) 0xC9, (byte) 0x57,
(byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xFF, (byte) 0xFF, (byte) 0x03,
(byte) 0x00, (byte) 0x56, (byte) 0xCC, (byte) 0x2A, (byte) 0x9D, (byte) 0x06, (byte) 0x00,
(byte) 0x00, (byte) 0x00
};

MemoryStream zipped = new MemoryStream();
var zipStream = new GZipStream(zipped, CompressionLevel.Optimal);
byte[] txt = new BytesOf("Hello!").AsBytes();

new LengthOf(
new TeeInput(
"Hello!",
Expand All @@ -56,8 +44,15 @@ public void WritesToGzipOutput()
).Value();

Assert.Equal(
zipped.ToArray(),
bytes
"Hello!",
new TextOf(
new InputOf(
new GZipStream(
new MemoryStream(zipped.ToArray()),
CompressionMode.Decompress
)
)
).AsString()
);
}

Expand Down
3 changes: 2 additions & 1 deletion tests/Yaapii.Atoms.Tests/Yaapii.Atoms.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Version>0.5.0</Version>
<Description>Unittests for Yaapii.Atoms</Description>
<PackageTags></PackageTags>
Expand Down Expand Up @@ -38,6 +38,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.console" Version="2.3.1" />
<PackageReference Include="xunit.extensibility.core" Version="2.3.1" />
Expand Down

0 comments on commit f28f8f3

Please sign in to comment.