refact(CSharp): rename from PrimeGenerator to GeneratePrimeNumbers (#507)

pull/516/head
Waqar Hassan Khan 2021-10-03 00:01:57 +06:00 committed by GitHub
parent 43e122cb9b
commit 27aa8dc3f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@ namespace Algorithms.NumberTheory
public class SieveOfEratosthenes
{
// returns all the prime numbers from 1 to max
public static List<int> PrimeGenerator(int max)
public static List<int> GeneratePrimeNumbers(int max)
{
List<bool> isPrime = Enumerable.Repeat(true, max + 1).ToList();
@ -39,7 +39,7 @@ namespace Algorithms.NumberTheory
public static void Main()
{
List<int> primeNumbers = PrimeGenerator(100);
List<int> primeNumbers = GeneratePrimeNumbers(100);
Console.WriteLine(string.Join(", ", primeNumbers));
}
}

View File

@ -9,7 +9,7 @@ namespace Algorithms.Tests.NumberTheory
[TestCase(100, "2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97")]
public void SieveOfEratosthenes_ShouldReturnExpected(int max, string expected)
{
List<int> primeNumbers = Algorithms.NumberTheory.SieveOfEratosthenes.PrimeGenerator(max);
List<int> primeNumbers = Algorithms.NumberTheory.SieveOfEratosthenes.GeneratePrimeNumbers(max);
Assert.AreEqual(expected, string.Join(", ", primeNumbers));
}
}