Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions source/core/ut_utils.pks
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,37 @@ create or replace package ut_utils authid definer is

*/

/* Constants: Test Results
tr_success - test passed
tr_failure - one or more asserts failed
tr_error - exception was raised
*/
tr_ignore constant number(1) := 0; -- test/suite was ignored
tr_success constant number(1) := 1; -- test passed
tr_failure constant number(1) := 2; -- one or more asserts failed
tr_error constant number(1) := 3; -- exception was raised

tr_ignore_char constant varchar2(6) := 'Ignore'; -- test/suite was ignored
tr_success_char constant varchar2(7) := 'Success'; -- test passed
tr_failure_char constant varchar2(7) := 'Failure'; -- one or more asserts failed
tr_error_char constant varchar2(5) := 'Error'; -- exception was raised
/* Constants: Test Results */
tr_skip constant number(1) := -1; -- silent skip without reporting. internal use
tr_ignore constant number(1) := 0; -- test/suite was ignored
tr_success constant number(1) := 1; -- test passed
tr_failure constant number(1) := 2; -- one or more asserts failed
tr_error constant number(1) := 3; -- exception was raised

tr_ignore_char constant varchar2(6) := 'Ignore'; -- test/suite was ignored
tr_success_char constant varchar2(7) := 'Success'; -- test passed
tr_failure_char constant varchar2(7) := 'Failure'; -- one or more asserts failed
tr_error_char constant varchar2(5) := 'Error'; -- exception was raised

/*
Constants: Rollback type for ut_test_object
*/
gc_rollback_auto constant number(1) := 0; -- rollback after each test and suite
gc_rollback_manual constant number(1) := 1; -- leave transaction control manual
gc_rollback_auto constant number(1) := 0; -- rollback after each test and suite
gc_rollback_manual constant number(1) := 1; -- leave transaction control manual
--gc_rollback_on_error constant number(1) := 2; -- rollback tests only on error

ex_unsupported_rollback_type exception;
gc_unsupported_rollback_type constant pls_integer := -20200;
pragma exception_init(ex_unsupported_rollback_type, -20200);

ex_path_list_is_empty exception;
gc_path_list_is_empty constant pls_integer := -20201;
pragma exception_init(ex_path_list_is_empty, -20201);

ex_invalid_path_format exception;
gc_invalid_path_format constant pls_integer := -20202;
pragma exception_init(ex_invalid_path_format, -20202);


gc_max_output_string_length constant integer := 4000;
gc_max_input_string_length constant integer := gc_max_output_string_length - 2; --we need to remove 2 chars for quotes around string
Expand Down Expand Up @@ -97,7 +94,7 @@ create or replace package ut_utils authid definer is

/*
Procedure: validate_rollback_type

Validates passed value against supported rollback types
*/
procedure validate_rollback_type(a_rollback_type number);
Expand Down
12 changes: 4 additions & 8 deletions source/expectations/ut_expectation.tps
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
create or replace type ut_expectation force as object
create or replace type ut_expectation as object
(
actual_data ut_data_value,
message varchar2(4000 char),
final member procedure add_assert_result( self in ut_expectation, a_assert_result boolean, a_assert_name varchar2,
a_assert_info varchar2, a_error_message varchar2, a_expected_value_string in varchar2 := null, a_expected_data_type varchar2 := null),
a_assert_info varchar2, a_error_message varchar2, a_expected_value_string in varchar2 := null, a_expected_data_type varchar2 := null),
final member procedure to_(self in ut_expectation, a_matcher ut_matcher),
final member procedure not_to(self in ut_expectation, a_matcher ut_matcher),
final member procedure to_be_null(self in ut_expectation),
final member procedure to_be_not_null(self in ut_expectation),

