-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ben Brumm
committed
Jul 2, 2024
1 parent
9780d35
commit 4ac3b82
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
CREATE OR REPLACE PACKAGE test_dividetwonumbers AS | ||
--%suite(Divide Two Numbers) | ||
|
||
--%test(Returns a number from a simple calculation) | ||
PROCEDURE basic_calc; | ||
|
||
--%test(Another test for calculating a division) | ||
PROCEDURE another_calc; | ||
END; | ||
|
||
CREATE OR REPLACE PACKAGE BODY test_dividetwonumbers AS | ||
PROCEDURE basic_calc AS | ||
v_actual NUMBER; | ||
v_expected NUMBER; | ||
BEGIN | ||
v_expected := 3; | ||
DivideTwoNumbers(15, 5, v_actual); | ||
ut.expect(v_actual).to_equal(v_expected); | ||
END; | ||
|
||
PROCEDURE another_calc AS | ||
v_actual NUMBER; | ||
v_expected NUMBER; | ||
BEGIN | ||
v_expected := 70; | ||
DivideTwoNumbers(14, 2, v_actual); | ||
ut.expect(v_actual).to_equal(v_expected); | ||
END; | ||
END; | ||
|
||
|
||
|
||
BEGIN | ||
ut.run('test_dividetwonumbers'); | ||
END; | ||
|
||
/* | ||
Add test of divide by zero | ||
*/ | ||
|
||
|
||
CREATE OR REPLACE PACKAGE test_dividetwonumbers AS | ||
--%suite(Divide Two Numbers) | ||
|
||
--%test(Returns a number from a simple calculation) | ||
PROCEDURE basic_calc; | ||
|
||
--%test(Another test for calculating a division) | ||
PROCEDURE another_calc; | ||
|
||
--%test(Divide by zero) | ||
PROCEDURE divide_by_zero; | ||
END; | ||
|
||
CREATE OR REPLACE PACKAGE BODY test_dividetwonumbers AS | ||
PROCEDURE basic_calc AS | ||
v_actual NUMBER; | ||
v_expected NUMBER; | ||
BEGIN | ||
v_expected := 3; | ||
DivideTwoNumbers(15, 5, v_actual); | ||
ut.expect(v_actual).to_equal(v_expected); | ||
END; | ||
|
||
PROCEDURE another_calc AS | ||
v_actual NUMBER; | ||
v_expected NUMBER; | ||
BEGIN | ||
v_expected := 7; | ||
DivideTwoNumbers(14, 2, v_actual); | ||
ut.expect(v_actual).to_equal(v_expected); | ||
END; | ||
|
||
PROCEDURE divide_by_zero AS | ||
v_actual NUMBER; | ||
v_expected NUMBER; | ||
BEGIN | ||
v_expected := 0; | ||
DivideTwoNumbers(11, 0, v_actual); | ||
ut.expect(v_actual).to_equal(v_expected); | ||
END; | ||
END; | ||
|
||
|
||
BEGIN | ||
ut.run('test_dividetwonumbers'); | ||
END; |