ST LAB1 Program - Merged
ST LAB1 Program - Merged
/* Design and develop a program in a language of your choice to solve the triangle problem
defined as follows : Accept three integers which are supposed to be the three sides of
triangle and determine if the three values represent an equilateral triangle, isosceles
triangle, scalene triangle, or they do not form a triangle at all. Assume that the upper limit
for the size of any side is 10. Derive test cases for your program based on boundary value
analysis, execute the test cases and discuss the results */
#include<stdio.h>
int main()
{
int a,b,c,c1,c2,c3;
char istriangle;
do
{
printf("\n enter 3 integers which are sides of triangle\n");
scanf("%d%d%d", &a, &b, &c);
printf("\n a=%d\t b=%d\t c=%d", a, b, c);
c1 = a>=1 && a<=10;
c2= b>=1 && b<=10;
c3= c>=1 && c<=10;
if (!c1)
printf("\n the value of a=%d is not the range of permitted value", a);
if (!c2)
printf("\n the value of b=%d is not the range of permitted value", b);
if (!c3)
printf("\n the value of c=%d is not the range of permitted value", c);
} while(!(c1 && c2 && c3));
Input Data
Case Actual
Description Expected Output Status Comments
Id Output
a b c
Should display the message Isosceles
1 Keep a and b at nominal value and vary c 5 5 1 triangle
Keep a and b at nominal value and vary c Should display the message Isosceles
2 5 5 2 triangle
Keep a and b at nominal value and vary c Should display the message Equilateral
3 5 5 5
triangle
Keep a and b at nominal value and vary c Should display the message Isosceles
4 5 5 9
triangle
Keep a and b at nominal value and vary c
5 5 5 10 Should display the message Not a triangle
Keep a and cat nominal value and vary b Should display the message Isosceles
6 5 1 5
triangle
Keep a and c at nominal value and vary b Should display the message Isosceles
7 5 2 5
triangle
Keep a and c at nominal value and vary b Should display the message Equilateral
8 5 5 5
triangle
Keep a and c at nominal value and vary b Should display the message Isosceles
9 5 9 5
triangle
Keep a and c at nominal value and vary b
10 5 10 5 Should display the message Not a triangle
Keep b and c at nominal value and vary a Should display the message Isosceles
12 2 5 5
triangle
Keep b and c at nominal value and vary a Should display the message Equilateral
13 5 5 5
triangle
Keep b and c at nominal value and vary a Should display the message Isosceles
14 9 5 5 triangle
Enter the out of boundary value for a and Should display the message as value of a and b
2 11 0 5
b and normal value for c not in the permitted range
3 Enter the negative value for a, b and c Should display the message as value of a, b and
-1 -4 -6
c not in the permitted range
4 Enter the values for a , b and c 5 1 10 Should display the message as Not a Triangle
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
CO1
/* Design, develop, code and run the program in any suitable language to implement the NextDate
function. Analyze it from the perspective of boundary value testing and equivalence class analysis.
Derive different test cases, execute these test cases and discuss the test results. */
#include<stdio.h>
int check(int day, int month)
{
if((month==4||month==6||month==9 ||month==11) && day==31)
return 1;
else
return 0;
}
int main()
{
int day, month, year, tomm_day, tomm_month, tomm_year;
char flag;
do
{
flag='y';
printf("\nenter the today's date in the form of dd mm yyyy\n");
scanf("%d%d%d", &day, &month, &year);
tomm_month=month;
tomm_year= year;
if(day<1 || day>31)
{
printf("value of day, not in the range 1...31\n");
flag='n';
}
if(month<1 || month>12)
{
printf("value of month, not in the range 1....12\n");
flag='n';
}
else if(check(day, month))
{
printf("value of day, not in the range day<=30");
if(year<1812 || year>2019)
{
printf("value of year, not in the range 1812.......2019\n");
flag='n';
}
if(month==2)
{
if(isleap(year) && day>29)
{
printf("invalid date input for leap year");
flag='n';
}
else if(!(isleap(year)) && day>28)
{
printf("invalid date input for not a leap year");
flag='n';
}
}
} while(flag=='n');
switch (month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:if(day<31)
tomm_day=day+1;
else
{
tomm_day=1;
tomm_month=month+1;
}
break;
case 4:
case 6:
case 9:
case 11: if(day<30)
tomm_day=day+1;
else
{
Dept. of ISE 2022 Page 22
Software Testing Lab Manual RNSIT
tomm_day=1;
tomm_month=month+1;
}
break;
else
tomm_year=year+1;
}
break;
case 2:
if(day<28)
tomm_day=day+1;
else if(isleap(year) && day==28)
tomm_day=day+1;
else if(day==28 || day==29)
{
tomm_day=1;
tomm_month=3;
}
break;
}
printf("next day is : %d %d %d", tomm_day, tomm_month, tomm_year);
return 0;
}
Test Case Name : Boundary Value Analysis test cases for NextDate program
Experiment Number :3
Test data : Enter the three integer value
Pre-condition : Month 1 to 12, Day 1 to 31 and Year 1812 to 2019
Brief Description : Min Min +1 Normal Max -1 Max
Month 1 2 6 11 12
1 Enter the min value month, day and year 1 1 1812 1 2 1812
Enter the min+1 value for year and min for
2 month and day 1 1 1813 1 2 1813
Enter the normal value for year and min
3 for month and day 1 1 1915 1 2 1915
Enter the max -1 value for year and min
4 for month and day 1 1 2018 1 2 2018
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
CO1 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
if(c2)
printf("value of stocks not in the range 1..80 ");
else
{
temp=tstocks+stocks;
else
tstocks=temp;
}
printf("total stocks=%d\n", tstocks);
if(c3)
printf("value of barrels not in the range 1..90 ");
else
{
temp=tbarrels+barrels;
if(temp>90)
printf("new total barrels =%d not in the range 1..90 ", temp);
else
tbarrels=temp;
}
printf("total barrels=%d", tbarrels);
printf("\n enter the number of locks and to exit the loop enter -1 for locks \n");
scanf("%d", &locks);
}
printf("\n total locks = %d\n total stocks =%d\n total barrels =%d\n", tlocks, tstocks, tbarrels);
sales = lprice*tlocks + sprice*tstocks + bprice*tbarrels;
printf("\n the total sales=%f\n", sales);
if(sales > 0)
{
if(sales > 1800.0)
{
comm=0.10*1000.0;
comm=comm+0.15*800;
comm=comm+0.20*(sales-1800.0);
}
else if(sales > 1000)
{
comm =0.10*1000;
comm =comm+0.15*(sales-1000.0);
}
else
comm=0.10*sales;
printf("the commission is=%f\n", comm);
}
else
printf("there is no sales\n");
return 0;
}
9 Enter the values sales exactly equal to 1000 10 10 10 1000 100 Border point
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
CO1
Enter one invalid input and two Should display value of b is not in the
SR2 5 -1 5 range of permitted values
valid value for a , b and c
Enter one invalid input and two Should display value of c is not in the
SR3 5 5 -1 range of permitted values
valid value for a , b and c
Enter two invalid input and one Should display value of a and b are not in
SR4 -1 -1 5
valid value for a , b and c the range of permitted values
SR5 Enter two invalid input and one Should display value of b and c are not in
5 -1 -1
valid value for a , b and c the range of permitted values
SR6 Enter two invalid input and one Should display value of a and c are not in
-1 5 -1
valid value for a , b and c the range of permitted values
Should display value of a, b and c are not
SR7 Enter all invalid inputs -1 -1 -1 in the range of permitted values
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
CO2