GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Testing  >  Test Cases
Go To First  |  Previous Question  |  Next Question 
 Test Cases  |  Question 224 of 249    Print  
how to write test cases for this function
Hi, Guys,
I met a interview questions today, the question is to test this bool function
bool match (string s, string p);
string p is a pattern string, that means include character such as '?' or '*'
e.g. if s = 'panic' and p='pani?', it will return true,
if s ='panic' and p ='p*', it will return true,
if s = 'panic' and p= '??' it will return false.

I don't know how to write down test cases and how to classify the test cases such as valid or invalid, boundary test , could anyone help me out?

Thanks in advance.



  
Total Answers and Comments: 2 Last Update: February 27, 2008     Asked by: irisli 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
January 31, 2008 01:44:57   #1  
deep_pinu Member Since: January 2008   Contribution: 9    

RE: how to write test cases for this function
Hi irisli

I cudnt understand your question, but still i wud suggest is
you should write test case having string- s as the super set of p-pattern. means p must have each char assigend to s.

can u pl. test , what kind of testing it is....white/black. so that we can find a solution to it.

 
Is this answer useful? Yes | No
February 27, 2008 02:26:01   #2  
vini_26 Member Since: February 2008   Contribution: 1    

RE: how to write test cases for this function
Hi, these are the following test cases which you can write for the asked function..
Let me tell
you first what I understood from the question because according to that I have written the cases.
According to what I
saw, string s and string p are compared and resulted true only if both characters match. (even one character from s can match p).
The "?" and "*" is just like replacement for any one character.
s=panic , p = pani? ------ Valid
s=panic , p = pani* ------ Valid
s=panic , p = p? ------ Valid
s=panic , p = p* ------ Valid
s=panic , p = p*nic ------ Valid
s=panic , p = p*ni? ------ InValid
s=panic , p = ?pnic ------ InValid
s=panic , p = ?? ------ InValid
s=panic , p = *? ------ InValid
s=panic , p = ** ------ InValid
s=panic , p = pan?? ------ InValid
These are few test cases which
I think can be written..
Correct me if am wrong..

 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : A test case is a document containing series of action,events,input,expected result and actual result. The optional fields are TestCase ID,Test Case Description/Procedure, Expected Result, Author, Check Box to determine whether that step can ...

For a triangle(sum of two sides is greater than or equal to the third side),what is the minimal number of test cases required.

Latest Answer : actually tracibility matrix is not only the answer becoz trecibility matrix is made by the test lead with some testcase IDS using FRS documents and with these he will check the test cases which are made by the testing team tht ...

Effictive test case contain Test case describtion,test i/p data,exp o/p and actual o/p. 
Latest Answer : In general we write Prerequsite and Setup condition first then1. Testcsae ID2. Testcase name3. Objective4. Steps to be taken5. Expected result6. Actual result7. Pass/fail ...
Read Answers (9) | Asked by : srinivasan.G

Latest Answer : The more negative u  think the more brilliant test engineer ur.so before writing test cases think in all negative angles and start working on it.Test engineers' work is to prove the development team wrong. ...
Read Answers (29) | Asked by : karunakar

1.How prepare good test case2.How prepare test case for winrunner and load runner3.how prepare client side test cases(ex:Screens)Please send me to example test cases for above 3Thanks and Regards.Nagaraju
Read Answers (4) | Asked by : Nagaraju

Latest Answer : Not all functionalities r covered.. ...
Read Answers (9) | Asked by : rupesh

Latest Answer : Test case for cut/Paste in XL=>Verify that the Excel is install in your computer or not.=>Verify that the Excel is open and work carrectly=>Verify that the text is cut and save in clipboard after cutting a text.=>verify that the Text(which ...
Read Answers (4) | Asked by : manish Gaikwad

Latest Answer : Test Cases for Mobile Phone:1)Chek whether Battery is inserted into mobile properly2)Chek Switch on/Switchoff  of the Mobile3)Insert the sim into the phone n chek 4)Add one user with name and phone number in Address book5)Chek the Incoming call ...

Latest Answer : Integration Test Cases are written based on logical design to ensure complete coverage of all logical design elements. ...
Read Answers (5) | Asked by : Arul


 Sponsored Links

 
Related Articles

C++ Pure Virtual Function and Base Class

C Pure Virtual Function and Virtual Base Class In this C tutorial you will learn about pure virtual function declaration of pure virtual function and virtual base class virtual base class and how to implement a virtual base class explained with examples mosgoogle center What is Pure Virtual Function
 

ERP Success cases

ERP Success cases You have probably heard a lot about ERP systems especially about their implementation and its advantages and disadvantages Here you will find that there are no unachievable targets and that every effort brings benefits These are the stories of people who found success through ERP i
 

C++ Function Passing Types

C Function Passing Types In this C tutorial you will learn about function passing types two types of arguments passing in functions passed by value  and  passed by reference are discussed here mosgoogle center The arguments passed to a function can be performed in two ways Passed
 

What is DECODE function used for?

DECODE is used to decode a CHAR or VARCHAR2 or NUMBER into any of several different character strings or numbers based on value. That is DECODE does a value-by-value substitution. For every value that is given in the DECODE function it makes an if then check and matches the value. The general format
 

printf() Function Return Value

What is the return value from printf() function? printf function always returns the number of characters printed. Let us understand this with an example: main() { int a=10; printf("%d",printf("%d %d %d", a,a,a)); } In this above program the inner printf i
 

How is the main() function declared?

The declaration of main can be done as int main() One more declaration that can be taken by main is command line arguments form int main(int argc, char *argv[]) or this can also be written as int main(argc, argv) int argc; char *argv[]; NOTE: It is not possible for one to declare the main
 

How does the function call within function get evaluated?

Whenever we have more than one function which is called for a finite number of times then such a function gets evaluated from inside out. Let us understand this concept with an example. For instance consider a function sample called within it 4 times as given in program below: main() { int a=50;
 

What happens when a variable is not initialized in main function?

When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below main() { int x; printf(“%d”,x); z= sample() } sample() { printf(“Testing program”); } Output is   &n
 

What is the default return value of a function?

The default return value from a function is int. In other words, unless explicitly specified the default return value by compiler would be integer value from function.   When a programmer wants other than integer values to be returned from function then it is essential that the pro
 

What happens when a variable is not declared in function definition?

Generally in C program the function definition and calling takes the form as given below: main() { int x,y,z; z=sample(x,y); printf(“%d”,z); } sample(x1,y1) int x1,y1; { int z1; z1= x1 - y1; return(z1); } Here what happens is the values x, y gets passed to x1,y1
 

Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape