Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
What will be the test case for this:

Give a Sentence, count the palindrome inside a sentence.Donot consider the palindrome inside a palindrome.Write test case.
Posted
Comments
Sandeep Mewara 16-Jan-13 9:59am    
It does not work like this here.

Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it's not that hard.
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.
vjanand8 23-Mar-16 3:43am    
using System;

public class Palindrome
{
public static bool IsPalindrome(string str)
{
string rev = "";
//string [] words

for(int i = input1.Length-1; i >= 0; i--)
{
rev += input1[i];
}

if(str.ToLower() == rev.ToLower())
{
return true;

}else{
return false;
}
}

public static void Main(string[] args)
{
Console.WriteLine(IsPalindrome("Noel sees Leon."));
}
}

1 solution

How about a lot of tests of the form:
C
TestAssert(CountPalindromes("abc") == 0, "Should not find any palindrome");

You had to define a TestAssert function that reports an error if the condition evaluates to false and issues the error message.
Pack the calls into one or several test functions, call them in a main function of a test program.
Cheers
Andi
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900