Question
One of your friends has written a program to search a string in a string and requested you to test the below function using equivalent class portioning :
function strpos_generic( $haystack, $needle, $nth, $insensitive)
Following are terminology definitions:
- $haystack= the string in which you need to search value
- $needle= the character that needs to be searched, the $needle should be a single character
- $nth= occurrence you want to find, the value can be number between 1,2,3
- $insensitive= 1- case insensitive, 0 or any other value is case sensitive
- Passing as Null as parameter in haystack or needle is not a valid scenario and will return boolean false
- The function will return mixed integer either the position of the $nth occurrence of $needle in $haystack, or Boolean false if it can't be found.
$haystack
|
$needle
|
$nth
|
$insensitive
|
b) And drive test case for weak robust variant in following format and use the variable efficiently and cover all the paths:
Sl.no
|
$haystack
|
$needle
|
$nth
|
$insensitive
|
Expected results
|
NOTE : The above question is for your exercise,kindly try solving it using below reference questions
Question
ABC Transportation Company has implemented an online ticket booking system for their buses, and they have created a simple screen to search the bus and following are some of the business rules they have incorporated in the screen.
From and To location should be minimum 3 characters and maximum of 25 characters
• Date of travel cannot be lesser than today’s date
• Time : Morning, Afternoon, Night
• No of Passengers can be 1 to 6
• Service class can be: Premium, Deluxe, Express
a) Identify the positive and negative domain.
b) Write test case for weak robust variant.