Skip to content

Merge release 7.0.0 #40

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

Closed
wants to merge 14 commits into from
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 10 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
root = true

[*]
max_line_length = 140
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
continuation_indent_size = 4
max_line_length = 140

# ReSharper properties
resharper_csharp_wrap_lines = false
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .idea/.idea.onixlabs-dotnet/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .run/Build & Test.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Build &amp; Test" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="dotnet build &amp;&amp; dotnet test" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/zsh" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>
20 changes: 20 additions & 0 deletions .run/Run Playground.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Playground" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/OnixLabs.Playground/bin/Debug/net8.0/OnixLabs.Playground" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/OnixLabs.Playground/bin/Debug/net8.0" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/OnixLabs.Playground/OnixLabs.Playground.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="net8.0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Copyright 2020-2022 ONIXLabs
//
// Copyright 2020 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.MockData;
namespace OnixLabs.Core.UnitTests.Data;

public sealed class Color : Enumeration<Color>
{
Expand Down
23 changes: 23 additions & 0 deletions OnixLabs.Core.UnitTests.Data/Element.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2020 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;

public sealed class Element(int hashCode = 0)
{
public bool Called { get; set; }
private int HashCode { get; } = hashCode;

public override int GetHashCode() => HashCode;
}
30 changes: 30 additions & 0 deletions OnixLabs.Core.UnitTests.Data/Numeric.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2020 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;

public sealed class Numeric<T>(T value) : IEquatable<Numeric<T>> where T : INumber<T>
{
public T Value { get; } = value;

public bool Equals(Numeric<T>? other) => other is not null && other.Value == Value;

public override bool Equals(object? obj) => obj is Numeric<T> other && Equals(other);

public override int GetHashCode() => HashCode.Combine(Value);

public override string ToString() => this.ToRecordString();
}
29 changes: 29 additions & 0 deletions OnixLabs.Core.UnitTests.Data/OnixLabs.Core.UnitTests.Data.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>

<LangVersion>12</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="xunit" Version="2.6.4"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OnixLabs.Core\OnixLabs.Core.csproj"/>
</ItemGroup>
<ItemGroup>
<Using Include="OnixLabs.Core.Preconditions" Static="True"/>
</ItemGroup>
</Project>
17 changes: 17 additions & 0 deletions OnixLabs.Core.UnitTests.Data/Record.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2020 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;

public sealed record Record<T>(string Text, int Number, T Value);
65 changes: 65 additions & 0 deletions OnixLabs.Core.UnitTests/ArrayExtensionTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright 2020 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.False(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.False(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);
}
}
Loading
Loading