Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: GZip test is proprietary [depends on 548] #550

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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