Click here to Skip to main content
12,511,920 members (46,810 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C
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 16-Jan-13 2:16am
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

How about a lot of tests of the form:
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
  Permalink  
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160929.1 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100