feat: Finish Iteration
All checks were successful
Tests / Unit Testing1 (push) Successful in 43s

This commit is contained in:
Louis Gallet 2023-11-02 18:23:52 +01:00
parent a00e84e111
commit de2eb52756
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY
9 changed files with 99 additions and 4 deletions

View File

@ -17,6 +17,4 @@ jobs:
- name: "🏗️ Build"
run: dotnet build
- name: "✅ Test"
run: dotnet test
- name: "Sophie bah caca"
run: echo "Louis est le meilleur"
run: dotnet test

View File

@ -4,6 +4,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iteration", "Iteration\Iter
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{A838FD78-1D97-4191-91BF-FF439C9FB918}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stream", "Stream\Stream.csproj", "{43060AB1-3A2B-4EEE-AC6E-A476EDDC71A2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -18,5 +20,9 @@ Global
{A838FD78-1D97-4191-91BF-FF439C9FB918}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A838FD78-1D97-4191-91BF-FF439C9FB918}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A838FD78-1D97-4191-91BF-FF439C9FB918}.Release|Any CPU.Build.0 = Release|Any CPU
{43060AB1-3A2B-4EEE-AC6E-A476EDDC71A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43060AB1-3A2B-4EEE-AC6E-A476EDDC71A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43060AB1-3A2B-4EEE-AC6E-A476EDDC71A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43060AB1-3A2B-4EEE-AC6E-A476EDDC71A2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -1,4 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=394010b2_002Df74a_002D42b6_002D8445_002D2a75606c26a3/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &amp;lt;Tests&amp;gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=6f052d53_002D9b1d_002D49af_002D8be5_002Da3b6ca9fbd46/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &amp;lt;Tests&amp;gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Project Location="/Users/louisgallet/Developer/EPITA/B2BEpita/Tests" Presentation="&amp;lt;Tests&amp;gt;" /&gt;
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>

35
Iteration/Recursion.cs Normal file
View File

@ -0,0 +1,35 @@
namespace Iteration;
public class Recursion
{
public static bool IsAlphanum(string s, int i)
{
if (i >= s.Length)
{
return true;
}
else
{
if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z') || (s[i] >= '0' && s[i] <= '9'))
{
return IsAlphanum(s, i + 1);
}
else
{
return false;
}
}
}
public static string ReverseStr(string source, int lenght)
{
if (lenght == 0)
{
return "";
}
else
{
return source[lenght - 1] + ReverseStr(source, lenght - 1);
}
}
}

3
Stream/Program.cs Normal file
View File

@ -0,0 +1,3 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

10
Stream/Stream.cs Normal file
View File

@ -0,0 +1,10 @@
namespace Stream;
using System.IO;
public class Stream
{
public static bool ExistFile(string path)
{
return File.Exists(path);
}
}

10
Stream/Stream.csproj Normal file
View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,27 @@
namespace Tests.Recursion;
public class RecursionTest
{
[Theory]
[InlineData("abcdef132", 0, true)]
[InlineData("!abcdef", 0, false)]
[InlineData("!abcdef", 1, true)]
[InlineData("abcdef!", 15, true)]
public void IsAlphanumTest(string s, int i, bool expected)
{
bool actual = Iteration.Recursion.IsAlphanum(s, i);
Assert.Equal(expected, actual);
}
[Theory]
[InlineData("42", 2, "24")]
[InlineData("123", 3, "321")]
[InlineData("ABcdeF",6, "FedcBA")]
public void ReverseStrTest(string source, int lenght, string expected)
{
string actual = Iteration.Recursion.ReverseStr(source, lenght);
Assert.Equal(expected, actual);
}
}

View File

@ -0,0 +1,6 @@
namespace Tests.Stream;
public class StreamTest
{
}