0% found this document useful (0 votes)
53 views18 pages

Experiment No. 1: Aim:-Test The Program of Quadratic Equation Using Boundary Value Analysis

The document describes experiments testing various programs using different software testing techniques: Experiment 1 tests a quadratic equation program using boundary value analysis. It provides sample input values and the resulting output. Experiment 2 tests a program to find the previous date using robust testing. It provides sample invalid input values and the expected invalid output messages. Experiment 3 tests a program to calculate the sum of two numbers using worst case testing. It provides sample input values and the expected sum outputs. The remaining experiments test additional programs using techniques like decision table testing, path testing, and equivalence partitioning. The documents provide sample test cases and expected outputs to validate the program under testing.

Uploaded by

sdafg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views18 pages

Experiment No. 1: Aim:-Test The Program of Quadratic Equation Using Boundary Value Analysis

The document describes experiments testing various programs using different software testing techniques: Experiment 1 tests a quadratic equation program using boundary value analysis. It provides sample input values and the resulting output. Experiment 2 tests a program to find the previous date using robust testing. It provides sample invalid input values and the expected invalid output messages. Experiment 3 tests a program to calculate the sum of two numbers using worst case testing. It provides sample input values and the expected sum outputs. The remaining experiments test additional programs using techniques like decision table testing, path testing, and equivalence partitioning. The documents provide sample test cases and expected outputs to validate the program under testing.

Uploaded by

sdafg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Experiment No.

Aim:Test the program of Quadratic Equation using


