Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
[*.cs]

# SA1600: Elements should be documented
dotnet_diagnostic.SA1600.severity = none

[*.cs]
#### Стили именования ####

# Правила именования

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Спецификации символов

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Стили именования

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_indent_labels = one_less_than_current

[*.vb]
#### Стили именования ####

# Правила именования

dotnet_naming_rule.interface_should_be_начинается_с_i.severity = suggestion
dotnet_naming_rule.interface_should_be_начинается_с_i.symbols = interface
dotnet_naming_rule.interface_should_be_начинается_с_i.style = начинается_с_i

dotnet_naming_rule.типы_should_be_всечастиспрописнойбуквы.severity = suggestion
dotnet_naming_rule.типы_should_be_всечастиспрописнойбуквы.symbols = типы
dotnet_naming_rule.типы_should_be_всечастиспрописнойбуквы.style = всечастиспрописнойбуквы

dotnet_naming_rule.не_являющиеся_полем_члены_should_be_всечастиспрописнойбуквы.severity = suggestion
dotnet_naming_rule.не_являющиеся_полем_члены_should_be_всечастиспрописнойбуквы.symbols = не_являющиеся_полем_члены
dotnet_naming_rule.не_являющиеся_полем_члены_should_be_всечастиспрописнойбуквы.style = всечастиспрописнойбуквы

# Спецификации символов

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.типы.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.типы.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
dotnet_naming_symbols.типы.required_modifiers =

dotnet_naming_symbols.не_являющиеся_полем_члены.applicable_kinds = property, event, method
dotnet_naming_symbols.не_являющиеся_полем_члены.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
dotnet_naming_symbols.не_являющиеся_полем_члены.required_modifiers =

# Стили именования

dotnet_naming_style.начинается_с_i.required_prefix = I
dotnet_naming_style.начинается_с_i.required_suffix =
dotnet_naming_style.начинается_с_i.word_separator =
dotnet_naming_style.начинается_с_i.capitalization = pascal_case

dotnet_naming_style.всечастиспрописнойбуквы.required_prefix =
dotnet_naming_style.всечастиспрописнойбуквы.required_suffix =
dotnet_naming_style.всечастиспрописнойбуквы.word_separator =
dotnet_naming_style.всечастиспрописнойбуквы.capitalization = pascal_case

dotnet_naming_style.всечастиспрописнойбуквы.required_prefix =
dotnet_naming_style.всечастиспрописнойбуквы.required_suffix =
dotnet_naming_style.всечастиспрописнойбуквы.word_separator =
dotnet_naming_style.всечастиспрописнойбуквы.capitalization = pascal_case

[*.{cs,vb}]
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit.Analyzers" Version="4.4.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ParallelMatrixMultiplication\ParallelMatrixMultiplication.csproj" />
</ItemGroup>


<ItemGroup>
<None Remove="stylecop.json" />
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="stylecop.json" />
</ItemGroup>

<ItemGroup>
<Using Include="NUnit.Framework" />
</ItemGroup>

<ItemGroup>
<None Update="expectedForSaveToFileTest.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="firstTestFileForRead.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="secondTestFileForRead.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// <copyright file="TestLoadFromFile.cs" company="Kalinin Andrew">
// Copyright (c) Kalinin Andrew. All rights reserved.
// </copyright>

namespace ParallelMatrixMultiplication.Test;

public class TestLoadFromFile
{
private Matrix firstExpectedMatrix;
private Matrix secondExpectedMatrix;

[SetUp]
public void Setup()
{
this.firstExpectedMatrix = new Matrix(new int[,]
{
{ 15, 16, 17 },
{ 20, 23, 26 },
{ 29, 32, 35 },
});

this.secondExpectedMatrix = new Matrix(new int[,]
{
{ 1, 2, 3, 4, 5 },
{ 6, 7, 8, 9, 10 },
});
}

[Test]
public void LoadFromFile_SquareMatrix_ShouldReturnExpectedResult()
{
var result = Matrix.LoadFromFile("firstTestFileForRead.txt");
for (int i = 0; i < result.Rows; ++i)
{
for (int j = 0; j < result.Columns; ++j)
{
Assert.That(result[i, j], Is.EqualTo(this.firstExpectedMatrix[i, j]));
}
}
}

[Test]
public void LoadFromFile_NotSquareMatrix_ShouldReturnExpectedResult()
{
var result = Matrix.LoadFromFile("secondTestFileForRead.txt");
for (int i = 0; i < result.Rows; ++i)
{
for (int j = 0; j < result.Columns; ++j)
{
Assert.That(result[i, j], Is.EqualTo(this.secondExpectedMatrix[i, j]));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// <copyright file="TestSaveToFile.cs" company="Kalinin Andrew">
// Copyright (c) Kalinin Andrew. All rights reserved.
// </copyright>

namespace ParallelMatrixMultiplication.Test;

public class TestSaveToFile
{
private Matrix matrixToSave;
private string currentFilePath;

[SetUp]
public void Setup()
{
this.matrixToSave = new Matrix(new int[,]
{
{ 99, 90, 88, 80 },
{ 77, 70, 66, 60 },
{ 55, 50, 44, 40 },
});

this.currentFilePath = "Test_STF.txt";
}

[TearDown]
public void Teardown()
{
if (File.Exists(this.currentFilePath))
{
File.Delete(this.currentFilePath);
}
}

[Test]
public void SaveToFile_ValidData_ShouldCreateExpectedFile()
{
this.matrixToSave.SaveToFile(this.currentFilePath);

Assert.That(File.Exists(this.currentFilePath), Is.True);

string expectedData = File.ReadAllText("expectedForSaveToFileTest.txt");
string currentData = File.ReadAllText(this.currentFilePath);

Assert.That(currentData, Is.EqualTo(expectedData));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// <copyright file="TestsBothMethodsAreSimilar.cs" company="Kalinin Andrew">
// Copyright (c) Kalinin Andrew. All rights reserved.
// </copyright>

namespace ParallelMatrixMultiplication.Test;

public class TestsBothMethodsAreSimilar
{
private Matrix testRandomMatrixA;
private Matrix testRandomMatrixB;

[SetUp]
public void Setup()
{
this.testRandomMatrixA = Matrix.GenerateRandomMatrix(77, 33);
this.testRandomMatrixB = Matrix.GenerateRandomMatrix(33, 77);
}

[Test]
public void SequentialAndParallelMultiplication_RandomMatrix_ShouldReturnSameResult()
{
var parallelResult = MatrixMultiplier.ParallelMultiplication(this.testRandomMatrixA, this.testRandomMatrixB, 4);
var sequentialResult = MatrixMultiplier.SequentialMultiplication(this.testRandomMatrixA, this.testRandomMatrixB);
for (int i = 0; i < parallelResult.Rows; ++i)
{
for (int j = 0; j < parallelResult.Columns; ++j)
{
Assert.That(parallelResult[i, j], Is.EqualTo(sequentialResult[i, j]));
}
}
}
}
Loading