-
Notifications
You must be signed in to change notification settings - Fork 23
Evgenij Satyev #33
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
Merged
Evgenij Satyev #33
Changes from all commits
Commits
Show all changes
20 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
481bc20
Merge branch 'master' into Evgenij_Satyev
yinegve dc366c9
Function v1.0
yinegve 09e9cc0
Function v1.1
yinegve 370715c
Update
yinegve 7b7eece
FunctionTest v1.0
yinegve dd98a0c
AddTests
yinegve c88f283
AddClass
yinegve 9531f0d
AddTestClass
yinegve c71172b
Add function collection
yinegve 5c98827
Add Test + collection
yinegve 455f611
add class+exception
yinegve 15b0626
add test+exception
yinegve 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 was deleted.
Oops, something went wrong.
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,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace CourseApp.Tests | ||
{ | ||
public class FunctionTest | ||
{ | ||
[Theory] | ||
[InlineData(0, double.NegativeInfinity)] | ||
[InlineData(2, 0.2)] | ||
[InlineData(1, 0)] | ||
public void TestCalc(double x, double exp) | ||
{ | ||
var res = Function.MyFunction(x); | ||
Assert.Equal(exp, res, 1); | ||
} | ||
|
||
[Fact] | ||
public void TestNormalA() | ||
{ | ||
List<double> action = Function.TaskA(0.11, 0.36, 0.05); | ||
List<double> s = new List<double>() { -0.942599174573112, -0.768989662415832, -0.640224062047432, -0.537938691770828, -0.453755045309719 }; | ||
for (var i = 0; i < 5; i++) | ||
{ | ||
Assert.Equal(action[i], s[i], 3); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void TestNormalB() | ||
{ | ||
List<double> x = new List<double> { 0.2, 0.3, 0.38, 0.43, 0.57 }; | ||
var actial = Function.TaskB(x); | ||
List<double> exp = new List<double> { -0.663479953941618, -0.469395196867133, -0.357994574230452, -0.301819984896032, -0.184040925422074 }; | ||
for (var i = 0; i < 5; i++) | ||
{ | ||
Assert.Equal(exp[i], actial[i], 3); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void TestZeroLengthB() | ||
{ | ||
var res = Function.TaskB(new List<double>()); | ||
Assert.Empty(res); | ||
} | ||
} | ||
} |
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,56 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace CourseApp.Tests | ||
{ | ||
public class PistolTest | ||
{ | ||
[Fact] | ||
public void TestEmptyConstructor() | ||
{ | ||
var item = new Pistol(); | ||
Assert.Equal(0, item.Kalibr); | ||
Assert.Equal("No model", item.Model); | ||
Assert.True(item.Fire); | ||
} | ||
|
||
[Fact] | ||
public void TestSetAge() | ||
{ | ||
var item = new Pistol(); | ||
item.Kalibr = 5; | ||
Assert.Equal(5, item.Kalibr); | ||
} | ||
|
||
[Fact] | ||
public void TestShoot() | ||
{ | ||
var item = new Pistol("Glock", 10, true); | ||
var act = item.Shoot(true); | ||
Assert.Equal($"Pistol Glock and 10 made the shot!", act); | ||
} | ||
|
||
[Fact] | ||
public void TestNumShoot() | ||
{ | ||
var item = new Pistol("Glock", 10, true); | ||
var act = item.NumShoot(15); | ||
Assert.Equal($"Glock made of 15 shots", act); | ||
} | ||
|
||
[Fact] | ||
public void TestCorrectIncorrectSetKalibr() | ||
{ | ||
var item = new Pistol(); | ||
try | ||
{ | ||
item.Kalibr = -5; | ||
Assert.Equal(-5, item.Kalibr); | ||
} | ||
catch (System.Exception) | ||
{ | ||
Assert.True(true); | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.28307.852 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CourseApp", "CourseApp.csproj", "{17CB0273-34D3-4D23-965F-FC4AD0A83D0F}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CourseApp.Tests", "..\CourseApp.Tests\CourseApp.Tests.csproj", "{E0133767-62A2-4B4A-87A2-BD09BC775E0A}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{17CB0273-34D3-4D23-965F-FC4AD0A83D0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{17CB0273-34D3-4D23-965F-FC4AD0A83D0F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{17CB0273-34D3-4D23-965F-FC4AD0A83D0F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{17CB0273-34D3-4D23-965F-FC4AD0A83D0F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{E0133767-62A2-4B4A-87A2-BD09BC775E0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E0133767-62A2-4B4A-87A2-BD09BC775E0A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E0133767-62A2-4B4A-87A2-BD09BC775E0A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E0133767-62A2-4B4A-87A2-BD09BC775E0A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {1849B280-B447-4D18-9764-F412B7768C4F} | ||
EndGlobalSection | ||
EndGlobal |
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,69 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace CourseApp | ||
{ | ||
public class Function | ||
{ | ||
public static double MyFunction(double x) | ||
{ | ||
var c = (Math.Pow(Math.Sin(x), 3) + Math.Pow(Math.Cos(x), 3)) * Math.Log10(x); | ||
Console.WriteLine(c); | ||
return c; | ||
} | ||
|
||
public static List<double> TaskA( | ||
double xn, | ||
double xk, | ||
double dx) | ||
{ | ||
List<double> y = new List<double>(); | ||
for (var x = xn; x < xk; x += dx) | ||
{ | ||
y.Add(MyFunction(x)); | ||
} | ||
|
||
return y; | ||
} | ||
|
||
public static List<double> TaskB ( | ||
List<double> x) | ||
{ | ||
List<double> y = new List<double>(5); | ||
foreach (double i in x) | ||
{ | ||
y.Add(MyFunction(i)); | ||
} | ||
|
||
return y; | ||
} | ||
|
||
public static void Main(string[] args) | ||
{ | ||
MyFunction(0); | ||
Console.WriteLine("Hello World!"); | ||
List<double> taskA = TaskA(0.11, 0.36, 0.05); | ||
Console.WriteLine(taskA); | ||
|
||
foreach (var item in taskA) | ||
{ | ||
Console.WriteLine($"y={item}"); | ||
} | ||
|
||
List<double> xB = new List<double>() { 0.2, 0.3, 0.38, 0.43, 0.57 }; | ||
List<double> taskB = TaskB(xB); | ||
for (int i = 0; i < 5; i++) | ||
{ | ||
Console.WriteLine($"x={xB[i]}"); | ||
} | ||
|
||
foreach (var item in taskB) | ||
{ | ||
Console.WriteLine($"y={item}"); | ||
} | ||
|
||
Console.ReadLine(); | ||
} | ||
} | ||
} |
Oops, something went wrong.
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.