boundary value analysis.
#include<conio.h>
#include<stdio.h>
void ROOTS(inta,intb,int c)
{
int d;
d=b*b-4*a*c;
if(a==0)
{
printf(" Not a quadratic equation ");
}
else if(a<0||b<0||c<0||a>100||b>100||c>100)
{
printf(" Not a valid input ");
}
else if(d==0)
{
printf(" Equal Roots ");
}
else if(d>0)
{
printf(" Real Roots ");
}
else
{
printf(" Imaginary Roots ");
}
}
void main()
{
intval[6];
intmin,max,nom,i,j,k;
clrscr();
printf(" \n Enter the Maximum Number >> ");
scanf("%d",&max);
printf(" \n Enter the Minimum Number >> ");
scanf("%d",&min);
val[0]=min;
val[1]=min+1;
val[2]=max-1;
val[3]=max;
nom=(min+max)/2;
printf(" \n << Boundary Value Analysis >> \n");
printf("\n a\t b\t c\t Output");

for(i=0;i<4;i++)
{
printf("\n %d\t %d\t %d\t
ROOTS(val[i],nom,nom);
}
for(i=0;i<4;i++)
{
printf("\n %d\t %d\t %d\t
ROOTS(nom,val[i],nom);
}
for(i=0;i<4;i++)
{
printf("\n %d\t %d\t %d\t
ROOTS(nom,nom,val[i]);
}
printf("\n %d\t %d\t %d\t
ROOTS(nom,nom,nom);

",val[i],nom,nom);

",nom,val[i],nom);

",nom,nom,val[i]);
",nom,nom,nom);

getch();
}

Output:Enter the Maximum Number >> 2


Enter the Minimum Number >> 1
<< Boundary Value Analysis >>
a

b
1
2
1
2
1
1
1
1
1
1
1
1
1

c
1
1
1
1
1
2
1
2
1
1
1
1
1

1
1
1
1
1
1
1
1
1
2
1
2
1

Output
Imaginary Roots
Imaginary Roots
Imaginary Roots
Imaginary Roots
Imaginary Roots
Equal Roots
Imaginary Roots
Equal Roots
Imaginary Roots
Imaginary Roots
Imaginary Roots
Imaginary Roots
Imaginary Roots

Aim:-

Experiment No. 2

Test the program of finding previous date


using Robust Testing.
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
voidisValidTriangle(inta,intb,intc,intmax,int min)
{
if((a>max||a<min)&&(b>12||b<1)&&(c>31||c<1))
{
printf(" Invalid inputs for 'year', 'month' and 'day'. ");
}
else if((a>max||a<min)&&(b>12||b<1))
{
printf(" Invalid inputs for 'year' and 'month'. ");
}

else if((a>max||a<min)&&(c>31||c<1))
{
printf(" Invalid inputs for 'year' and 'day'. ");
}
else if((b>max||b<min)&&(c>31||c<1))
{
printf(" Invalid inputs for 'month' and 'day'. ");
}
else if(a>max||a<min)
{
printf(" Invalid input for 'year'.");
}
else if(b>12||b<1)
{
printf(" Invalid input for 'month'.");
}
else if(c>31||c<1)
{
printf(" Invalid input for 'day'.");
}
}
void main()
{
intmax,min;
int a[7],b[7],c[7];
inti=0,mid;
printf("\n Enter the Minimum year >> ");
scanf("%d",&min);
printf("\n Enter the Maximum year >> ");
scanf("%d",&max);
mid=(max+min)/2;
for(i=0;i<7;i++)
{
a[i]=mid;
b[i]=6;
c[i]=15;
}
a[0]=a[3]=a[4]=a[6]=min-1;
b[1]=b[3]=b[5]=b[6]=0;
c[2]=c[4]=c[5]=c[6]=0;
printf("\n << STRONG ROBUST TESTING >> \n\n");
printf(" Day \t Month \t Year \t Output \n");
for(i=0;i<7;i++)
{
printf("\n %d \t %d \t %d \t",c[i],b[i],a[i]);
isValidTriangle(a[i],b[i],c[i],max,min);
}
getch();
}

Output:Enter the Minimum year >> 1900


Enter the Maximum year >> 2000
<< STRONG ROBUST TESTING >>
Day

Month

15
6
15
0
0
6
15
0
'month'.
0
6
0
0
0
0
and 'day'.

Year

Output

1899
1950
1950
1899

Invalid
Invalid
Invalid
Invalid

1899
1950
1899

Invalid inputs for 'year' and 'day'.


Invalid inputs for 'month' and 'day'.
Invalid inputs for 'year', 'month'

input for 'year'.


input for 'month'.
inputs for 'month' and 'day'.
inputs for 'year' and

Experiment No. 3

Aim:Test the program of sum of two numbers using


worst case testing.
#include<conio.h>
#include<stdio.h>
void main()
{
intmin,i=0;
intmax,j=0;
intval[5];
printf("\n Enter the Minimum value >> ");
scanf("%d",&min);
printf("\n Enter the Maximum value >> ");
scanf("%d",&max);
val[0]=min;
val[1]=min+1;
val[2]=(min+max)/2;
val[3]=max-1;
val[4]=max;
printf("\n << WORST CASE TESTING >> ");
printf("\n\n a \t b \t Output [Sum] \n");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf(" %d \t %d \t %d \n",val[i],val[j],(val[i]+val[j]));
}
}
}

Output:Enter the Minimum value >> 50


Enter the Maximum value >> 100
<< WORST CASE TESTING >>
a

b
50
50
50
50
50
51
51
51
51
51
75
75
75
75
75
99
99
99
99
99
100
100
100
100
100

Aim:-

50
51
75
99
100
50
51
75
99
100
50
51
75
99
100
50
51
75
99
100
50
51
75
99
100

Output [Sum]
100
101
125
149
150
101
102
126
150
151
125
126
150
174
175
149
150
174
198
199
150
151
175
199
200

Experiment No. 4

Test the program of triangle using weak robust


equivalence class testing.
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
voidisValidTriangle(inta,intb,intc,intmax,int min)
{
if(a<min||b<min||c<min||a>max||b>max||c>max)
{printf(" Invalid Input.");
}
else
{
if((a+b>c)&&(b+c>a)&&(c+a>b))
{if(a==b&&b==c)
{printf(" Equilateral Triangle.");
}
else if(a==b||b==c||c==a)
{printf(" Isosceles Triangle.");
}
else
{
printf(" Scalene Triangle.");
}
}
else
{
printf(" Triangle Not Possible.");
}
}
}
void main()
{
intmax,min;
int a[5],b[5],c[5];
inti=0;
clrscr();
printf("\n Enter the Minimum number >> ");
scanf("%d",&min);
printf("\n Enter the Maximum number >> ");
scanf("%d",&max);
randomize();
for(i=0;i<4;i++)
{
while(a[i]>max||a[i]<min)
a[i]=random(max);
}
for(i=0;i<4;i++)
{

while(b[i]>max||b[i]<min)
b[i]=random(max);
}
for(i=0;i<4;i++)
{
while(c[i]>max||c[i]<min)
c[i]=random(max);
}
while(1)
{
a[1]=random(3000);
if(a[1]<min||a[1]>max)
break;
}
while(1)
{b[2]=random(3000);
if(b[2]<min||b[2]>max)
break;
}
while(1)
{c[3]=random(3000);
if(c[3]<min||c[3]>max)
break;
}
printf("\n\n << Weak Robust Testing >>\n\n");
printf(" a \t b \t c \t Output \n");
for(i=0;i<4;i++)
{printf("\n %d \t %d \t %d \t ",a[i],b[i],c[i],max,min);
isValidTriangle(a[i],b[i],c[i],max,min);
printf("\n");
}
getch();
}

Output:Enter the Minimum number >> 50


Enter the Maximum number >> 100
<< Weak Robust Testing >>
a

Output

98

64

82

Scalene Triangle.

2157

93

64

Invalid Input.

75

779

67

Invalid Input.

70

55

1970

Invalid Input.

Experiment No. 5

Aim:Test the program of finding previous date using


Strong Robust Testing.
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
voidisValidTriangle(inta,intb,intc,intmax,int min)
{
if((a>max||a<min)&&(b>12||b<1)&&(c>31||c<1))
{
printf(" Invalid inputs for 'year', 'month' and 'day'. ");
}
else if((a>max||a<min)&&(b>12||b<1))
{
printf(" Invalid inputs for 'year' and 'month'. ");
}
else if((a>max||a<min)&&(c>31||c<1))

{
printf(" Invalid inputs for 'year' and 'day'. ");
}
else if((b>max||b<min)&&(c>31||c<1))
{
printf(" Invalid inputs for 'month' and 'day'. ");
}
else if(a>max||a<min)
{
printf(" Invalid input for 'year'.");
}
else if(b>12||b<1)
{
printf(" Invalid input for 'month'.");
}
else if(c>31||c<1)
{
printf(" Invalid input for 'day'.");
}
}
void main()
{
intmax,min;
int a[7],b[7],c[7];
inti=0,mid;
printf("\n Enter the Minimum year >> ");
scanf("%d",&min);
printf("\n Enter the Maximum year >> ");
scanf("%d",&max);
mid=(max+min)/2;
for(i=0;i<7;i++)
{
a[i]=mid;
b[i]=6;
c[i]=15;
}
a[0]=a[3]=a[4]=a[6]=min-1;
b[1]=b[3]=b[5]=b[6]=0;
c[2]=c[4]=c[5]=c[6]=0;
printf("\n << STRONG ROBUST TESTING >> \n\n");
printf(" Day \t Month \t Year \t Output \n");
for(i=0;i<7;i++)
{
printf("\n %d \t %d \t %d \t",c[i],b[i],a[i]);
isValidTriangle(a[i],b[i],c[i],max,min);
}
getch();
}

Output:Enter the Minimum year >> 1900


Enter the Maximum year >> 2000
<< STRONG ROBUST TESTING >>
Day

Month

15
6
15
0
0
6
15
0
'month'.
0
6
0
0
0
0
and 'day'.

Year

Output

1899
1950
1950
1899

Invalid
Invalid
Invalid
Invalid

1899
1950
1899

Invalid inputs for 'year' and 'day'.


Invalid inputs for 'month' and 'day'.
Invalid inputs for 'year', 'month'

input for 'year'.


input for 'month'.
inputs for 'month' and 'day'.
inputs for 'year' and

Experiment No. 6

Aim:Test the program of triangle using Decision Table


Testing.
#include<stdio.h>
#include<conio.h>
void main()
{
inti,j,k,l,m,n;
char a[2]={'T','F'};
char b[2]={'T','F'};
char c[2]={'T','F'};
char d[2]={'T','F'};
char e[2]={'T','F'};
char f[2]={'T','F'};
printf("\n Decision Table Testing [ Triangle ] ");
printf("\n\n Conditions >> ");
printf("\n\t 1. a<b+c");
printf("\n\t 2. b<a+c");
printf("\n\t 3. c<a+b");
printf("\n\t 4. a=b");
printf("\n\t 5. a=c");
printf("\n\t 6. b=c");
printf("\n\n a<b+c \t b<a+c \t c<a+b \t a=b \t a=c \t b=c \t
Output\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
for(k=0;k<2;k++)
{
for(l=0;l<2;l++)
{
for(m=0;m<2;m++)
{
for(n=0;n<2;n++)
{
printf("\n %c \t %c \t %c \t %c \t %c \t %c \t
",a[i],b[j],c[k],d[l],e[m],f[n]);

if(a[i]=='F'||b[j]=='F'||c[k]=='F')
printf(" Not A Triangle.");
else if(d[l]=='T'&&e[m]=='T'&&f[n]=='T')
printf(" Equilateral Triangle.");
else
if((d[l]=='T'&&e[m]=='F'&&f[n]=='F')||
(d[l]=='F'&&e[m]=='T'&&f[n]=='F')||
(d[l]=='F'&&e[m]=='F'&&f[n]=='T'))
printf(" Isosceles Triangle.");
else if((d[l]=='F'&&e[m]=='F'&&f[n]=='F'))
printf(" Scalene Triangle.");
else
printf(" Not Possible.");
}
}
}
}
}
}
}

Output:<< Decision Table Testing [ Triangle ] >>


Conditions
1.
2.
3.

>>
a<b+c
b<a+c
c<a+b

4. a=b
5. a=c
6. b=c
a<b+c
T
T
T
T
T
T
Triangle.
T
Triangle.
T
T
T
Triangle.
T
Triangle.
T
Triangle.
T
Triangle.
T
Triangle.
T

b<a+c

c<a+b

a=b

a=c

b=c

Output

TTTTT
TTTT
TTT
TTT
TT
TT

Equilateral Triangle.
F
Not Possible.
F
T
Not Possible.
F
F
Isosceles Triangle.
F
T
T
Not Possible.
F
T
F
Isosceles

TT

FF

Isosceles

TT
T
T

F
F

T
T

TT
T

Scalene Triangle.
Not A Triangle.
F
Not A

Not A

Not A

Not A

Not A

FF

Experiment No. 7

Not A Triangle.

Aim:Test the program of Matrix Multiplication using


DD Path Testing.
#include<conio.h>
#include<stdio.h>
void main()
{
int r1,r2,c1,c2;
inta[10][10],b[10][10],c[10][10];
inti,j,k;
printf("\n << For First Matrix >> \n");
printf("\n \t The No. of Rows >> ");
scanf("%d",&r1);
printf("\n \t The No. of Columns >> ");
scanf("%d",&c1);
printf("\n << For Second Matrix >> \n");
printf("\n \t The No. of Rows >> ");
scanf("%d",&r2);

printf("\n \t The No. of Columns >> ");


scanf("%d",&c2);
printf("\n Enter The First Matrix Data >> \n");
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
{
printf(" ");
scanf("%d",&a[i][j]);
}
}
printf("\n Enter The Second Matrix Data >> \n");
for(i=0;i<r2;i++)
{
for(j=0;j<c2;j++)
{
printf(" ");
scanf("%d",&b[i][j]);
}
}
if(c1==r2)
{
for(i=0;i<r1;i++)
{
for(j=0;j<c2;j++)
{
c[i][j]=0;
for(k=0;k<r2;k++)
{
c[i][j]+=a[i][k]*b[k][j];
}
}
}
printf("\n\n << FIRST MATRIX >> \n\n");
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
printf(" %d \t",a[i][j]);
printf("\n");
}
printf("\n\n << SECOND MATRIX >> \n\n");
for(i=0;i<r2;i++)
{
for(j=0;j<c2;j++)
printf(" %d \t",b[i][j]);
printf("\n");
}
printf("\n\n << MULTIPLIED MATRIX >> \n\n");
for(i=0;i<r1;i++)
{
for(j=0;j<c2;j++)

printf(" %d \t",c[i][j]);
printf("\n");
}
}
else
{
printf(" Matrix Multiplication Not Possible.");
}}

Output:<< For First Matrix >>


The No. of Rows >> 4
The No. of Columns >> 3
<< For Second Matrix >>
The No. of Rows >> 3
The No. of Columns >> 5
Enter The First Matrix Data >>
1
2
3
4
5
6
7
8
9
3
2
1
Enter The Second Matrix Data >>
9
8
7
6
1
2
3
4
5
6
7
8
9
6
3
<< FIRST MATRIX >>
1
4
7
3

2
5
8
2

3
6
9
1

<< SECOND MATRIX >>


9
2
7

8
3
8

7
4
9

6
5
6

1
6
3

34
85
136
34

22
52
82
18

<< MULTIPLIED MATRIX >>


34
88
142
38

38
95
152
38

42
102
162
38

You might also like