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

Experiment 1 Test Case

The document describes the results of 6 experiments that tested various functions by inputting different parameters and comparing the expected and actual outputs. Experiment 1 and 2 contain test cases for quadratic equations and triangle classification. Experiment 3-5 contain more comprehensive test cases for additional functions over a range of valid and invalid inputs. Experiment 6 contains test cases to validate date conversion from a given month, day, and year to the previous day.

Uploaded by

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

Experiment 1 Test Case

The document describes the results of 6 experiments that tested various functions by inputting different parameters and comparing the expected and actual outputs. Experiment 1 and 2 contain test cases for quadratic equations and triangle classification. Experiment 3-5 contain more comprehensive test cases for additional functions over a range of valid and invalid inputs. Experiment 6 contains test cases to validate date conversion from a given month, day, and year to the previous day.

Uploaded by

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

Experiment 1

Test case

Test
Case a b c Expected Output Actual Output Error
1 50 50 0 Real Roots Real Roots -
2 50 50 1 Real Roots Real Roots -
3 50 50 50 Imaginary Roots Imaginary Roots -
4 50 50 99 Imaginary Roots Imaginary Roots -
5 50 50 100 Imaginary Roots Imaginary Roots -
6 50 0 50 Imaginary Roots Imaginary Roots -
7 50 1 50 Imaginary Roots Imaginary Roots -
8 50 99 50 Imaginary Roots Imaginary Roots -
9 50 100 50 Equal Roots Equal Roots -
10 0 50 50 Not a Quadratic Eqn Not a Quadratic Eqn -
11 1 50 50 Real Roots Real Roots -
12 99 50 50 Imaginary Roots Imaginary Roots -
13 100 50 50 Imaginary Roots Imaginary Roots -

Output
Experiment 2

Test cases
Test Input Variable Expected Actual Output Error
Case Output
1 50 50 1 Isosceles Isosceles -
2 50 50 2 Isosceles Isosceles -
3 50 50 50 Equilateral Equilateral -
4 50 50 90 Isosceles Isosceles -
5 50 50 100 Not a triangle Not a triangle -
6 50 1 50 Isosceles Isosceles -
7 50 2 50 Isosceles Isosceles -
8 50 99 50 Isosceles Isosceles -
9 50 100 50 Not a triangle Not a triangle -
10 1 50 50 Isosceles Isosceles -
11 2 50 50 Isosceles Isosceles -
12 99 50 50 Isosceles Isosceles -
13 100 50 50 Not a triangle Not a triangle -

Output

Experiment 3

Output
Test cases

Test Input Variable Expected Output Actual Output Error


Case
a b c
1. -1 50 50 Invalid Invalid -
2. 0 50 50 Not a quadratic Not a quadratic -
equation equation
3. 1 50 50 Real Real -
4. 50 50 50 Imaginary Imaginary -
5. 99 50 50 Imaginary Imaginary -
6. 100 50 50 Imaginary Imaginary -
7. 101 50 50 Invalid Invalid -
8. 50 -1 50 Invalid Invalid -
9. 50 0 50 Imaginary Imaginary -
10. 50 1 50 Imaginary Imaginary -
11. 50 99 50 Imaginary Imaginary -
12. 50 100 50 Equal Equal -
13. 50 101 50 Invalid Invalid -
14. 50 50 -1 Invalid Invalid -
15. 50 50 0 Real Real -
16. 50 50 1 Real Real -
17. 50 50 99 Imaginary Imaginary -
18. 50 50 100 Imaginary Imaginary -
19. 50 50 101 Invalid Invalid -

Experiment 4

Output
Test case table

Test Input Variable Expected Actual Error


Case Output Output
X Y Z
1 50 50 0 Invalid i/p Invalid i/p -

2 50 50 1 Isosceles Isosceles -

3 50 50 2 Isosceles Isosceles -

4 50 50 50 Equilateral Equilateral -

5 50 50 99 Isosceles Isosceles -

6 50 50 100 Not a Not a -


triangle triangle
7 50 50 101 Invalid i/p Invalid i/p -

8 50 0 50 Invalid i/p Invalid i/p -

9 50 1 50 Isosceles Isosceles -

10 50 2 50 Isosceles Isosceles -

11 50 99 50 Isosceles Isosceles -

12 50 100 50 Not a Not a -


triangle triangle
13 50 101 50 Invalid i/p Invalid i/p -

14 0 50 50 Invalid i/p Invalid i/p -

15 1 50 50 Isosceles Isosceles -

16 21 50 50 Isosceles Isosceles -

17 99 50 50 Isosceles Isosceles -

18 100 50 50 Not a Not a -


triangle triangle
19 101 50 50 Invalid i/p Invalid i/p -

20 50 55 59 Scalene Scalene -
Experiment 5

