public void StringReverseMethod() { Assert.AreEqual("", StringReverse.string_reverse("")); Assert.AreEqual("a", StringReverse.string_reverse("a")); Assert.AreEqual("AGLA", StringReverse.string_reverse("ALGA")); Assert.AreEqual("keimtiroglA", StringReverse.string_reverse("Algoritmiek")); }
public void StringReverseNegativeTests(string actual, string expected) { StringReverse sv = new StringReverse(); string result = sv.Reverse(actual); Assert.IsFalse(result.EqualsIgnoreCase(expected)); }
public void ReverseTest() { var s = "I am a peacefull soul"; var r = new StringReverse().Reverse(s); Assert.AreEqual("soul peacefull a am I", r); }
private static void ReverseString() { StringReverse sr = new StringReverse(); Console.WriteLine(sr.Reverse("Hi my name is Ovijeet")); Console.ReadKey(); }
public void StringReversePositiveTests(string actual, string expected) { StringReverse sv = new StringReverse(); string result = sv.Reverse(actual); Console.WriteLine("{0} ---> {1}", actual, result); Assert.IsTrue(result.EqualsIgnoreCase(expected)); }
public static void StringReverseTest() //klasa "testująca" - odpala metody (lokalna funkcja Main, prawdziwa funkcja Main // jest jedna dla całego projektu) { Console.WriteLine("---StringReverseTest---"); StringReverse.Reverse("Hello"); StringReverse.StringToArrayReverse("World!"); }
public void StringReverse_Decryption_UpperCase() { IEncryption stringReverse = new StringReverse(); string expected = "TEST"; string actual = stringReverse.Decrypt("TSET"); Assert.AreEqual(expected, actual); }
public void StringReverse_Decryption_LowerCase() { IEncryption stringReverse = new StringReverse(); string expected = "test"; string actual = stringReverse.Decrypt("tset"); Assert.AreEqual(expected, actual); }
public static void Launch() { StringReverse.StringReverseTest(); //wywołuję metodę statyczną testującą klasę .cs LeapYear.LeapYearTest(); SumOfMultiples.SumOfMultiplesTest(); Raindrops.RaindropsTest(); NucleotideCount.NucleotideCountTest(); Accumulate.AccumulateTest(); }
public void TestStringReverse() { StringReverse oStringReverse = new StringReverse(); string name = "Chang"; string reverseName; reverseName = oStringReverse.Process(name); Assert.IsTrue(reverseName.ToLower() == "gnahc"); }
public void IsPalindrome() { Assert.AreEqual(true, StringReverse.is_palindrome("")); Assert.AreEqual(true, StringReverse.is_palindrome("a")); Assert.AreEqual(true, StringReverse.is_palindrome("abba")); Assert.AreEqual(false, StringReverse.is_palindrome("ALGA")); Assert.AreEqual(false, StringReverse.is_palindrome("Algoritmiek")); Assert.AreEqual(true, StringReverse.is_palindrome("parterretrap")); Assert.AreEqual(true, StringReverse.is_palindrome("gohangasalamiimalasagnahog")); }
static void Main(string[] args) { /* Console.WriteLine("Question 1"); * int[] l1 = new int[] { 5, 6, 6, 9, 9, 12 }; * int target = 9; * int[] r = TargetRange.TargetRangeSoln(l1, target); * // Write your code to print range r here * Console.WriteLine("[" + r[0] + "," + r[1] + "]");*/ Console.WriteLine("Question 2"); string s = "University of South Florida"; string rs = StringReverse.StringReverseSoln(s); Console.WriteLine(rs); /* Console.WriteLine("Question 3"); * int[] l2 = new int[] { 2, 2, 3, 5, 6 }; * int sum = MinimumSum.MinimumSumSoln(l2); * Console.WriteLine(sum); * * Console.WriteLine("Question 4"); * string s2 = "DelleeE"; * string sortedString = FreqSort.FreqSortSoln(s2); * Console.WriteLine(sortedString); * * Console.WriteLine("Question 5-Part 1"); * int[] nums1 = { 1, 2, 2, 1 }; * int[] nums2 = { 2, 2 }; * int[] intersect1 = Intersect.Intersect1(nums1, nums2); * Console.WriteLine("Part 1- Intersection of two arrays is: "); * Intersect.DisplayArray(intersect1); Console.WriteLine("\n"); * Console.WriteLine("Question 5-Part 2"); * int[] intersect2 = Intersect.Intersect2(nums1, nums2); * Console.WriteLine("Part 2- Intersection of two arrays is: "); * Intersect.DisplayArray(intersect2); * Console.WriteLine("\n"); * * Console.WriteLine("Question 6"); * char[] arr = new char[] { 'a', 'g', 'h', 'a' }; * int k = 3; Console.WriteLine(ContainsDuplicate.ContainsDuplicateSoln(arr, k)); * * Console.WriteLine("Question 7"); * int rodLength = 15; * int priceProduct = GoldRod.GoldRodSoln(rodLength); * Console.WriteLine(priceProduct); * * Console.WriteLine("Question 8"); * string[] userDict = new string[] { "rocky", "usf", "hello", "apple" }; * string keyword = "hhllo"; * Console.WriteLine(DictSearch.DictSearchSoln(userDict, keyword)); * * Console.WriteLine("Question 9"); * SolvePuzzle.SolvePuzzleSoln(); */ }
public void Test_FirstReverse() { StringReverse reverser = new StringReverse(); string str = "Hello World and Coders"; Console.WriteLine("First Reverse:"); Console.WriteLine("Input: {0}", str); Console.WriteLine("Output: {0}", reverser.FirstReverse(str)); Console.WriteLine(); }
public void TestNonEmptyStringIsReversedCorrectly() { var input = new char[] { 'h', 'e', 'l', 'l', 'o' }; StringReverse.ReverseInPlace(input); var expected = new char[] { 'o', 'l', 'l', 'e', 'h' }; for (int i = 0; i < expected.Length; i++) { Assert.AreEqual(input[i], expected[i]); } }
private static void StringReversTest() { string input = Console.ReadLine(); byte[] arr = System.Text.Encoding.UTF8.GetBytes(input); string inchar = Console.ReadLine(); int shift = Convert.ToInt32(inchar); StringReverse stringShift = new StringReverse(); stringShift.LeftShift(ref arr, arr.Length, shift); Console.WriteLine("output: " + Encoding.UTF8.GetString(arr)); }
private static void Run() { StringReverse.Init(); Console.WriteLine(""); PigLatin.Init(); Console.WriteLine(""); VowelCount.Init(); Console.WriteLine(""); Palindrome.CheckIfPalindrome(); Console.WriteLine(""); WordsInString.Init(); Console.WriteLine(""); KeyGeneration.Generate(); }
public void TestInit() { _stringReverse = new StringReverse(); }
public void Test6() { var result = StringReverse.ReverseStringV2(helloWorld); Xunit.Assert.Equal(result, "dlrow olleh"); }
static void TestReveseString(string input) { var reversed = StringReverse.ReverseUsingStack(input); Console.WriteLine($"input: {input}, reversed: {reversed}"); }
static void Main(string[] args) { Console.WriteLine("Question 1"); int[] l1 = new int[] { 5, 6, 6, 9, 9, 12 }; int target = 9; int[] r = TargetRange.TargetRangeSoln(l1, target); // Write your code to print range r here Console.WriteLine("[" + r[0] + "," + r[1] + "]"); Console.WriteLine("Question 2"); String s = "University of South Florida"; String rs = StringReverse.StringReverseSoln(s); Console.WriteLine(rs); Console.WriteLine("Question 3"); int[] l2 = new int[] { 2, 2, 2, 4, 5, 7 }; int sum = MinimumSum.MinimumSumSoln(l2); Console.WriteLine("The Sum is: " + sum); Console.WriteLine("Question 4"); string s2 = "Dell"; string sortedString = FreqSort.FreqSortSoln(s2); Console.WriteLine(sortedString); Console.WriteLine("Question 5-Part 1"); int[] nums1 = { 1, 1, 2, 2, 2 }; int[] nums2 = { 2, 2 }; try { int[] intersect1 = Intersect.Intersect1(nums1, nums2); Console.WriteLine("Part 1- Intersection of two arrays is: "); Intersect.DisplayArray(intersect1); Console.WriteLine("\n"); Console.WriteLine("Question 5-Part 2"); int[] intersect2 = Intersect.Intersect2(nums1, nums2); Console.WriteLine("Part 2- Intersection of two arrays is: "); Intersect.DisplayArray(intersect2); Console.WriteLine("\n"); } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine("Question 6"); char[] arr = new char[] { 'a', 'g', 'h', 'a' }; int k = 3; Console.WriteLine(ContainsDuplicate.ContainsDuplicateSoln(arr, k)); Console.WriteLine("Question 7"); int rodLength = 15; int priceProduct = GoldRod.GoldRodSoln(rodLength); Console.WriteLine(priceProduct); Console.WriteLine("Question 8"); string[] userDict = new string[] { "rocky", "usf", "hello", "apple" }; string keyword = "hhllo"; try { if (userDict.Length > 0) { Console.WriteLine(DictSearch.DictSearchSoln(userDict, keyword)); } else { Console.WriteLine("Enter an array with at least one element."); } } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine("Question 9"); Console.WriteLine(" "); try { SolvePuzzle.SolvePuzzleSoln(); }catch (Exception e) { Debug.WriteLine(e.StackTrace); Console.WriteLine("Error computing the solution."); } }
public static string Process(string input1, string input2, string input3) { string output = string.Empty; switch (input3) { case "add": output = Addition.Add(input1, input2).ToString(); break; case "subtraction": output = Subtraction.Sub(input1, input2).ToString(); break; case "multiplication": output = Multiplication.Mul(input1, input2).ToString(); break; case "division": output = Division.Div(input1, input2).ToString(); break; case "divby3notby6": output = Divisionbythreenotbysix.Run(input1).ToString(); break; case "armstrongornot": output = Armstrongnumber.Check(input1).ToString(); break; case "factorial": output = Factorial.Calculate(input1).ToString(); break; case "palindrome": output = PalindromeNumber.Find(input1).ToString(); break; case "reverse": output = ReverseNumber.Reverse(input1).ToString(); break; case "sumofdigits": output = Sumofdigits.Find(input1).ToString(); break; case "decimaltobinary": output = DecimaltoBinary.Converts(input1).ToString(); break; case "numberincharacter": output = NumbersInCharacters.Print(input1).ToString(); break; case "strreverse": output = StringReverse.Reverse(input1).ToString(); break; case "duplicate": output = DuplicateElement.Find(input1).ToString(); break; case "unique": output = UniqueElement.Return(input1).ToString(); break; case "strpalindrome": output = StringPalindrome.Find(input1).ToString(); break; case "length": output = StringLength.Calculate(input1).ToString(); break; case "vowels": output = NumofVowels.Print(input1).ToString(); break; case "search": output = CharacterSearching.Search(input1, input2).ToString(); break; case "count": output = WordCount.Count(input1).ToString(); break; case "date": output = DateandTime.Calculate(input1).ToString(); break; } return(output); }