-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fe6d48
commit f5ddbb0
Showing
146 changed files
with
10,104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: .NET | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'release' | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 5.0.x | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --no-restore | ||
- name: Test | ||
run: dotnet test --no-build --verbosity normal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2020-2021 ONIXLabs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using OnixLabs.Core.Text; | ||
using Xunit; | ||
|
||
namespace OnixLabs.Core.UnitTests | ||
{ | ||
public sealed class Base16Tests | ||
{ | ||
[Theory(DisplayName = "Base16_FromString should produce the expected Base-16 value.")] | ||
[InlineData("31323334353637383930", "1234567890")] | ||
[InlineData("4142434445464748494a4b4c4d4e4f505152535455565758595a", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")] | ||
[InlineData("6162636465666768696a6b6c6d6e6f707172737475767778797a", "abcdefghijklmnopqrstuvwxyz")] | ||
public void Base16FromStringShouldProduceTheExpectedBase16Value(string expected, string value) | ||
{ | ||
// Arrange | ||
Base16 candidate = Base16.FromString(value); | ||
|
||
// Act | ||
string actual = candidate.ToString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory(DisplayName = "Base16_Parse should produce the expected plain text value.")] | ||
[InlineData("1234567890", "31323334353637383930")] | ||
[InlineData("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "4142434445464748494a4b4c4d4e4f505152535455565758595a")] | ||
[InlineData("abcdefghijklmnopqrstuvwxyz", "6162636465666768696a6b6c6d6e6f707172737475767778797a")] | ||
public void Base16ParseShouldProduceTheExpectedPlainTextValue(string expected, string value) | ||
{ | ||
// Arrange | ||
Base16 candidate = Base16.Parse(value); | ||
|
||
// Act | ||
string actual = candidate.ToPlainTextString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright 2020-2021 ONIXLabs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using OnixLabs.Core.Text; | ||
using Xunit; | ||
|
||
namespace OnixLabs.Core.UnitTests | ||
{ | ||
public sealed class Base32Base32HexAlphabetTests | ||
{ | ||
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")] | ||
[InlineData("64P36D1L6ORJGE9G", "1234567890")] | ||
[InlineData("85146H258P3KGIAA9D64QJIFA18L4KQKALB5EM2PB8======", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")] | ||
[InlineData("C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8======", "abcdefghijklmnopqrstuvwxyz")] | ||
public void Base32FromStringWithPaddingShouldProduceTheExpectedBase32Value(string expected, string value) | ||
{ | ||
// Arrange | ||
Base32 candidate = Base32.FromString(value, Base32Alphabet.Base32Hex, true); | ||
|
||
// Act | ||
string actual = candidate.ToString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")] | ||
[InlineData("64P36D1L6ORJGE9G", "1234567890")] | ||
[InlineData("85146H258P3KGIAA9D64QJIFA18L4KQKALB5EM2PB8", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")] | ||
[InlineData("C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8", "abcdefghijklmnopqrstuvwxyz")] | ||
public void Base32FromStringWithoutPaddingShouldProduceTheExpectedBase32Value(string expected, string value) | ||
{ | ||
// Arrange | ||
Base32 candidate = Base32.FromString(value, Base32Alphabet.Base32Hex, false); | ||
|
||
// Act | ||
string actual = candidate.ToString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory(DisplayName = "Base32_Parse should produce the expected plain text value.")] | ||
[InlineData("1234567890", "64P36D1L6ORJGE9G")] | ||
[InlineData("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "85146H258P3KGIAA9D64QJIFA18L4KQKALB5EM2PB8")] | ||
[InlineData("abcdefghijklmnopqrstuvwxyz", "C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8")] | ||
public void Base32ParseShouldProduceTheExpectedPlainTextValue(string expected, string value) | ||
{ | ||
// Arrange | ||
Base32 candidate = Base32.Parse(value, Base32Alphabet.Base32Hex); | ||
|
||
// Act | ||
string actual = candidate.ToPlainTextString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright 2020-2021 ONIXLabs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using OnixLabs.Core.Text; | ||
using Xunit; | ||
|
||
namespace OnixLabs.Core.UnitTests | ||
{ | ||
public sealed class Base32CrockfordAlphabetTests | ||
{ | ||
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")] | ||
[InlineData("64S36D1N6RVKGE9G", "1234567890")] | ||
[InlineData("85146H258S3MGJAA9D64TKJFA18N4MTMANB5EP2SB8======", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")] | ||
[InlineData("C5H66S35CSKPGTBADDP6TVKFE1RQ4WVMENV7EY3SF8======", "abcdefghijklmnopqrstuvwxyz")] | ||
public void Base32FromStringWithPaddingShouldProduceTheExpectedBase32Value(string expected, string value) | ||
{ | ||
// Arrange | ||
Base32 candidate = Base32.FromString(value, Base32Alphabet.Crockford, true); | ||
|
||
// Act | ||
string actual = candidate.ToString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")] | ||
[InlineData("64S36D1N6RVKGE9G", "1234567890")] | ||
[InlineData("85146H258S3MGJAA9D64TKJFA18N4MTMANB5EP2SB8", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")] | ||
[InlineData("C5H66S35CSKPGTBADDP6TVKFE1RQ4WVMENV7EY3SF8", "abcdefghijklmnopqrstuvwxyz")] | ||
public void Base32FromStringWithoutPaddingShouldProduceTheExpectedBase32Value(string expected, string value) | ||
{ | ||
// Arrange | ||
Base32 candidate = Base32.FromString(value, Base32Alphabet.Crockford, false); | ||
|
||
// Act | ||
string actual = candidate.ToString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory(DisplayName = "Base32_Parse should produce the expected plain text value.")] | ||
[InlineData("1234567890", "64S36D1N6RVKGE9G")] | ||
[InlineData("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "85146H258S3MGJAA9D64TKJFA18N4MTMANB5EP2SB8")] | ||
[InlineData("abcdefghijklmnopqrstuvwxyz", "C5H66S35CSKPGTBADDP6TVKFE1RQ4WVMENV7EY3SF8")] | ||
public void Base32ParseShouldProduceTheExpectedPlainTextValue(string expected, string value) | ||
{ | ||
// Arrange | ||
Base32 candidate = Base32.Parse(value, Base32Alphabet.Crockford); | ||
|
||
// Act | ||
string actual = candidate.ToPlainTextString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright 2020-2021 ONIXLabs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using OnixLabs.Core.Text; | ||
using Xunit; | ||
|
||
namespace OnixLabs.Core.UnitTests | ||
{ | ||
public sealed class Base32DefaultAlphabetTests | ||
{ | ||
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")] | ||
[InlineData("GEZDGNBVGY3TQOJQ", "1234567890")] | ||
[InlineData("IFBEGRCFIZDUQSKKJNGE2TSPKBIVEU2UKVLFOWCZLI======", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")] | ||
[InlineData("MFRGGZDFMZTWQ2LKNNWG23TPOBYXE43UOV3HO6DZPI======", "abcdefghijklmnopqrstuvwxyz")] | ||
public void Base32FromStringWithPaddingShouldProduceTheExpectedBase32Value(string expected, string value) | ||
{ | ||
// Arrange | ||
Base32 candidate = Base32.FromString(value, Base32Alphabet.Default, true); | ||
|
||
// Act | ||
string actual = candidate.ToString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")] | ||
[InlineData("GEZDGNBVGY3TQOJQ", "1234567890")] | ||
[InlineData("IFBEGRCFIZDUQSKKJNGE2TSPKBIVEU2UKVLFOWCZLI", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")] | ||
[InlineData("MFRGGZDFMZTWQ2LKNNWG23TPOBYXE43UOV3HO6DZPI", "abcdefghijklmnopqrstuvwxyz")] | ||
public void Base32FromStringWithoutPaddingShouldProduceTheExpectedBase32Value(string expected, string value) | ||
{ | ||
// Arrange | ||
Base32 candidate = Base32.FromString(value, Base32Alphabet.Default, false); | ||
|
||
// Act | ||
string actual = candidate.ToString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory(DisplayName = "Base32_Parse should produce the expected plain text value.")] | ||
[InlineData("1234567890", "GEZDGNBVGY3TQOJQ")] | ||
[InlineData("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "IFBEGRCFIZDUQSKKJNGE2TSPKBIVEU2UKVLFOWCZLI")] | ||
[InlineData("abcdefghijklmnopqrstuvwxyz", "MFRGGZDFMZTWQ2LKNNWG23TPOBYXE43UOV3HO6DZPI")] | ||
public void Base32ParseShouldProduceTheExpectedPlainTextValue(string expected, string value) | ||
{ | ||
// Arrange | ||
Base32 candidate = Base32.Parse(value, Base32Alphabet.Default); | ||
|
||
// Act | ||
string actual = candidate.ToPlainTextString(); | ||
|
||
// Assert | ||
Assert.Equal(expected, actual); | ||
} | ||
} | ||
} |
Oops, something went wrong.