1 PACKAGE BODY JTF_DIAGUNITTEST_QAPACKAGE AS
2 /* $Header: jtfdiagadptuqa_b.pls 120.2 2005/08/13 01:25:27 minxu noship $ */
3 ------------------------------------------------------------
4 -- procedure to initialize test datastructures
5 -- executeds prior to test run (not currently being called)
6 ------------------------------------------------------------
7 PROCEDURE init IS
8 BEGIN
9 -- test writer could insert special setup code here
10 null;
11 END init;
12
13 ------------------------------------------------------------
14 -- procedure to cleanup any test datastructures that were setup in the init
15 -- procedure call executes after test run (not currently being called)
16 ------------------------------------------------------------
17 PROCEDURE cleanup IS
18 BEGIN
19 -- test writer could insert special cleanup code here
20 NULL;
21 END cleanup;
22
23 ------------------------------------------------------------
24 -- procedure to report test component name back to framework
25 ------------------------------------------------------------
26
27 PROCEDURE getComponentName(str OUT NOCOPY VARCHAR2) IS
28 BEGIN
29 str := 'MathComponent UnitTests';
30 END getComponentName;
31
32 ------------------------------------------------------------
33 -- procedure to report test description back to framework
34 ------------------------------------------------------------
35 PROCEDURE getTestDesc(str OUT NOCOPY VARCHAR2) IS
36 BEGIN
37 str := 'Unit Test Package to display MathComponent Unit tests';
38 END getTestDesc;
39
40 ------------------------------------------------------------
41 -- procedure to report test name back to framework
42 ------------------------------------------------------------
43 PROCEDURE getTestName(str OUT NOCOPY VARCHAR2) IS
44 BEGIN
45 str := 'Math Component';
46 END getTestName;
47
48
49 ---------------------------------------------------
50 -- Unit test to test the POWER() API
51 ----------------------------------------------------
52
53 PROCEDURE testPower IS
54 expected NUMBER := 1.281212;
55 result NUMBER;
56 message VARCHAR2(512);
57 BEGIN
58 message := 'The POWER() Execution has resulted in error';
59 result := round(power(1.1,2.6),6);
60 JTF_DIAGNOSTIC_ADAPTUTIL.assertEquals(message,expected,result);
61 END;
62
63 ---------------------------------------------------
64 -- Unit test to test the EXP() API
65 ----------------------------------------------------
66
67 PROCEDURE testExp IS
68 -- expected NUMBER := 14.879732;
69 expected NUMBER := 4.879732;
70 result NUMBER;
71 message VARCHAR2(512);
72 BEGIN
73 message := 'The EXP() Execution has resulted in error';
74 result := round(exp(2.7),6);
75 JTF_DIAGNOSTIC_ADAPTUTIL.assertEquals(message,expected,result);
76 END;
77 END JTF_DIAGUNITTEST_QAPACKAGE;
78