-- this is done to provide strong type comparison. other comporators should be implemented in the type-specific classes
member procedure to_equal(self in ut_expectation, a_expected anydata, a_nulls_are_equal boolean := null),
member procedure to_equal(self in ut_expectation, a_expected blob, a_nulls_are_equal boolean := null),
Expand All @@ -22,11 +22,7 @@ create or replace type ut_expectation force as object
member procedure to_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained, a_nulls_are_equal boolean := null),
member procedure to_equal(self in ut_expectation, a_expected varchar2, a_nulls_are_equal boolean := null),
member procedure to_equal(self in ut_expectation, a_expected yminterval_unconstrained, a_nulls_are_equal boolean := null),
member procedure to_equal(self in ut_expectation, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null),
final member procedure to_(self in ut_expectation, a_matcher ut_matcher),
final member procedure not_to(self in ut_expectation, a_matcher ut_matcher),
final member procedure to_be_null(self in ut_expectation),
final member procedure to_be_not_null(self in ut_expectation)
member procedure to_equal(self in ut_expectation, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null)
)
not final not instantiable
/
18 changes: 17 additions & 1 deletion source/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,20 @@ whenever oserror exit failure rollback
@@expectations/data_values/ut_data_value_boolean.tps
@@expectations/data_values/ut_data_value_clob.tps
@@expectations/data_values/ut_data_value_date.tps
@@expectations/data_values/ut_data_value_dsinterval.tps
@@expectations/data_values/ut_data_value_number.tps
@@expectations/data_values/ut_data_value_refcursor.tps
@@expectations/data_values/ut_data_value_timestamp.tps
@@expectations/data_values/ut_data_value_timestamp_tz.tps
@@expectations/data_values/ut_data_value_timestamp_ltz.tps
@@expectations/data_values/ut_data_value_varchar2.tps
@@expectations/data_values/ut_data_value_yminterval.tps
@@expectations/matchers/ut_matcher.tps
@@expectations/matchers/be_false.tps
@@expectations/matchers/be_greater_or_equal.tps
@@expectations/matchers/be_greater_than.tps
@@expectations/matchers/be_less_or_equal.tps
@@expectations/matchers/be_less_than.tps
@@expectations/matchers/be_like.tps
@@expectations/matchers/be_not_null.tps
@@expectations/matchers/be_null.tps
Expand All @@ -92,25 +98,33 @@ whenever oserror exit failure rollback
@@expectations/ut_expectation_boolean.tps
@@expectations/ut_expectation_clob.tps
@@expectations/ut_expectation_date.tps
@@expectations/ut_expectation_dsinterval.tps
@@expectations/ut_expectation_number.tps
@@expectations/ut_expectation_refcursor.tps
@@expectations/ut_expectation_timestamp.tps
@@expectations/ut_expectation_timestamp_ltz.tps
@@expectations/ut_expectation_timestamp_tz.tps
@@expectations/ut_expectation_varchar2.tps
@@expectations/ut_expectation_yminterval.tps
@@expectations/data_values/ut_data_value_anydata.tpb
@@expectations/data_values/ut_data_value_blob.tpb
@@expectations/data_values/ut_data_value_boolean.tpb
@@expectations/data_values/ut_data_value_clob.tpb
@@expectations/data_values/ut_data_value_date.tpb
@@expectations/data_values/ut_data_value_dsinterval.tpb
@@expectations/data_values/ut_data_value_number.tpb
@@expectations/data_values/ut_data_value_refcursor.tpb
@@expectations/data_values/ut_data_value_timestamp.tpb
@@expectations/data_values/ut_data_value_timestamp_tz.tpb
@@expectations/data_values/ut_data_value_timestamp_ltz.tpb
@@expectations/data_values/ut_data_value_varchar2.tpb
@@expectations/data_values/ut_data_value_yminterval.tpb
@@expectations/matchers/ut_matcher.tpb
@@expectations/matchers/be_false.tpb
@@expectations/matchers/be_greater_or_equal.tpb
@@expectations/matchers/be_greater_than.tpb
@@expectations/matchers/be_less_or_equal.tpb
@@expectations/matchers/be_less_than.tpb
@@expectations/matchers/be_like.tpb
@@expectations/matchers/be_not_null.tpb
@@expectations/matchers/be_null.tpb
Expand All @@ -124,14 +138,16 @@ whenever oserror exit failure rollback
@@expectations/ut_expectation_boolean.tpb
@@expectations/ut_expectation_clob.tpb
@@expectations/ut_expectation_date.tpb
@@expectations/ut_expectation_dsinterval.tpb
@@expectations/ut_expectation_number.tpb
@@expectations/ut_expectation_refcursor.tpb
@@expectations/ut_expectation_timestamp.tpb
@@expectations/ut_expectation_timestamp_ltz.tpb
@@expectations/ut_expectation_timestamp_tz.tpb
@@expectations/ut_expectation_varchar2.tpb
@@expectations/ut_expectation_yminterval.tpb

--expecatations interface
--expectations interface
@@expectations/ut.pks
@@expectations/ut.pkb

Expand Down
16 changes: 16 additions & 0 deletions source/uninstall.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ drop package ut_assert;

drop package ut;

drop type ut_expectation_yminterval;

drop type ut_expectation_varchar2;

drop type ut_expectation_timestamp_tz;
Expand All @@ -20,6 +22,8 @@ drop type ut_expectation_refcursor;

drop type ut_expectation_number;

drop type ut_expectation_dsinterval;

drop type ut_expectation_date;

drop type ut_expectation_clob;
Expand Down Expand Up @@ -48,10 +52,20 @@ drop type be_not_null;

drop type be_like;

drop type be_greater_or_equal;

drop type be_greater_than;

drop type be_less_or_equal;

drop type be_less_than;

drop type be_false;

drop type ut_matcher;

drop type ut_data_value_yminterval;

drop type ut_data_value_varchar2;

drop type ut_data_value_timestamp_tz;
Expand All @@ -64,6 +78,8 @@ drop type ut_data_value_number;

drop type ut_data_value_refcursor;

drop type ut_data_value_dsinterval;

drop type ut_data_value_date;

drop type ut_data_value_clob;
Expand Down
20 changes: 0 additions & 20 deletions tests/sqlnet.log

This file was deleted.