Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flovnes committed Apr 27, 2024
1 parent 6140c08 commit a751540
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/bin
/obj
/tests/bin
/tests/obj
/src/bin
/src/obj
.vscode
*.sln
50 changes: 50 additions & 0 deletions tests/tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using Xunit;
using struct_lab_student;

namespace student_tests {
public partial class Tests {
[Fact]
public static void Student_EvalAverages_ReturnDoubleList() {
try
{
Student a = new("Прізвище1 Ім'я1 По-батькові1 F 02.02.2000 4 4 - 1234");
Student b = new("Прізвище2 Ім'я2 По-батькові2 F 02.02.2000 4 - 2 1234");
Student c = new("Прізвище3 Ім'я3 По-батькові3 F 03.03.2000 3 - - 2413");
List<double> avgs = Program.EvalAverages([a,b,c]);
bool fail = false;
foreach (double avg in avgs) {
if (avg < 2.0) {
fail = true;
break;
}
}
Console.WriteLine(fail ? "Student_EvalAverages_ReturnDoubleList epic fail!!!" : "cool!");
}
catch (Exception e)
{
Console.WriteLine($"\n\n uhoh somethin dun gone wrong! \n {e} \n\n");
}
}
[Fact]
public static void Student_EvalAverages_ReturnDoubleList() {
try
{
Student a = new("Прізвище1 Ім'я1 По-батькові1 F 02.02.2000 4 4 - 1234");
Student b = new("Прізвище2 Ім'я2 По-батькові2 F 02.02.2000 4 - 2 1234");
Student c = new("Прізвище3 Ім'я3 По-батькові3 F 03.03.2000 3 - - 2413");
List<double> avgs = Program.EvalAverages([a,b,c]);
bool fail = false;
foreach (double avg in avgs) {
if (avg < 2.0) {
fail = true;
break;
}
}
Console.WriteLine(fail ? "Student_EvalAverages_ReturnDoubleList epic fail!!!" : "cool!");
}
catch (Exception e)
{
Console.WriteLine($"\n\n uhoh somethin dun gone wrong! \n {e} \n\n");

}
}
18 changes: 18 additions & 0 deletions tests/tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8" />
<Reference Include="../src/bin/Debug/net8.0/lab4.dll" />
</ItemGroup>


</Project>

0 comments on commit a751540

Please sign in to comment.