Software Testing
Software Testing
AIM : To check the roots of quadratic equation using BOUNDARY VALUE analysis.
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<process.h>
void fun(int a, int b,int c)
{ int d=pow(b,2)-(4*a*c);
if(d>0||d==0)
cout<<"valid case"<<endl;
else
cout<<"invalid case"<<endl;}
void boundary(int min,int max)
{int nom=(min+max)/2;
int next_min=min+1;
int next_max=max-1;
cout<<"result of boundary value analysis are:-"<<endl;
cout<<"a=1,b=50,c=50\t";
fun(min,nom,nom);
cout<<"a=50,b=50,c=1\t";
fun(nom,nom,min);
cout<<"a=50,b=1,c=50\t";
fun(nom,min,nom);
cout<<"a=2,b=50,c=50\t";
fun(next_min,nom,nom);
cout<<"a=50,b=50,c=2\t";
fun(nom,nom,next_min);
cout<<"a=50,b=2,c=50\t";
fun(nom,next_min,nom);
cout<<"a=99,b=50,c=50\t";
fun(next_max,nom,nom);
cout<<"a=50,b=50,c=99\t";
fun(nom,nom,next_max);
cout<<"a=50,b=99,c=50\t";
fun(nom,next_max,nom);
cout<<"a=100,b=50,c=50\t";
fun(max,nom,nom);
cout<<"a=50,b=50,c=100\t";
fun(nom,nom,max);
cout<<"a=50,b=100,c=50\t";
fun(nom,max,nom);
cout<<"a=50,b=50,c=50\t";
fun(nom,nom,nom);
}
void main()
{
clrscr();
boundary(1,100);
getch();
}
OUTPUT
a=0;b=50;c=50 valid case
real roots
real roots
equal roots
real roots
real roots