-
Notifications
You must be signed in to change notification settings - Fork 189
This commit fixes #78 issue. #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
46add3e
This commit fixes #78 issue.
66f4135
Merge branch 'version3' into feature/new_matchers_and_data_types
jgebal bb8d967
Added new elements to the install/uninstall scripts.
jgebal ec81d30
Removed SQLNet.log
jgebal fd20062
Merge pull request #1 from jgebal/feature/new_matchers_and_data_types
proldan 96e0e23
Remove uppercase
11006d4
Adds interval support to be_between matcher
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
This commit fixes #78 issue.
- Loading branch information
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -11,21 +11,21 @@ create or replace package ut_utils authid definer is | |
| 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 constant number(1) := 0; -- test/suite was ignored | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those changes are not needed. |
||
| 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 | ||
| 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_unsopported_rollback_type exception; | ||
|
|
@@ -77,13 +77,17 @@ create or replace package ut_utils authid definer is | |
|
|
||
| function to_string(a_value timestamp_ltz_unconstrained) return varchar2; | ||
|
|
||
| function to_string(a_value yminterval_unconstrained) return varchar2; | ||
|
|
||
| function to_string(a_value dsinterval_unconstrained) return varchar2; | ||
|
|
||
| function boolean_to_int(a_value boolean) return integer; | ||
|
|
||
| function int_to_boolean(a_value integer) return boolean; | ||
|
|
||
| /* | ||
| Procedure: validate_rollback_type | ||
|
|
||
| Validates passed value against supported rollback types | ||
| */ | ||
| procedure validate_rollback_type(a_rollback_type number); | ||
|
|
||
21 changes: 21 additions & 0 deletions
21
source/expectations/data_values/ut_data_value_dsinterval.tpb
This file contains hidden or 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,21 @@ | ||
| create or replace type body ut_data_value_dsinterval as | ||
|
|
||
| constructor function ut_data_value_dsinterval(self in out nocopy ut_data_value_dsinterval, a_value dsinterval_unconstrained) return self as result is | ||
| begin | ||
| self.datavalue := a_value; | ||
| self.datatype := 'day to second interval'; | ||
| return; | ||
| end; | ||
|
|
||
| overriding member function is_null return boolean is | ||
| begin | ||
| return (self.datavalue is null); | ||
| end; | ||
|
|
||
| overriding member function to_string return varchar2 is | ||
| begin | ||
| return ut_utils.to_string(self.datavalue); | ||
| end; | ||
|
|
||
| end; | ||
| / |
This file contains hidden or 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,7 @@ | ||
| create or replace type ut_data_value_dsinterval under ut_data_value( | ||
| datavalue dsinterval_unconstrained, | ||
| constructor function ut_data_value_dsinterval(self in out nocopy ut_data_value_dsinterval, a_value dsinterval_unconstrained) return self as result, | ||
| overriding member function is_null return boolean, | ||
| overriding member function to_string return varchar2 | ||
| ) | ||
| / |
21 changes: 21 additions & 0 deletions
21
source/expectations/data_values/ut_data_value_yminterval.tpb
This file contains hidden or 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,21 @@ | ||
| create or replace type body ut_data_value_yminterval as | ||
|
|
||
| constructor function ut_data_value_yminterval(self in out nocopy ut_data_value_yminterval, a_value yminterval_unconstrained) return self as result is | ||
| begin | ||
| self.datavalue := a_value; | ||
| self.datatype := 'year to month interval'; | ||
| return; | ||
| end; | ||
|
|
||
| overriding member function is_null return boolean is | ||
| begin | ||
| return (self.datavalue is null); | ||
| end; | ||
|
|
||
| overriding member function to_string return varchar2 is | ||
| begin | ||
| return ut_utils.to_string(self.datavalue); | ||
| end; | ||
|
|
||
| end; | ||
| / |
This file contains hidden or 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,7 @@ | ||
| create or replace type ut_data_value_yminterval under ut_data_value( | ||
| datavalue yminterval_unconstrained, | ||
| constructor function ut_data_value_yminterval(self in out nocopy ut_data_value_yminterval, a_value yminterval_unconstrained) return self as result, | ||
| overriding member function is_null return boolean, | ||
| overriding member function to_string return varchar2 | ||
| ) | ||
| / |
This file contains hidden or 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,110 @@ | ||
| create or replace type body be_greater_or_equal AS | ||
|
|
||
| member procedure init(self in out nocopy be_greater_or_equal, a_expected ut_data_value) is | ||
| begin | ||
| self.name := lower($$plsql_unit); | ||
| self.expected := a_expected; | ||
| end; | ||
|
|
||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected date) return self as result is | ||
| begin | ||
| init(ut_data_value_date(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected NUMBER) return self as result is | ||
| begin | ||
| init(ut_data_value_number(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected timestamp_unconstrained) return self as result is | ||
| begin | ||
| init(ut_data_value_timestamp(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected timestamp_tz_unconstrained) return self as result is | ||
| begin | ||
| init(ut_data_value_timestamp_tz(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected timestamp_ltz_unconstrained) return self as result is | ||
| begin | ||
| init(ut_data_value_timestamp_ltz(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected yminterval_unconstrained) return self as RESULT IS | ||
| begin | ||
| init(ut_data_value_yminterval(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected dsinterval_unconstrained) return self as RESULT IS | ||
| begin | ||
| init(ut_data_value_dsinterval(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| overriding member function run_matcher(self in out nocopy be_greater_or_equal, a_actual ut_data_value) return boolean is | ||
| l_result boolean; | ||
| begin | ||
| if self.expected is of (ut_data_value_date) and a_actual is of (ut_data_value_date) then | ||
| declare | ||
| l_expected ut_data_value_date := treat(self.expected as ut_data_value_date); | ||
| l_actual ut_data_value_date := treat(a_actual as ut_data_value_date); | ||
| begin | ||
| l_result := l_actual.datavalue >= l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_number) and a_actual is of (ut_data_value_number) then | ||
| declare | ||
| l_expected ut_data_value_number := treat(self.expected as ut_data_value_number); | ||
| l_actual ut_data_value_number := treat(a_actual as ut_data_value_number); | ||
| begin | ||
| l_result := l_actual.datavalue >= l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_timestamp) and a_actual is of (ut_data_value_timestamp) then | ||
| declare | ||
| l_expected ut_data_value_timestamp := treat(self.expected as ut_data_value_timestamp); | ||
| l_actual ut_data_value_timestamp := treat(a_actual as ut_data_value_timestamp); | ||
| begin | ||
| l_result := l_actual.datavalue >= l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_timestamp_ltz) and a_actual is of (ut_data_value_timestamp_ltz) then | ||
| declare | ||
| l_expected ut_data_value_timestamp_ltz := treat(self.expected as ut_data_value_timestamp_ltz); | ||
| l_actual ut_data_value_timestamp_ltz := treat(a_actual as ut_data_value_timestamp_ltz); | ||
| begin | ||
| l_result := l_actual.datavalue >= l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_timestamp_tz) and a_actual is of (ut_data_value_timestamp_tz) then | ||
| declare | ||
| l_expected ut_data_value_timestamp_tz := treat(self.expected as ut_data_value_timestamp_tz); | ||
| l_actual ut_data_value_timestamp_tz := treat(a_actual as ut_data_value_timestamp_tz); | ||
| begin | ||
| l_result := l_actual.datavalue >= l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_yminterval) and a_actual is of (ut_data_value_yminterval) then | ||
| declare | ||
| l_expected ut_data_value_yminterval := treat(self.expected as ut_data_value_yminterval); | ||
| l_actual ut_data_value_yminterval := treat(a_actual as ut_data_value_yminterval); | ||
| begin | ||
| l_result := l_actual.datavalue >= l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_dsinterval) and a_actual is of (ut_data_value_dsinterval) then | ||
| declare | ||
| l_expected ut_data_value_dsinterval := treat(self.expected as ut_data_value_dsinterval); | ||
| l_actual ut_data_value_dsinterval := treat(a_actual as ut_data_value_dsinterval); | ||
| begin | ||
| l_result := l_actual.datavalue >= l_expected.datavalue; | ||
| end; | ||
| else | ||
| l_result := (self as ut_matcher).run_matcher(a_actual); | ||
| end if; | ||
| return l_result; | ||
| end; | ||
|
|
||
| END; | ||
| / |
This file contains hidden or 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,12 @@ | ||
| create or replace type be_greater_or_equal under ut_matcher( | ||
| member procedure init(self in out nocopy be_greater_or_equal, a_expected ut_data_value), | ||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected date) return self as result, | ||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected number) return self as result, | ||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected timestamp_unconstrained) return self as result, | ||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected timestamp_tz_unconstrained) return self as result, | ||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected timestamp_ltz_unconstrained) return self as result, | ||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected yminterval_unconstrained) return self as result, | ||
| constructor function be_greater_or_equal(self in out nocopy be_greater_or_equal, a_expected dsinterval_unconstrained) return self as result, | ||
| overriding member function run_matcher(self in out nocopy be_greater_or_equal, a_actual ut_data_value) return boolean | ||
| ) | ||
| / |
This file contains hidden or 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,110 @@ | ||
| create or replace type body be_greater_than AS | ||
|
|
||
| member procedure init(self in out nocopy be_greater_than, a_expected ut_data_value) is | ||
| begin | ||
| self.name := lower($$plsql_unit); | ||
| self.expected := a_expected; | ||
| end; | ||
|
|
||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected date) return self as result is | ||
| begin | ||
| init(ut_data_value_date(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected NUMBER) return self as result is | ||
| begin | ||
| init(ut_data_value_number(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected timestamp_unconstrained) return self as result is | ||
| begin | ||
| init(ut_data_value_timestamp(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected timestamp_tz_unconstrained) return self as result is | ||
| begin | ||
| init(ut_data_value_timestamp_tz(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected timestamp_ltz_unconstrained) return self as result is | ||
| begin | ||
| init(ut_data_value_timestamp_ltz(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected yminterval_unconstrained) return self as RESULT IS | ||
| begin | ||
| init(ut_data_value_yminterval(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected dsinterval_unconstrained) return self as RESULT IS | ||
| begin | ||
| init(ut_data_value_dsinterval(a_expected)); | ||
| return; | ||
| end; | ||
|
|
||
| overriding member function run_matcher(self in out nocopy be_greater_than, a_actual ut_data_value) return boolean is | ||
| l_result boolean; | ||
| begin | ||
| if self.expected is of (ut_data_value_date) and a_actual is of (ut_data_value_date) then | ||
| declare | ||
| l_expected ut_data_value_date := treat(self.expected as ut_data_value_date); | ||
| l_actual ut_data_value_date := treat(a_actual as ut_data_value_date); | ||
| begin | ||
| l_result := l_actual.datavalue > l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_number) and a_actual is of (ut_data_value_number) then | ||
| declare | ||
| l_expected ut_data_value_number := treat(self.expected as ut_data_value_number); | ||
| l_actual ut_data_value_number := treat(a_actual as ut_data_value_number); | ||
| begin | ||
| l_result := l_actual.datavalue > l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_timestamp) and a_actual is of (ut_data_value_timestamp) then | ||
| declare | ||
| l_expected ut_data_value_timestamp := treat(self.expected as ut_data_value_timestamp); | ||
| l_actual ut_data_value_timestamp := treat(a_actual as ut_data_value_timestamp); | ||
| begin | ||
| l_result := l_actual.datavalue > l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_timestamp_ltz) and a_actual is of (ut_data_value_timestamp_ltz) then | ||
| declare | ||
| l_expected ut_data_value_timestamp_ltz := treat(self.expected as ut_data_value_timestamp_ltz); | ||
| l_actual ut_data_value_timestamp_ltz := treat(a_actual as ut_data_value_timestamp_ltz); | ||
| begin | ||
| l_result := l_actual.datavalue > l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_timestamp_tz) and a_actual is of (ut_data_value_timestamp_tz) then | ||
| declare | ||
| l_expected ut_data_value_timestamp_tz := treat(self.expected as ut_data_value_timestamp_tz); | ||
| l_actual ut_data_value_timestamp_tz := treat(a_actual as ut_data_value_timestamp_tz); | ||
| begin | ||
| l_result := l_actual.datavalue > l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_yminterval) and a_actual is of (ut_data_value_yminterval) then | ||
| declare | ||
| l_expected ut_data_value_yminterval := treat(self.expected as ut_data_value_yminterval); | ||
| l_actual ut_data_value_yminterval := treat(a_actual as ut_data_value_yminterval); | ||
| begin | ||
| l_result := l_actual.datavalue > l_expected.datavalue; | ||
| end; | ||
| elsif self.expected is of (ut_data_value_dsinterval) and a_actual is of (ut_data_value_dsinterval) then | ||
| declare | ||
| l_expected ut_data_value_dsinterval := treat(self.expected as ut_data_value_dsinterval); | ||
| l_actual ut_data_value_dsinterval := treat(a_actual as ut_data_value_dsinterval); | ||
| begin | ||
| l_result := l_actual.datavalue > l_expected.datavalue; | ||
| end; | ||
| else | ||
| l_result := (self as ut_matcher).run_matcher(a_actual); | ||
| end if; | ||
| return l_result; | ||
| end; | ||
|
|
||
| END; | ||
| / |
This file contains hidden or 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,12 @@ | ||
| create or replace type be_greater_than under ut_matcher( | ||
| member procedure init(self in out nocopy be_greater_than, a_expected ut_data_value), | ||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected date) return self as result, | ||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected number) return self as result, | ||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected timestamp_unconstrained) return self as result, | ||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected timestamp_tz_unconstrained) return self as result, | ||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected timestamp_ltz_unconstrained) return self as result, | ||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected yminterval_unconstrained) return self as result, | ||
| constructor function be_greater_than(self in out nocopy be_greater_than, a_expected dsinterval_unconstrained) return self as result, | ||
| overriding member function run_matcher(self in out nocopy be_greater_than, a_actual ut_data_value) return boolean | ||
| ) | ||
| / |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the naming convention we dont use uppercased keywords