Output
A) Test Cases for Triangle
Test Case Input (h) Input (b) Expected Actual Error
Output Output
1 0 100 Invalid Invalid -
input input
2 100 100 5000 5000 -
3 201 100 Invalid Invalid -
input input
4 100 201 Invalid Invalid -
input input
5 100 0 Invalid Invalid -
input input

Input domain:
I1 ={h:h<=0}
I2 ={h:h>=200}
I3 ={h:1<=h<=200}
I4 ={b:b<=0}
I5 ={b:b>200}
I6 ={b:1<=b<=200}

Output Domain:
O1 ={<h,b>:triangle if h>0, b>0}
O2 ={<h,b>:triangle if h<=0, b<=0}

B) Test Cases for Rectangle


Test Case Input (h) Input (b) Expected Actual Error
Output Output
1 0 100 Invalid Invalid -
input input
2 100 100 10000 5000 -
3 201 100 Invalid Invalid -
input input
4 100 201 Invalid Invalid -
input input
5 100 0 Invalid Invalid -
input input
Input domain:
I1 ={l:l<=0}
I2 ={l:l>=200}
I3 ={l:1<=l<=200}
I4 ={b:b<=0}
I5 ={b:b>200}
I6 ={b:1<=b<=200}

Output Domain:
O1 ={<l,b>:triangle is l>0, b>0}
O2 ={<l,b>:triangle is l<=0, b<=0}

C) Test Cases for Square


Test Case Input (b) Expected Actual Error
Output Output
1 0 Invalid Invalid -
input input
2 100 10000 10000 -
3 201 Invalid Invalid -
input input

Input domain:
I1 ={S:<=0}
I2 ={S:>200}
I3 ={S:1<S<=200}

Output Domain:
O1 ={<S>: square if S>0}
O2 ={<S>: not square if S<=0}

D) Test Cases for Circle


Test Case Input (b) Expected Actual Error
Output Output
1 0 Invalid Invalid -
input input
2 100 31400 31400 -
3 201 Invalid Invalid -
input input
Input domain:
I1 ={r:<=0}
I2 ={r:>200}
I3 ={r:1<r<=200}

Output Domain:
O1 ={<r>: circle if r>0}
O2 ={<S>: not circle if r<=0}

Experiment 6

Test cases

S.NO Month Day Year Expected output


1. June 1 1964 31 may 1964
2. June 1 1962 31 may 1962
3. June 15 1964 14 june 1964
4. June 15 1962 14 june 1962
5. June 29 1964 28 june 1964
6. June 29 1962 28 june 1962
7. June 30 1964 29 june 1964
8. June 30 1962 29 june 1962
9. June 31 1964 impossible
10. June 31 1962 impossible
11. May 1 1964 30 april 1964
12. May 1 1962 30 april 1962
13. May 15 1964 14 may 1964
14. May 15 1962 14 may 1962
15. May 29 1964 28 may 1964
16. May 29 1962 28 may 1962
17. May 30 1964 29 may 1964
18. May 30 1962 29 may 1962
19. May 31 1964 30 may 1964
20. May 31 1962 30 may 1962
21. March 1 1964 28 feb 1964
22. March 1 1962 28 feb 1962
23. March 15 1964 14 march 1964
24. March 15 1962 14 march 1962
25. March 29 1964 28 march 1964
26. March 29 1962 28 march 1962
27. March 30 1964 29 march 1964
28. March 30 1962 29 march 1962
29. March 31 1964 30 march 1964
30. March 31 1962 30 march 1962
31. August 1 1964 31 july 1964
32. August 1 1962 31 july 1962
33. August 15 1964 14 august 1964
34. August 15 1962 14 august 1962
35. August 29 1964 28 august 1964
36. August 29 1962 28 august 1962
37. August 30 1964 29 august 1964
38. August 30 1962 29 august
1964
39. August 31 1964 30 august 1962
40. August 31 1962 30 august
1964
41. January 1 1964 31 dec 1962
42. January 1 1962 31 dec 1962
43. January 15 1964 14 dec 1964
44. January 15 1962 14 dec 1962
45. January 29 1964 28 dec 1964
46. January 29 1962 28 dec 1962
47. January 30 1964 29 dec 1964
48. January 30 1962 29 march 1962
49. January 31 1964 30 march 1964
50. January 31 1962 30 july 1964
51. Feb 1 1964 31 july 1962
52. Feb 1 1962 31 august 1964
53. Feb 15 1964 14 august 1962
54. Feb 15 1962 14 august 1964
55. Feb 29 1964 28 august 1962
56. Feb 29 1962 impossible
57. Feb 30 1964 impossible
58. Feb 30 1962 impossible
59. Feb 31 1964 impossible
60. Feb 31 1962 impossible

Output
Experiment 7

Test Cases

Test Input Value Expected


