Added IsPandigital string function

This commit is contained in:
2021-10-11 12:58:08 -04:00
parent 9524144f28
commit cdb118ca32
4 changed files with 143 additions and 71 deletions

View File

@@ -79,5 +79,71 @@ namespace TestCSClasses{
BigInteger bigAnswer = mee.ArrayAlgorithms.GetProd(bigNumbers);
Assert.AreEqual(bigCorrectAnswer, bigAnswer, "GetProd BigInteger failed");
}
[TestMethod]
public void TestPrintList(){
//Test 1
List<int> nums = new List<int>();
string correctAnswer = "[]";
string answer = mee.ArrayAlgorithms.PrintList(nums);
Assert.AreEqual(correctAnswer, answer, "PrintList<int> 1 failed");
//Test 2
nums = new List<int>(){1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
correctAnswer = "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]";
answer = mee.ArrayAlgorithms.PrintList(nums);
Assert.AreEqual(correctAnswer, answer, "PrintList<int> 2 failed");
//Test 3
nums = new List<int>(){-3, -2, -1, 0, 1, 2, 3};
correctAnswer = "[-3, -2, -1, 0, 1, 2, 3]";
answer = mee.ArrayAlgorithms.PrintList(nums);
Assert.AreEqual(correctAnswer, answer, "PrintList<int> 3 failed");
//Test 4
List<string> strings = new List<string>(){"A", "B", "C"};
correctAnswer = "[A, B, C]";
answer = mee.ArrayAlgorithms.PrintList(strings);
Assert.AreEqual(correctAnswer, answer, "PrintList<string> 1 failed");
//Test 5
strings = new List<string>(){"abc", "def", "ghi"};
correctAnswer = "[abc, def, ghi]";
answer = mee.ArrayAlgorithms.PrintList(strings);
Assert.AreEqual(correctAnswer, answer, "PrintList<string> 2 failed");
}
[TestMethod]
public void TestPrintArray(){
//Test 1
int[] nums = new int[]{};
string correctAnswer = "[]";
string answer = mee.ArrayAlgorithms.PrintArray(nums);
Assert.AreEqual(correctAnswer, answer, "PrintArray<int> 1 failed");
//Test 2
nums = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
correctAnswer = "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]";
answer = mee.ArrayAlgorithms.PrintArray(nums);
Assert.AreEqual(correctAnswer, answer, "PrintArray<int> 2 failed");
//Test 3
nums = new int[]{-3, -2, -1, 0, 1, 2, 3};
correctAnswer = "[-3, -2, -1, 0, 1, 2, 3]";
answer = mee.ArrayAlgorithms.PrintArray(nums);
Assert.AreEqual(correctAnswer, answer, "PrintArray<int> 3 failed");
//Test 4
string[] strings = new string[]{"A", "B", "C"};
correctAnswer = "[A, B, C]";
answer = mee.ArrayAlgorithms.PrintArray(strings);
Assert.AreEqual(correctAnswer, answer, "PrintArray<string> 1 failed");
//Test 5
strings = new string[]{"abc", "def", "ghi"};
correctAnswer = "[abc, def, ghi]";
answer = mee.ArrayAlgorithms.PrintArray(strings);
Assert.AreEqual(correctAnswer, answer, "PrintArray<string> 2 failed");
}
[TestMethod]
public void TestIsPandigital(){
//Test 1
//Test 2
//Test 3
}
}
}