-
Notifications
You must be signed in to change notification settings - Fork 23
Vladislav savchenko #32
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
Merged
jskonst
merged 23 commits into
ISUCT:Vladislav_Savchenko
from
DeC0re:Vladislav_Savchenko
Dec 17, 2019
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
aeb27bc
Sample of 1st lab
0247220
Tests samples
d514055
Added actions file
jskonst b29aa60
Fixed run steps (#28)
jskonst dbae387
Test actions on PR (#30)
jskonst 953427e
Added tests and sample A|B tasks
jskonst 62b5d9e
Added class task example, added vscode conf
aa0b4b1
Merge branch 'master' of https://github.com/ISUCT/Tprogramming_147_2019
60071cf
lab
DeC0re 178c0e0
lab1.1
DeC0re 967def0
Merge branch 'master' into Vladislav_Savchenko
DeC0re 1faf0dc
lav1.2
DeC0re a623cd7
lab1.3
DeC0re 9df31ec
lab1.3
DeC0re d54fe38
Добавил классы+тесты
DeC0re 70ea92a
Fix error
DeC0re 270ac22
Fix error 1.2
DeC0re 78512a3
Fix error 1.3
DeC0re 1dcfc75
Full
DeC0re cfec148
fix error
DeC0re 23d768b
Full lab v2
DeC0re 5fcb268
Исправил
DeC0re 7aafca5
Update Dog.cs
DeC0re File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,23 @@ | ||
| name: .NET Core | ||
|
|
||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v1 | ||
| - name: Setup .NET Core | ||
| uses: actions/setup-dotnet@v1 | ||
| with: | ||
| dotnet-version: 2.1.802 | ||
| - name: Build with dotnet | ||
| run: | | ||
| cd CourseApp | ||
| dotnet build --configuration Release | ||
| - name: Run tests | ||
| run: | | ||
| cd CourseApp.Tests | ||
| dotnet test |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -198,7 +198,6 @@ $RECYCLE.BIN/ | |
| **/node_modules/* | ||
|
|
||
| # Added by Jskonst | ||
| .vscode/ | ||
| Properties/ | ||
|
|
||
| ##### | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -27,4 +27,4 @@ | |
| <AdditionalFiles Include="../_stylecop/stylecop.json" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
| </Project> | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,14 +1,58 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using Xunit; | ||
|
|
||
| namespace CourseApp.Tests | ||
| { | ||
| public class DemoTest | ||
| { | ||
| [Theory] | ||
| [InlineData(2, 4, 0.01682)] | ||
| [InlineData(10, -5, 0.0195424)] | ||
| public void TestMyFunction(double a, double x, double exp) | ||
| { | ||
| Assert.Equal(Program.Function(a, x), exp, 3); | ||
| } | ||
|
|
||
| [Fact] | ||
|
|
||
| public void TestTaskA() | ||
| { | ||
| double a = 2.0; | ||
| double xn = 1.2; | ||
| double xk = 4.2; | ||
| double dx = 0.6; | ||
| List<double> res = Program.TaskA(a, xn, xk, dx); | ||
| List<double> expy = new List<double> { 0.024919580136386867, 0.02327901792977313, 0.02138591667754329, 0.019542362678459768, 0.01785029731362981 }; | ||
| for (int i = 0; i < 5; i++) | ||
| { | ||
| Assert.Equal(expy[i], res[i], 3); | ||
| } | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test1() | ||
| { | ||
| Assert.True(true); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TestZeroFunction() | ||
| { | ||
| var res = Program.Function(0.0, 0.0); | ||
| Assert.Equal(double.PositiveInfinity, res); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TestTaskB() | ||
| { | ||
| List<double> x = new List<double> { 1.16, 1.32, 1.47, 1.65, 1.93 }; | ||
| List<double> res = Program.TaskB(2.0, x); | ||
| List<double> expy = new List<double> { 0.025004724857363752, 0.024639361870982292, 0.024247019851321865, 0.023732277381772752, 0.022875026963062515 }; | ||
| for (int i = 0; i < 5; i++) | ||
| { | ||
| Assert.Equal(expy[i], res[i], 3); | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,64 @@ | ||
| using System; | ||
| using Xunit; | ||
|
|
||
| namespace CourseApp.Tests | ||
| { | ||
| public class DogTest | ||
| { | ||
| [Fact] | ||
| public void TestConstructor() | ||
| { | ||
| var item = new Dog(); | ||
| Assert.Equal(1, item.Age); | ||
| Assert.Equal("Test", item.Name); | ||
| Assert.Equal("male", item.Sex); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TestSetAge() | ||
| { | ||
| var item = new Dog(); | ||
| item.Age = 3; | ||
| Assert.Equal(3, item.Age); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TestWrongAge() | ||
| { | ||
| var item = new Dog(); | ||
| try | ||
| { | ||
| item.Age = 0; | ||
| } | ||
| catch (System.Exception) | ||
| { | ||
| Console.WriteLine("ERROR! Rewrite Age!"); | ||
| Assert.True(true); | ||
| } | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TestWrongSex() | ||
| { | ||
| var item = new Dog(); | ||
| try | ||
| { | ||
| item.Sex = "lemonade"; | ||
| } | ||
| catch (System.Exception) | ||
| { | ||
| Console.WriteLine("ERROR! Rewrite Sex!"); | ||
| Assert.True(true); | ||
| } | ||
| } | ||
|
|
||
| [Fact] | ||
| public void FullTest() | ||
| { | ||
| var item = new Dog("Doberman", 3, "male"); | ||
| Assert.Equal("Doberman", item.Name); | ||
| Assert.Equal("male", item.Sex); | ||
| Assert.Equal(3, item.Age); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,25 @@ | ||
| { | ||
| // Use IntelliSense to learn about possible attributes. | ||
| // Hover to view descriptions of existing attributes. | ||
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": ".NET Core Launch (console)", | ||
| "type": "coreclr", | ||
| "request": "launch", | ||
| "preLaunchTask": "build", | ||
| "program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/CourseApp.dll", | ||
| "args": [], | ||
| "cwd": "${workspaceFolder}", | ||
| "console": "internalConsole", | ||
| "stopAtEntry": false | ||
| }, | ||
| { | ||
| "name": ".NET Core Attach", | ||
| "type": "coreclr", | ||
| "request": "attach", | ||
| "processId": "${command:pickProcess}" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or 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,42 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "build", | ||
| "command": "dotnet", | ||
| "type": "process", | ||
| "args": [ | ||
| "build", | ||
| "${workspaceFolder}/CourseApp.csproj", | ||
| "/property:GenerateFullPaths=true", | ||
| "/consoleloggerparameters:NoSummary" | ||
| ], | ||
| "problemMatcher": "$msCompile" | ||
| }, | ||
| { | ||
| "label": "publish", | ||
| "command": "dotnet", | ||
| "type": "process", | ||
| "args": [ | ||
| "publish", | ||
| "${workspaceFolder}/CourseApp.csproj", | ||
| "/property:GenerateFullPaths=true", | ||
| "/consoleloggerparameters:NoSummary" | ||
| ], | ||
| "problemMatcher": "$msCompile" | ||
| }, | ||
| { | ||
| "label": "watch", | ||
| "command": "dotnet", | ||
| "type": "process", | ||
| "args": [ | ||
| "watch", | ||
| "run", | ||
| "${workspaceFolder}/CourseApp.csproj", | ||
| "/property:GenerateFullPaths=true", | ||
| "/consoleloggerparameters:NoSummary" | ||
| ], | ||
| "problemMatcher": "$msCompile" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -20,4 +20,4 @@ | |
| <AdditionalFiles Include="../_stylecop/stylecop.json" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
| </Project> | ||
This file contains hidden or 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,80 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace CourseApp | ||
| { | ||
| public class Dog | ||
| { | ||
| private int age; | ||
| private string sex; | ||
|
|
||
| public Dog() | ||
| : this("Test") | ||
| { | ||
| } | ||
|
|
||
| public Dog(string name, int age, string sex) | ||
| { | ||
| Name = name; | ||
| Age = age; | ||
| Sex = sex; | ||
| } | ||
|
|
||
| public Dog(string name) | ||
| : this(name, 1, "male") | ||
| { | ||
| } | ||
|
|
||
| public string Name { get; set; } | ||
|
|
||
| public string Sex | ||
| { | ||
| get | ||
| { | ||
| return this.sex; | ||
| } | ||
|
|
||
| set | ||
| { | ||
| if (value == "male") | ||
| { | ||
| this.sex = value; | ||
| } | ||
| else | ||
| { | ||
| throw new System.Exception(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public int Age | ||
| { | ||
| get | ||
| { | ||
| return this.age; | ||
| } | ||
|
|
||
| set | ||
| { | ||
| if (value >= 1 && value < 10) | ||
| { | ||
| this.age = value; | ||
| } | ||
| else | ||
| { | ||
| throw new System.Exception(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public override string ToString() | ||
| { | ||
| return $"Имя:{Name},Возраст:{Age},Пол:{Sex}"; | ||
| } | ||
|
|
||
| public void AgeUp() | ||
| { | ||
| this.Age++; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,13 +1,67 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace CourseApp | ||
| { | ||
| public class Program | ||
| { | ||
| public static double Function(double a, double x) | ||
| { | ||
| var y = Math.Pow(Math.Log10(a + x), 2) / Math.Pow(a + x, 2); | ||
|
|
||
| return y; | ||
| } | ||
|
|
||
| public static List<double> TaskA(double a, double xn, double xk, double dx) | ||
| { | ||
| int k = 0; | ||
| List<double> y = new List<double>(5); | ||
| for (var i = xn; i < xk; i += dx) | ||
| { | ||
| y.Add(Function(a, i)); | ||
| k++; | ||
| } | ||
|
|
||
| return y; | ||
| } | ||
|
|
||
| public static List<double> TaskB(double a, List<double> x) | ||
| { | ||
| List<double> y = new List<double>(5); | ||
| for (var i = 0; i < x.Count; i++) | ||
| { | ||
| y.Add(Function(a, x[i])); | ||
| } | ||
|
|
||
| return y; | ||
| } | ||
|
|
||
| public static void Main(string[] args) | ||
| { | ||
| Console.WriteLine("Hello World!"); | ||
| Console.ReadLine(); | ||
| double a = 2.0; | ||
| double xn = 1.2; | ||
| double xk = 4.2; | ||
| double dx = 0.6; | ||
| var resA = TaskA(a, xn, xk, dx); | ||
| Console.WriteLine("=========="); | ||
| Console.WriteLine("Задание А:"); | ||
| Console.WriteLine("=========="); | ||
| foreach (var item in resA) | ||
| { | ||
| Console.WriteLine($"y = {item}"); | ||
| } | ||
|
|
||
| Console.WriteLine("=========="); | ||
| List<double> x = new List<double> { 1.16, 1.32, 1.47, 1.65, 1.93 }; | ||
| var taskBRes = TaskB(a, x); | ||
| Console.WriteLine("Задание В:"); | ||
| Console.WriteLine("=========="); | ||
| foreach (var item in taskBRes) | ||
| { | ||
| Console.WriteLine($"y1 = {item}"); | ||
| } | ||
|
|
||
| Console.WriteLine("=========="); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| Vladislav_Savchenko | ||
| Vladislav_Savchenko | ||
| # Tprogramming_147_2019 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.