add test for fill
This commit is contained in:
parent
1bd4c3038a
commit
f83c350fcf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,14 +2,14 @@
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{67C8B376-25F3-481A-8684-66E651A0461B}|MatrixProject.Test\\MatrixProject.Test.csproj|c:\\users\\hackaton\\source\\repos\\matrixsolution\\matrixsol\\matrixproject.test\\matrixtest.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{67C8B376-25F3-481A-8684-66E651A0461B}|MatrixProject.Test\\MatrixProject.Test.csproj|solutionrelative:matrixproject.test\\matrixtest.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{E812BC68-6D94-4469-B05B-ADCA58D74C56}|MatrixProject\\MatrixProject.csproj|c:\\users\\hackaton\\source\\repos\\matrixsolution\\matrixsol\\matrixproject\\matrix.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{E812BC68-6D94-4469-B05B-ADCA58D74C56}|MatrixProject\\MatrixProject.csproj|solutionrelative:matrixproject\\matrix.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{67C8B376-25F3-481A-8684-66E651A0461B}|MatrixProject.Test\\MatrixProject.Test.csproj|c:\\users\\hackaton\\source\\repos\\matrixsolution\\matrixsol\\matrixproject.test\\matrixtest.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{67C8B376-25F3-481A-8684-66E651A0461B}|MatrixProject.Test\\MatrixProject.Test.csproj|solutionrelative:matrixproject.test\\matrixtest.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{67C8B376-25F3-481A-8684-66E651A0461B}|MatrixProject.Test\\MatrixProject.Test.csproj|c:\\users\\hackaton\\source\\repos\\matrixsolution\\matrixsol\\matrixproject.test\\matrixproject.test.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|",
|
||||
"RelativeMoniker": "D:0:0:{67C8B376-25F3-481A-8684-66E651A0461B}|MatrixProject.Test\\MatrixProject.Test.csproj|solutionrelative:matrixproject.test\\matrixproject.test.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|"
|
||||
@ -22,7 +22,7 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 1,
|
||||
"SelectedChildIndex": 2,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
@ -34,32 +34,34 @@
|
||||
"RelativeToolTip": "MatrixProject.Test\\MatrixProject.Test.csproj",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|",
|
||||
"WhenOpened": "2024-10-08T07:03:47.001Z"
|
||||
"WhenOpened": "2024-10-08T07:03:47.001Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"DocumentIndex": 1,
|
||||
"Title": "MatrixTest.cs",
|
||||
"DocumentMoniker": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject.Test\\MatrixTest.cs",
|
||||
"RelativeDocumentMoniker": "MatrixProject.Test\\MatrixTest.cs",
|
||||
"ToolTip": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject.Test\\MatrixTest.cs*",
|
||||
"RelativeToolTip": "MatrixProject.Test\\MatrixTest.cs*",
|
||||
"ViewState": "AgIAABkAAAAAAAAAAAAAACAAAAAvAAAAAAAAAA==",
|
||||
"ToolTip": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject.Test\\MatrixTest.cs",
|
||||
"RelativeToolTip": "MatrixProject.Test\\MatrixTest.cs",
|
||||
"ViewState": "AgIAACEAAAAAAAAAAMBCwC0AAAA1AAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-10-08T06:41:24.991Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Matrix.cs",
|
||||
"DocumentMoniker": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject\\Matrix.cs",
|
||||
"RelativeDocumentMoniker": "MatrixProject\\Matrix.cs",
|
||||
"ToolTip": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject\\Matrix.cs",
|
||||
"RelativeToolTip": "MatrixProject\\Matrix.cs",
|
||||
"ViewState": "AgIAABYAAAAAAAAAAAAqwAsAAAAAAAAAAAAAAA==",
|
||||
"ToolTip": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject\\Matrix.cs*",
|
||||
"RelativeToolTip": "MatrixProject\\Matrix.cs*",
|
||||
"ViewState": "AgIAABkAAAAAAAAAAAAAACYAAAAeAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-10-08T06:36:26.85Z"
|
||||
"WhenOpened": "2024-10-08T06:36:26.85Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,69 +1,12 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{67C8B376-25F3-481A-8684-66E651A0461B}|MatrixProject.Test\\MatrixProject.Test.csproj|c:\\users\\hackaton\\source\\repos\\matrixsolution\\matrixsol\\matrixproject.test\\matrixtest.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{67C8B376-25F3-481A-8684-66E651A0461B}|MatrixProject.Test\\MatrixProject.Test.csproj|solutionrelative:matrixproject.test\\matrixtest.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{E812BC68-6D94-4469-B05B-ADCA58D74C56}|MatrixProject\\MatrixProject.csproj|c:\\users\\hackaton\\source\\repos\\matrixsolution\\matrixsol\\matrixproject\\matrix.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{E812BC68-6D94-4469-B05B-ADCA58D74C56}|MatrixProject\\MatrixProject.csproj|solutionrelative:matrixproject\\matrix.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{67C8B376-25F3-481A-8684-66E651A0461B}|MatrixProject.Test\\MatrixProject.Test.csproj|c:\\users\\hackaton\\source\\repos\\matrixsolution\\matrixsol\\matrixproject.test\\matrixproject.test.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|",
|
||||
"RelativeMoniker": "D:0:0:{67C8B376-25F3-481A-8684-66E651A0461B}|MatrixProject.Test\\MatrixProject.Test.csproj|solutionrelative:matrixproject.test\\matrixproject.test.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|"
|
||||
}
|
||||
],
|
||||
"Documents": [],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "MatrixProject.Test.csproj",
|
||||
"DocumentMoniker": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject.Test\\MatrixProject.Test.csproj",
|
||||
"RelativeDocumentMoniker": "MatrixProject.Test\\MatrixProject.Test.csproj",
|
||||
"ToolTip": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject.Test\\MatrixProject.Test.csproj",
|
||||
"RelativeToolTip": "MatrixProject.Test\\MatrixProject.Test.csproj",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|",
|
||||
"WhenOpened": "2024-10-08T07:03:47.001Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "MatrixTest.cs",
|
||||
"DocumentMoniker": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject.Test\\MatrixTest.cs",
|
||||
"RelativeDocumentMoniker": "MatrixProject.Test\\MatrixTest.cs",
|
||||
"ToolTip": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject.Test\\MatrixTest.cs*",
|
||||
"RelativeToolTip": "MatrixProject.Test\\MatrixTest.cs*",
|
||||
"ViewState": "AgIAABYAAAAAAAAAAAAAACAAAAA6AAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-10-08T06:41:24.991Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "Matrix.cs",
|
||||
"DocumentMoniker": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject\\Matrix.cs",
|
||||
"RelativeDocumentMoniker": "MatrixProject\\Matrix.cs",
|
||||
"ToolTip": "C:\\Users\\Hackaton\\source\\repos\\MatrixSolution\\MatrixSol\\MatrixProject\\Matrix.cs",
|
||||
"RelativeToolTip": "MatrixProject\\Matrix.cs",
|
||||
"ViewState": "AgIAABYAAAAAAAAAAAAqwAsAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-10-08T06:36:26.85Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"DocumentGroups": []
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
BIN
.vs/MatrixSol/v17/TestStore/0/002.testlog
Normal file
BIN
.vs/MatrixSol/v17/TestStore/0/002.testlog
Normal file
Binary file not shown.
Binary file not shown.
@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace MatrixProject.Test;
|
||||
@ -34,13 +35,33 @@ public class MatrixTest
|
||||
|
||||
Assert.True(EqualsTwoDimArray(testArray, matrix));
|
||||
}
|
||||
[Theory]
|
||||
[MemberData(nameof(testMult))]
|
||||
public void CheckMultOnScalar(int row,
|
||||
int column,
|
||||
int fillNumber,
|
||||
int scalar,
|
||||
double[,] testArray)
|
||||
{
|
||||
|
||||
Matrix matrix = new Matrix(row, column, fillNumber);
|
||||
matrix = matrix * scalar;
|
||||
Assert.True(EqualsTwoDimArray(testArray, matrix));
|
||||
}
|
||||
|
||||
|
||||
public static TheoryData<int, int,int, double[,]> testTwoDimArray => new () {
|
||||
|
||||
{2, 2, 3, new double[,] { { 3, 3 }, { 3, 3 } } },
|
||||
{2, 2, 3, new double[,] { { 3, 3 }, { 3, 3 } } },
|
||||
{2, 2, 3, new double[,] { { 3, 3 }, { 3, 3 } } },
|
||||
{2, 2, 3, new double[,] { { 3, 3 }, { 3, 3 } } },
|
||||
{2, 2, 3, new double[,] { { 3, 3 }, { 3, 3 } } }
|
||||
};
|
||||
public static TheoryData<int, int, int, int, double[,]> testMult => new() {
|
||||
|
||||
{2, 2, 1, 4, new double[2,2]{ {4,4 }, {4,4} }}
|
||||
};
|
||||
private bool EqualsTwoDimArray(double[,] testMatrix, Matrix matrix) {
|
||||
if(testMatrix.GetLength(0) != matrix.Rows ||
|
||||
testMatrix.GetLength(1) != matrix.Columns) return false;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("MatrixProject.Test")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+12d34f5c88cab82114d0839c74fb63606c53e1f1")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1bd4c3038a77608789d2670603fc673e2fb44392")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("MatrixProject.Test")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("MatrixProject.Test")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
07a74fdae5de3d8fdbd8f0eeea4af0b546026a6df884507ed58e9a6aa3b4633e
|
||||
febd42cc5d6a1f221977452793563afdd2aaf235cb88f9a3831c0cb0aa26a19d
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -7,6 +7,7 @@ public struct Matrix
|
||||
public int Rows { get => _data.GetLength(0);}
|
||||
public int Columns { get => _data.GetLength(1);}
|
||||
|
||||
|
||||
public Matrix(int rows)
|
||||
{
|
||||
|
||||
@ -28,8 +29,26 @@ public struct Matrix
|
||||
|
||||
}
|
||||
|
||||
public static Matrix operator +(Matrix matrix, Matrix matrixTwo) {
|
||||
|
||||
}
|
||||
|
||||
public static Matrix operator *(Matrix matrix, int scalar)
|
||||
{
|
||||
|
||||
for (int i = 0; i < matrix.Rows; i++)
|
||||
{
|
||||
for (int j = 0; j < matrix.Columns; j++)
|
||||
{
|
||||
matrix[i, j] *= scalar;
|
||||
}
|
||||
}
|
||||
return matrix;
|
||||
}
|
||||
|
||||
public double this[int row, int column] {
|
||||
get => _data[row,column];
|
||||
set => _data[row,column] = value;
|
||||
}
|
||||
|
||||
private void FillMatrixByNumber(int number) {
|
||||
|
Binary file not shown.
Binary file not shown.
@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("MatrixProject")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1bd4c3038a77608789d2670603fc673e2fb44392")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("MatrixProject")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("MatrixProject")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
d7c34a619041f2f6c2f53546f7d9e2389b344dc33c2006e1e9af3830adae0cb8
|
||||
033244a125e22f841367e6d940b4166b39a20773945115ceb6e9da40387ef197
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user