diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index a15ca23..eb2706c 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -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" \ No newline at end of file + run: dotnet test \ No newline at end of file diff --git a/B2BEpita.sln b/B2BEpita.sln index 3a313a8..a87d67e 100644 --- a/B2BEpita.sln +++ b/B2BEpita.sln @@ -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 diff --git a/B2BEpita.sln.DotSettings.user b/B2BEpita.sln.DotSettings.user index 13bc7bc..fa6cf13 100644 --- a/B2BEpita.sln.DotSettings.user +++ b/B2BEpita.sln.DotSettings.user @@ -1,4 +1,4 @@  - <SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &lt;Tests&gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &lt;Tests&gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> <Project Location="/Users/louisgallet/Developer/EPITA/B2BEpita/Tests" Presentation="&lt;Tests&gt;" /> </SessionState> \ No newline at end of file diff --git a/Iteration/Recursion.cs b/Iteration/Recursion.cs new file mode 100644 index 0000000..31ebab1 --- /dev/null +++ b/Iteration/Recursion.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/Stream/Program.cs b/Stream/Program.cs new file mode 100644 index 0000000..e5dff12 --- /dev/null +++ b/Stream/Program.cs @@ -0,0 +1,3 @@ +// See https://aka.ms/new-console-template for more information + +Console.WriteLine("Hello, World!"); \ No newline at end of file diff --git a/Stream/Stream.cs b/Stream/Stream.cs new file mode 100644 index 0000000..603bc08 --- /dev/null +++ b/Stream/Stream.cs @@ -0,0 +1,10 @@ +namespace Stream; +using System.IO; + +public class Stream +{ + public static bool ExistFile(string path) + { + return File.Exists(path); + } +} \ No newline at end of file diff --git a/Stream/Stream.csproj b/Stream/Stream.csproj new file mode 100644 index 0000000..2b14c81 --- /dev/null +++ b/Stream/Stream.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/Tests/Interatif/RecursionTest.cs b/Tests/Interatif/RecursionTest.cs new file mode 100644 index 0000000..72f617d --- /dev/null +++ b/Tests/Interatif/RecursionTest.cs @@ -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); + } +} \ No newline at end of file diff --git a/Tests/Stream/StreamTest.cs b/Tests/Stream/StreamTest.cs new file mode 100644 index 0000000..0139eea --- /dev/null +++ b/Tests/Stream/StreamTest.cs @@ -0,0 +1,6 @@ +namespace Tests.Stream; + +public class StreamTest +{ + +} \ No newline at end of file