Case a b Value
1 2 3 Positive Result
2 -1 3 Negative Result
3 -2 -4 Positive Result
4 0 1 0
5 0 0 Domain Error
6 -1 -0.6 1

Condition
C1 a=0, b=0 T
C2 a= -ve, b= +ve T
C3 a= +ve, b= -ve T
C4 a= -ve, b= -ve T
C5 a= +ve, b= +ve T
C6 a= 0, b= Integer T
C7 b= 0, a= Integer T
C8 a= +ve, b= -ve T
Action
A1 Domain Error X
A2 –ve Output X
A3 Output = 1 X
A4 +ve Output X X X X
A5 Output = 0 X
Output

Experiment 8
Test cases

C1: xyz are side N Y Y Y Y Y Y Y Y


of triangle

C2: x=y - Y Y Y Y N N N N

C3: x=z - Y Y N N Y Y N N

C4: y=z - Y N Y N Y N Y N

a1: Not a x
triangle

a2: Scalene x

a3: Isosceles x x x

a4: Equilateral x x

a5: Impossible X x

Output
Experiment 9

Output

Test case

Stub R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11

c1:x<y+z 0 1 1 1 1 1 1 1 1 1 1
c2:y<x+z X 0 1 1 1 1 1 1 1 1 1
c3:z<x+y X X 0 1 1 1 1 1 1 1 1
c4:x=y X X X 1 1 1 1 0 0 0 0
c5:x=z X X X 1 1 0 0 1 1 0 0
c6:y=z X X X 1 0 1 0 1 0 1 0

c1:Not a triangle 1 1 1
c2:Scalene 1
c3:Isosceles 1 1 1
c4:Equilateral 1
c5:Impossible 1 1 1
Cause Effect Graph of Triangle Problem

Experiment 10

DD Path Graph:

Flow Graph Nodes DD Path graph Remark


corresponding node

1 to 6 n1 Sequential Flow

7 n2 Intermediate node

8-15 n3 Sequential Flow

16 n4 Decision node

17 n5 gotonode

18-19 n6 Exit node

(DRAW FLOW GRAPH FROM PDF FOR THIS EXPERIMENT)


Output

Experiment 11

Output

(DRAW PATH GRAPH FOR THIS EXPERIMENT)

Experiment 12

Output

(Draw Diagram from the PDF for this expt)


Test Case
Flow Graph node DD Path Graph Remark
Corresponding Node
1 to 9 A Sequential Node
10 B Decision Node
11 C Decision Node
12,13 D Sequential Node
14 E Two edges are joint
15,16,17 F Sequential Node
18 G Decision Node and join of
edges
19 H Decision Node
20,21 I Sequential Node
22 J Decision Node
23,24 K Sequential Node
25,26,27 L Sequential Node
28 M Three edges one joint here
29 N Decision Node
30,31 O Sequential Node
32,33,34 P Sequential Node
35 Q Three edges one joint here
36,37 R Sequential Node with exit
node

Experiment 13

Graph Matrix
A B C D E F G H I J K L
A a i M
B b C
C h
D d e
E o
F f g
G j
H i h
I
J k
K L
L

(Draw Diagram from the PDF for this expt)


Output

Experiment 14

Output

(Draw Step 1 and Step 2 from PDF and for step 3 and 4 write the headings)
Experiment 15

(Draw the diagram from PDF)

Experiment 16

OUTPUT
(A) Statement Coverage
Test cases are:
T1: num=6, ch=’n’
This test case covers all the statements except <10>
Statement coverage= (Total statements exercised/ total executable statements) *100
= 20/2! *100
= 95.32 %
(B) Path Coverage
Paths: <A,B,C,D,E,F,C,D,E,G,H> , <A,B,C,D,E,G,H> , <I,J,K,LM,N> , <I,J,KM,N>
Test cases are: T1: num=7, ch=’y’ T3: num=0, ch=’y’
T2: num=7, ch=’n’ T4: num=0, ch=’n’
Path coverage= (total paths exercised/total executable paths) *100
= 4/4 *100
= 100%
(C) Condition Coverage
There is only one condition statement <9>
Now there are are two conditions A=’y’ and B=’Y’
Then test cases T1: A=True, B=True
T2: A=True, B=False
T3: A=False, B=True
T4: A=False, B=False
Thus, there are three test cases i.e.,
(1) T1: ch=’y’ (2) T2: ch=’Y’ (3) T3: ch=’n’
Condition coverage= (total decisions exercised/total no. of decisions) *100
=1/1 *100
= 100%
(D) Function Coverage
All values of num ensure the execution of the function factorial, hence there is only one test case.
T1: num=6, ch=’n’
Function coverage= (Total functions exercised/ total no. of functions) *100
= 1/1 *100
= 100%

(Draw GRAPHS from the PDF for this expt)

You might also like