-
Notifications
You must be signed in to change notification settings - Fork 17
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
Gleb vasjagin #58
base: Gleb_Vasjagin
Are you sure you want to change the base?
Gleb vasjagin #58
Changes from 25 commits
bb95848
cf10946
591e070
435b5bc
84dcf26
14acc59
4660f7d
47209b0
0c3545b
1a1a72e
87ad744
1b54eb3
943dce6
aa4e4bc
5b27126
0bb59f0
8f36a02
2495c84
7749fa8
23f1305
c16b33e
54e44ea
974a7b6
2d41e24
2b5b9c4
3cf0dd9
74125d4
dd20e77
4b24bf3
549a669
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
# Download this file using PowerShell v3 under Windows with the following comand: | ||
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore | ||
# or wget: | ||
# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.sln.docstates | ||
|
||
# Build results | ||
|
||
[Dd]ebug/ | ||
[Rr]elease/ | ||
x64/ | ||
build/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
|
||
# NuGet Packages | ||
*.nupkg | ||
# The packages folder can be ignored because of Package Restore | ||
**/packages/* | ||
# except build/, which is used as an MSBuild target. | ||
!**/packages/build/ | ||
# Uncomment if necessary however generally it will be regenerated when needed | ||
#!**/packages/repositories.config | ||
|
||
# MSTest test Results | ||
[Tt]est[Rr]esult*/ | ||
[Bb]uild[Ll]og.* | ||
|
||
*_i.c | ||
*_p.c | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.tmp_proj | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
*.pidb | ||
*.log | ||
*.scc | ||
|
||
# OS generated files # | ||
.DS_Store* | ||
Icon? | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
|
||
# Guidance Automation Toolkit | ||
*.gpState | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper*/ | ||
*.[Rr]e[Ss]harper | ||
|
||
# TeamCity is a build add-in | ||
_TeamCity* | ||
|
||
# DotCover is a Code Coverage Tool | ||
*.dotCover | ||
|
||
# NCrunch | ||
*.ncrunch* | ||
.*crunch*.local.xml | ||
|
||
# Installshield output folder | ||
[Ee]xpress/ | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish/ | ||
|
||
# Publish Web Output | ||
*.Publish.xml | ||
|
||
# Windows Azure Build Output | ||
csx | ||
*.build.csdef | ||
|
||
# Windows Store app package directory | ||
AppPackages/ | ||
|
||
# Others | ||
*.Cache | ||
ClientBin/ | ||
# [Ss]tyle[Cc]op.* | ||
~$* | ||
*~ | ||
*.dbmdl | ||
*.[Pp]ublish.xml | ||
*.pfx | ||
*.publishsettings | ||
modulesbin/ | ||
tempbin/ | ||
|
||
# EPiServer Site file (VPP) | ||
AppData/ | ||
|
||
# RIA/Silverlight projects | ||
Generated_Code/ | ||
|
||
# Backup & report files from converting an old project file to a newer | ||
# Visual Studio version. Backup files are not needed, because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
UpgradeLog*.htm | ||
|
||
# vim | ||
*.txt~ | ||
*.swp | ||
*.swo | ||
|
||
# svn | ||
.svn | ||
|
||
# Remainings from resolvings conflicts in Source Control | ||
*.orig | ||
|
||
# SQL Server files | ||
**/App_Data/*.mdf | ||
**/App_Data/*.ldf | ||
**/App_Data/*.sdf | ||
|
||
|
||
#LightSwitch generated files | ||
GeneratedArtifacts/ | ||
_Pvt_Extensions/ | ||
ModelManifest.xml | ||
|
||
# ========================= | ||
# Windows detritus | ||
# ========================= | ||
|
||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Mac desktop service store files | ||
.DS_Store | ||
|
||
# SASS Compiler cache | ||
.sass-cache | ||
|
||
# Visual Studio 2014 CTP | ||
**/*.sln.ide | ||
|
||
# Visual Studio temp something | ||
.vs/ | ||
|
||
# VS 2015+ | ||
*.vc.vc.opendb | ||
*.vc.db | ||
|
||
# Rider | ||
.idea/ | ||
|
||
**/node_modules/* | ||
|
||
# Added by Jskonst | ||
# .vscode/ | ||
Properties/ | ||
|
||
##### | ||
# End of core ignore list, below put you custom 'per project' settings (patterns or path) | ||
##### |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
<NoWarn>1573,1591,1701;1702;1705</NoWarn> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> | ||
<PackageReference Include="xunit" Version="2.4.0" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> | ||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\CourseApp\CourseApp.csproj" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<CodeAnalysisRuleSet>../_stylecop/stylecop.ruleset</CodeAnalysisRuleSet> | ||
<GenerateFullPaths>true</GenerateFullPaths> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<AdditionalFiles Include="../_stylecop/stylecop.json" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace CourseApp.Tests | ||
{ | ||
public class DemoTest | ||
{ | ||
[Fact] | ||
public void Test1() | ||
{ | ||
Xunit.Assert.True(true); | ||
} | ||
|
||
[Fact] | ||
public void TestMyFunctionZeros() | ||
{ | ||
var res = Program.MyFunction(0.0, 0.0); | ||
Xunit.Assert.Equal(double.NaN, res); | ||
} | ||
|
||
[Fact] | ||
public void TestTaskBNullMass() | ||
{ | ||
var mass = new double[0]; | ||
var res = Program.TaskB(1, mass); | ||
Xunit.Assert.Equal(mass, res); | ||
} | ||
|
||
[Fact] | ||
public void TestTaskB() | ||
{ | ||
var x = new double[] { 1.28, 1.36, 2.47, 3.68, 4.56 }; | ||
var res = Program.TaskB(1.6, x); | ||
var expy = new double[] { 2.54483385166692, 2.5615887682505, 11.2873629585646, 363.108837198182, 10971.2863691829 }; | ||
for (int i = 0; i < 5; i++) | ||
{ | ||
Xunit.Assert.Equal(expy[i], res[i], 3); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Нет на задачу A |
||
} | ||
} | ||
|
||
[Fact] | ||
public void TestTaskA() | ||
{ | ||
double a = 1.6; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. На задачу А нужно покрыть еще 2 случая xn > xk, и dx > xk-xn |
||
double xn = 1.2; | ||
double xk = 3.7; | ||
double dx = 0.5; | ||
var res = Program.TaskA(a, xn, xk, dx); | ||
var expy = new double[] { 2.58628588710697, 3.15454831838707, 6.49450906742811, 19.428489457705, 76.9595290357977 }; | ||
for (int i = 0; i < 5; i++) | ||
{ | ||
Xunit.Assert.Equal(expy[i], res[i], 3); | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace CourseApp.Tests | ||
{ | ||
public class PersonTest | ||
{ | ||
[Fact] | ||
public void TestEmptyConstructor() | ||
{ | ||
var item = new Person(); | ||
Assert.Equal(0, item.Age); | ||
Assert.Equal("Somename", item.Name); | ||
Assert.Equal("Somesurname", item.Surname); | ||
Assert.True(item.IsMale); | ||
} | ||
|
||
[Fact] | ||
public void TestView() | ||
{ | ||
var item = new Person(); | ||
var view = @"hello"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ - нужен только для многострочного текста, тут можно убрать 🔕 |
||
Assert.Equal(view, item.View()); | ||
} | ||
|
||
[Fact] | ||
public void TestSetAge() | ||
{ | ||
var item = new Person(); | ||
item.Age = 26; | ||
Assert.Equal(26, item.Age); | ||
} | ||
|
||
[Fact] | ||
public void TestIncorrectSetAge() | ||
{ | ||
var item = new Person(); | ||
item.Age = -5; | ||
Assert.Equal(0, item.Age); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Тут надо проверять на Exception |
||
} | ||
|
||
[Fact] | ||
public void TestCorrectIncorrectSetAge() | ||
{ | ||
var item = new Person(); | ||
item.Age = 27; | ||
item.Age = -1; | ||
Assert.Equal(27, item.Age); | ||
} | ||
|
||
[Fact] | ||
public void TestIncorrectSetString() | ||
{ | ||
var item = new Person(); | ||
item.Name = string.Empty; | ||
item.Surname = string.Empty; | ||
Assert.Equal("Somename", item.Name); | ||
Assert.Equal("Somesurname", item.Surname); | ||
} | ||
|
||
[Fact] | ||
public void TestCorrectSetString() | ||
{ | ||
var item = new Person(); | ||
item.Name = "im so tired"; | ||
item.Surname = "it is not a test it is a cry for help"; | ||
Assert.Equal("im so tired", item.Name); | ||
Assert.Equal("it is not a test it is a cry for help", item.Surname); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо еще пару тестов добавить именно к вычислению функции
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still valuable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужен еще тест на функцию, где параметры не равны 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это все еще важно, может я конечно слепой :(