-
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.
All new features excluding numerics and units
1 parent
556fd77
commit 2fb2690
Showing
230 changed files
with
4,978 additions
and
2,432 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ root = true | |
|
||
[*] | ||
max_line_length = 140 | ||
insert_final_newline = true |
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
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
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,31 @@ | ||
// Copyright 2020-2023 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. | ||
|
||
namespace OnixLabs.Core.UnitTests.Data.Objects; | ||
|
||
public sealed class Element | ||
{ | ||
public Element(int hashCode = 0) | ||
{ | ||
HashCode = hashCode; | ||
} | ||
|
||
public bool Called { get; set; } | ||
private int HashCode { get; } | ||
|
||
public override int GetHashCode() | ||
{ | ||
return HashCode; | ||
} | ||
} |
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,47 @@ | ||
// Copyright 2020-2023 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 System.Numerics; | ||
|
||
namespace OnixLabs.Core.UnitTests.Data.Objects; | ||
|
||
public sealed class Numeric<T> : IEquatable<Numeric<T>> where T : INumber<T> | ||
{ | ||
public Numeric(T value) | ||
{ | ||
Value = value; | ||
} | ||
|
||
public T Value { get; } | ||
|
||
public bool Equals(Numeric<T>? other) | ||
{ | ||
return other is not null && other.Value == Value; | ||
} | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
return obj is Numeric<T> other && Equals(other); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return HashCode.Combine(Value); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return this.ToRecordString(); | ||
} | ||
} |
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,56 @@ | ||
// Copyright 2020-2023 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. | ||
|
||
namespace OnixLabs.Core.UnitTests.Data.Objects; | ||
|
||
public sealed class RecordLike : IEquatable<RecordLike> | ||
{ | ||
public RecordLike(string text, int number, DateTime moment, Guid identifier) | ||
{ | ||
Text = text; | ||
Number = number; | ||
Moment = moment; | ||
Identifier = identifier; | ||
} | ||
|
||
public string Text { get; } | ||
public int Number { get; } | ||
public DateTime Moment { get; } | ||
public Guid Identifier { get; } | ||
|
||
public bool Equals(RecordLike? other) | ||
{ | ||
return ReferenceEquals(this, other) | ||
|| other is not null | ||
&& other.Text == Text | ||
&& other.Number == Number | ||
&& other.Moment == Moment | ||
&& other.Identifier == Identifier; | ||
} | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
return Equals(obj as RecordLike); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return HashCode.Combine(Text, Number, Moment, Identifier); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"RecordLike {{ Text = {Text}, Number = {Number}, Moment = {Moment}, Identifier = {Identifier} }}"; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
OnixLabs.Core.UnitTests.Data/OnixLabs.Core.UnitTests.Data.csproj
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 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> | ||
<PackageReference Include="xunit" Version="2.4.2" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\OnixLabs.Core\OnixLabs.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,65 @@ | ||
// Copyright 2020-2023 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 Xunit; | ||
|
||
namespace OnixLabs.Core.UnitTests; | ||
|
||
public sealed class ArrayExtensionTests | ||
{ | ||
[Fact(DisplayName = "Array.Copy should produce a copy of an array")] | ||
public void CopyShouldProduceExpectedResult() | ||
{ | ||
// Given | ||
int[] array = { 1, 2, 3, 4, 5 }; | ||
int[] expected = { 1, 2, 3, 4, 5 }; | ||
|
||
// When | ||
int[] actual = array.Copy(); | ||
|
||
// Then | ||
Assert.Equal(expected, actual); | ||
Assert.True(!ReferenceEquals(array, actual)); | ||
} | ||
|
||
[Fact(DisplayName = "Array.Copy with index and count parameters should produce a copy of an array")] | ||
public void CopyWithParametersShouldProduceExpectedResult() | ||
{ | ||
// Given | ||
int[] array = { 1, 2, 3, 4, 5 }; | ||
int[] expected = { 3, 4, 5 }; | ||
|
||
// When | ||
int[] actual = array.Copy(2, 3); | ||
|
||
// Then | ||
Assert.Equal(expected, actual); | ||
Assert.True(!ReferenceEquals(array, actual)); | ||
} | ||
|
||
[Fact(DisplayName = "Array.ConcatenateWith should produce a concatenation of two arrays")] | ||
public void ConcatenateWithShouldProduceExpectedResult() | ||
{ | ||
// Given | ||
int[] left = { 1, 2, 3, 4, 5 }; | ||
int[] right = { 6, 7, 8, 9, 10 }; | ||
int[] expected = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; | ||
|
||
// When | ||
int[] actual = left.ConcatenateWith(right); | ||
|
||
// Then | ||
Assert.Equal(expected, actual); | ||
} | ||
} |
Oops, something went wrong.