Skip to content

Commit f5ddbb0

Browse files
Working commit - Version 1.0.0
1 parent 9fe6d48 commit f5ddbb0

File tree

146 files changed

+10104
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+10104
-2
lines changed

.github/workflows/dotnet.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: .NET
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'release'
8+
pull_request:
9+
branches:
10+
- '**'
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v1
21+
with:
22+
dotnet-version: 5.0.x
23+
- name: Restore dependencies
24+
run: dotnet restore
25+
- name: Build
26+
run: dotnet build --no-restore
27+
- name: Test
28+
run: dotnet test --no-build --verbosity normal

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
##
44
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
55

6+
*.swp
7+
*.*~
8+
project.lock.json
9+
.DS_Store
10+
*.pyc
11+
612
# User-specific files
713
*.rsuser
814
*.suo
@@ -348,3 +354,16 @@ MigrationBackup/
348354

349355
# Ionide (cross platform F# VS Code tools) working folder
350356
.ionide/
357+
358+
# Visual Studio Code
359+
.vscode
360+
361+
# Jetbrains Rider
362+
bin/
363+
obj/
364+
/packages/
365+
riderModule.iml
366+
/_ReSharper.Caches/
367+
368+
#nuget
369+
nuget.config

.idea/.idea.onixlabs-dotnet/.idea/.gitignore

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.onixlabs-dotnet/.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.onixlabs-dotnet/.idea/indexLayout.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.onixlabs-dotnet/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2020-2021 ONIXLabs
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using OnixLabs.Core.Text;
16+
using Xunit;
17+
18+
namespace OnixLabs.Core.UnitTests
19+
{
20+
public sealed class Base16Tests
21+
{
22+
[Theory(DisplayName = "Base16_FromString should produce the expected Base-16 value.")]
23+
[InlineData("31323334353637383930", "1234567890")]
24+
[InlineData("4142434445464748494a4b4c4d4e4f505152535455565758595a", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]
25+
[InlineData("6162636465666768696a6b6c6d6e6f707172737475767778797a", "abcdefghijklmnopqrstuvwxyz")]
26+
public void Base16FromStringShouldProduceTheExpectedBase16Value(string expected, string value)
27+
{
28+
// Arrange
29+
Base16 candidate = Base16.FromString(value);
30+
31+
// Act
32+
string actual = candidate.ToString();
33+
34+
// Assert
35+
Assert.Equal(expected, actual);
36+
}
37+
38+
[Theory(DisplayName = "Base16_Parse should produce the expected plain text value.")]
39+
[InlineData("1234567890", "31323334353637383930")]
40+
[InlineData("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "4142434445464748494a4b4c4d4e4f505152535455565758595a")]
41+
[InlineData("abcdefghijklmnopqrstuvwxyz", "6162636465666768696a6b6c6d6e6f707172737475767778797a")]
42+
public void Base16ParseShouldProduceTheExpectedPlainTextValue(string expected, string value)
43+
{
44+
// Arrange
45+
Base16 candidate = Base16.Parse(value);
46+
47+
// Act
48+
string actual = candidate.ToPlainTextString();
49+
50+
// Assert
51+
Assert.Equal(expected, actual);
52+
}
53+
}
54+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright 2020-2021 ONIXLabs
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using OnixLabs.Core.Text;
16+
using Xunit;
17+
18+
namespace OnixLabs.Core.UnitTests
19+
{
20+
public sealed class Base32Base32HexAlphabetTests
21+
{
22+
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")]
23+
[InlineData("64P36D1L6ORJGE9G", "1234567890")]
24+
[InlineData("85146H258P3KGIAA9D64QJIFA18L4KQKALB5EM2PB8======", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]
25+
[InlineData("C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8======", "abcdefghijklmnopqrstuvwxyz")]
26+
public void Base32FromStringWithPaddingShouldProduceTheExpectedBase32Value(string expected, string value)
27+
{
28+
// Arrange
29+
Base32 candidate = Base32.FromString(value, Base32Alphabet.Base32Hex, true);
30+
31+
// Act
32+
string actual = candidate.ToString();
33+
34+
// Assert
35+
Assert.Equal(expected, actual);
36+
}
37+
38+
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")]
39+
[InlineData("64P36D1L6ORJGE9G", "1234567890")]
40+
[InlineData("85146H258P3KGIAA9D64QJIFA18L4KQKALB5EM2PB8", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]
41+
[InlineData("C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8", "abcdefghijklmnopqrstuvwxyz")]
42+
public void Base32FromStringWithoutPaddingShouldProduceTheExpectedBase32Value(string expected, string value)
43+
{
44+
// Arrange
45+
Base32 candidate = Base32.FromString(value, Base32Alphabet.Base32Hex, false);
46+
47+
// Act
48+
string actual = candidate.ToString();
49+
50+
// Assert
51+
Assert.Equal(expected, actual);
52+
}
53+
54+
[Theory(DisplayName = "Base32_Parse should produce the expected plain text value.")]
55+
[InlineData("1234567890", "64P36D1L6ORJGE9G")]
56+
[InlineData("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "85146H258P3KGIAA9D64QJIFA18L4KQKALB5EM2PB8")]
57+
[InlineData("abcdefghijklmnopqrstuvwxyz", "C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8")]
58+
public void Base32ParseShouldProduceTheExpectedPlainTextValue(string expected, string value)
59+
{
60+
// Arrange
61+
Base32 candidate = Base32.Parse(value, Base32Alphabet.Base32Hex);
62+
63+
// Act
64+
string actual = candidate.ToPlainTextString();
65+
66+
// Assert
67+
Assert.Equal(expected, actual);
68+
}
69+
}
70+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright 2020-2021 ONIXLabs
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using OnixLabs.Core.Text;
16+
using Xunit;
17+
18+
namespace OnixLabs.Core.UnitTests
19+
{
20+
public sealed class Base32CrockfordAlphabetTests
21+
{
22+
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")]
23+
[InlineData("64S36D1N6RVKGE9G", "1234567890")]
24+
[InlineData("85146H258S3MGJAA9D64TKJFA18N4MTMANB5EP2SB8======", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]
25+
[InlineData("C5H66S35CSKPGTBADDP6TVKFE1RQ4WVMENV7EY3SF8======", "abcdefghijklmnopqrstuvwxyz")]
26+
public void Base32FromStringWithPaddingShouldProduceTheExpectedBase32Value(string expected, string value)
27+
{
28+
// Arrange
29+
Base32 candidate = Base32.FromString(value, Base32Alphabet.Crockford, true);
30+
31+
// Act
32+
string actual = candidate.ToString();
33+
34+
// Assert
35+
Assert.Equal(expected, actual);
36+
}
37+
38+
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")]
39+
[InlineData("64S36D1N6RVKGE9G", "1234567890")]
40+
[InlineData("85146H258S3MGJAA9D64TKJFA18N4MTMANB5EP2SB8", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]
41+
[InlineData("C5H66S35CSKPGTBADDP6TVKFE1RQ4WVMENV7EY3SF8", "abcdefghijklmnopqrstuvwxyz")]
42+
public void Base32FromStringWithoutPaddingShouldProduceTheExpectedBase32Value(string expected, string value)
43+
{
44+
// Arrange
45+
Base32 candidate = Base32.FromString(value, Base32Alphabet.Crockford, false);
46+
47+
// Act
48+
string actual = candidate.ToString();
49+
50+
// Assert
51+
Assert.Equal(expected, actual);
52+
}
53+
54+
[Theory(DisplayName = "Base32_Parse should produce the expected plain text value.")]
55+
[InlineData("1234567890", "64S36D1N6RVKGE9G")]
56+
[InlineData("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "85146H258S3MGJAA9D64TKJFA18N4MTMANB5EP2SB8")]
57+
[InlineData("abcdefghijklmnopqrstuvwxyz", "C5H66S35CSKPGTBADDP6TVKFE1RQ4WVMENV7EY3SF8")]
58+
public void Base32ParseShouldProduceTheExpectedPlainTextValue(string expected, string value)
59+
{
60+
// Arrange
61+
Base32 candidate = Base32.Parse(value, Base32Alphabet.Crockford);
62+
63+
// Act
64+
string actual = candidate.ToPlainTextString();
65+
66+
// Assert
67+
Assert.Equal(expected, actual);
68+
}
69+
}
70+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright 2020-2021 ONIXLabs
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using OnixLabs.Core.Text;
16+
using Xunit;
17+
18+
namespace OnixLabs.Core.UnitTests
19+
{
20+
public sealed class Base32DefaultAlphabetTests
21+
{
22+
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")]
23+
[InlineData("GEZDGNBVGY3TQOJQ", "1234567890")]
24+
[InlineData("IFBEGRCFIZDUQSKKJNGE2TSPKBIVEU2UKVLFOWCZLI======", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]
25+
[InlineData("MFRGGZDFMZTWQ2LKNNWG23TPOBYXE43UOV3HO6DZPI======", "abcdefghijklmnopqrstuvwxyz")]
26+
public void Base32FromStringWithPaddingShouldProduceTheExpectedBase32Value(string expected, string value)
27+
{
28+
// Arrange
29+
Base32 candidate = Base32.FromString(value, Base32Alphabet.Default, true);
30+
31+
// Act
32+
string actual = candidate.ToString();
33+
34+
// Assert
35+
Assert.Equal(expected, actual);
36+
}
37+
38+
[Theory(DisplayName = "Base32_FromString without padding should produce the expected Base-32 value.")]
39+
[InlineData("GEZDGNBVGY3TQOJQ", "1234567890")]
40+
[InlineData("IFBEGRCFIZDUQSKKJNGE2TSPKBIVEU2UKVLFOWCZLI", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]
41+
[InlineData("MFRGGZDFMZTWQ2LKNNWG23TPOBYXE43UOV3HO6DZPI", "abcdefghijklmnopqrstuvwxyz")]
42+
public void Base32FromStringWithoutPaddingShouldProduceTheExpectedBase32Value(string expected, string value)
43+
{
44+
// Arrange
45+
Base32 candidate = Base32.FromString(value, Base32Alphabet.Default, false);
46+
47+
// Act
48+
string actual = candidate.ToString();
49+
50+
// Assert
51+
Assert.Equal(expected, actual);
52+
}
53+
54+
[Theory(DisplayName = "Base32_Parse should produce the expected plain text value.")]
55+
[InlineData("1234567890", "GEZDGNBVGY3TQOJQ")]
56+
[InlineData("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "IFBEGRCFIZDUQSKKJNGE2TSPKBIVEU2UKVLFOWCZLI")]
57+
[InlineData("abcdefghijklmnopqrstuvwxyz", "MFRGGZDFMZTWQ2LKNNWG23TPOBYXE43UOV3HO6DZPI")]
58+
public void Base32ParseShouldProduceTheExpectedPlainTextValue(string expected, string value)
59+
{
60+
// Arrange
61+
Base32 candidate = Base32.Parse(value, Base32Alphabet.Default);
62+
63+
// Act
64+
string actual = candidate.ToPlainTextString();
65+
66+
// Assert
67+
Assert.Equal(expected, actual);
68+
}
69+
}
70+
}

0 commit comments

Comments
 (0)