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

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added not_to_equal
  • Loading branch information
Pazus committed May 6, 2017
commit d116234fa07037f8bccec89e97d9caf959a81566
4 changes: 2 additions & 2 deletions examples/award_bonus/test_award_bonus.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ create or replace package body test_award_bonus as
procedure fail_on_null_bonus is
begin
award_bonus(emp_id => gc_test_employee, sales_amt => null);
ut.expect( sqlcode ).not_to( equal( 0 ) );
ut.expect( sqlcode ).not_to_equal( 0 );
exception
when others then
ut.expect( sqlcode ).not_to( equal( 0 ) );
ut.expect( sqlcode ).not_to_equal( 0 );
end;

procedure add_employee( emp_id number, comm_pct number, sal number ) is
Expand Down
6 changes: 6 additions & 0 deletions examples/demo_expectations.pck
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,12 @@ create or replace package body demo_expectations is
ut.expect(sysdate).not_to( be_between(sysdate+1,sysdate+2) );
ut.expect( 1 ).not_to( equal( 2 ) );
ut.expect( 'asd' ).not_to( be_like('z%q') );

ut.expect( sysdate ).not_to_be_null();
ut.expect( to_char(null) ).not_to_be_not_null();
ut.expect(sysdate).not_to_be_between(sysdate+1,sysdate+2);
ut.expect( 1 ).not_to_equal( 2 );
ut.expect( 'asd' ).not_to_be_like('z%q');
end;

end;
Expand Down
84 changes: 84 additions & 0 deletions source/expectations/ut_expectation.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,90 @@ create or replace type body ut_expectation as
ut_utils.debug_log('ut_expectation.to_be_not_null');
self.to_( ut_be_not_null() );
end;

member procedure not_to_equal(self in ut_expectation, a_expected anydata, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected anydata, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected blob, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected blob, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected boolean, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected boolean, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected clob, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected clob, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected date, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected date, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected number, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected number, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude varchar2 := null, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude varchar2 := null, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_exclude, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_exclude, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected varchar2, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected varchar2, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected yminterval_unconstrained, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected yminterval_unconstrained, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation.not_to_equal(self in ut_expectation, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

end;
/
17 changes: 16 additions & 1 deletion source/expectations/ut_expectation.tps
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,22 @@ create or replace type ut_expectation authid current_user 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)
member procedure to_equal(self in ut_expectation, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null),

member procedure not_to_equal(self in ut_expectation, a_expected anydata, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected blob, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected boolean, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected clob, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected date, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected number, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude varchar2 := null, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected varchar2, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected yminterval_unconstrained, a_nulls_are_equal boolean := null),
member procedure not_to_equal(self in ut_expectation, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null)
)
not final not instantiable
/
6 changes: 6 additions & 0 deletions source/expectations/ut_expectation_anydata.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ create or replace type body ut_expectation_anydata as
self.to_( ut_be_empty() );
end;

overriding member procedure not_to_equal(self in ut_expectation_anydata, a_expected anydata, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation_anydata.not_to_equal(self in ut_expectation_anydata, a_expected anydata, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_be_empty(self in ut_expectation_anydata) is
begin
ut_utils.debug_log('ut_expectation_anydata.not_to_be_empty(self in ut_expectation_anydata)');
Expand Down
1 change: 1 addition & 0 deletions source/expectations/ut_expectation_anydata.tps
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ create or replace type ut_expectation_anydata under ut_expectation(
overriding member procedure to_equal(self in ut_expectation_anydata, a_expected anydata, a_nulls_are_equal boolean := null),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add not_to_equal

member procedure to_be_empty(self in ut_expectation_anydata),

overriding member procedure not_to_equal(self in ut_expectation_anydata, a_expected anydata, a_nulls_are_equal boolean := null),
member procedure not_to_be_empty(self in ut_expectation_anydata)
)
/
6 changes: 6 additions & 0 deletions source/expectations/ut_expectation_blob.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ create or replace type body ut_expectation_blob as
ut_utils.debug_log('ut_expectation_blob.to_equal(self in ut_expectation, a_expected blob)');
self.to_( ut_equal(a_expected, a_nulls_are_equal) );
end;

overriding member procedure not_to_equal(self in ut_expectation_blob, a_expected blob, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation_blob.not_to_equal(self in ut_expectation, a_expected blob)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

end;
/
3 changes: 2 additions & 1 deletion source/expectations/ut_expectation_blob.tps
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ create or replace type ut_expectation_blob under ut_expectation(
See the License for the specific language governing permissions and
limitations under the License.
*/
overriding member procedure to_equal(self in ut_expectation_blob, a_expected blob, a_nulls_are_equal boolean := null)
overriding member procedure to_equal(self in ut_expectation_blob, a_expected blob, a_nulls_are_equal boolean := null),
overriding member procedure not_to_equal(self in ut_expectation_blob, a_expected blob, a_nulls_are_equal boolean := null)
)
/
6 changes: 6 additions & 0 deletions source/expectations/ut_expectation_boolean.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ create or replace type body ut_expectation_boolean as
ut_utils.debug_log('ut_expectation_boolean.to_be_false(self in ut_expectation_boolean)');
self.to_( ut_be_false() );
end;

overriding member procedure not_to_equal(self in ut_expectation_boolean, a_expected boolean, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation_boolean.not_to_equal(self in ut_expectation_boolean, a_expected boolean, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

end;
/
4 changes: 3 additions & 1 deletion source/expectations/ut_expectation_boolean.tps
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ create or replace type ut_expectation_boolean under ut_expectation(
*/
overriding member procedure to_equal(self in ut_expectation_boolean, a_expected boolean, a_nulls_are_equal boolean := null),
member procedure to_be_true(self in ut_expectation_boolean),
member procedure to_be_false(self in ut_expectation_boolean)
member procedure to_be_false(self in ut_expectation_boolean),

overriding member procedure not_to_equal(self in ut_expectation_boolean, a_expected boolean, a_nulls_are_equal boolean := null)
)
/
6 changes: 6 additions & 0 deletions source/expectations/ut_expectation_clob.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ create or replace type body ut_expectation_clob as
self.to_( ut_match(a_pattern, a_modifiers) );
end;

overriding member procedure not_to_equal(self in ut_expectation_clob, a_expected clob, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation_clob.not_to_equal(self in ut_expectation, a_expected clob)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_be_like(self in ut_expectation_clob, a_mask in varchar2, a_escape_char in varchar2 := null) is
begin
ut_utils.debug_log('ut_expectation_clob.not_to_be_like(self in ut_expectation, a_mask in varchar2, a_escape_char in varchar2 default null)');
Expand Down
1 change: 1 addition & 0 deletions source/expectations/ut_expectation_clob.tps
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ create or replace type ut_expectation_clob under ut_expectation(
member procedure to_be_like(self in ut_expectation_clob, a_mask in varchar2, a_escape_char in varchar2 := null),
member procedure to_match(self in ut_expectation_clob, a_pattern in varchar2, a_modifiers in varchar2 := null),

overriding member procedure not_to_equal(self in ut_expectation_clob, a_expected clob, a_nulls_are_equal boolean := null),
member procedure not_to_be_like(self in ut_expectation_clob, a_mask in varchar2, a_escape_char in varchar2 := null),
member procedure not_to_match(self in ut_expectation_clob, a_pattern in varchar2, a_modifiers in varchar2 := null)
)
Expand Down
6 changes: 6 additions & 0 deletions source/expectations/ut_expectation_date.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ create or replace type body ut_expectation_date as
self.to_( ut_be_less_than (a_expected) );
end;

overriding member procedure not_to_equal(self in ut_expectation_date, a_expected date, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation_date.not_to_equal(self in ut_expectation, a_expected date, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_be_between(self in ut_expectation_date, a_lower_bound date, a_upper_bound date) is
begin
ut_utils.debug_log('ut_expectation_date.not_to_be_between(self in ut_expectation_date, a_lower_bound date, a_upper_bound date)');
Expand Down
1 change: 1 addition & 0 deletions source/expectations/ut_expectation_date.tps
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ create or replace type ut_expectation_date under ut_expectation(
member procedure to_be_less_or_equal(self in ut_expectation_date, a_expected date),
member procedure to_be_less_than(self in ut_expectation_date, a_expected date),

overriding member procedure not_to_equal(self in ut_expectation_date, a_expected date, a_nulls_are_equal boolean := null),
member procedure not_to_be_between(self in ut_expectation_date, a_lower_bound date, a_upper_bound date)
)
/
6 changes: 6 additions & 0 deletions source/expectations/ut_expectation_dsinterval.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ create or replace type body ut_expectation_dsinterval as
self.to_( ut_be_less_than (a_expected) );
end;

overriding member procedure not_to_equal(self in ut_expectation_dsinterval, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation_dsinterval.not_to_equal(self in ut_expectation, a_expected dsinterval_unconstrained)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_be_between(self in ut_expectation_dsinterval, a_lower_bound dsinterval_unconstrained, a_upper_bound dsinterval_unconstrained) is
begin
ut_utils.debug_log('ut_expectation_dsinterval.not_to_be_between(self in ut_expectation_dsinterval, a_lower_bound dsinterval_unconstrained, a_upper_bound dsinterval_unconstrained)');
Expand Down
1 change: 1 addition & 0 deletions source/expectations/ut_expectation_dsinterval.tps
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ create or replace type ut_expectation_dsinterval under ut_expectation(
member procedure to_be_less_or_equal(self in ut_expectation_dsinterval, a_expected dsinterval_unconstrained),
member procedure to_be_less_than(self in ut_expectation_dsinterval, a_expected dsinterval_unconstrained),

overriding member procedure not_to_equal(self in ut_expectation_dsinterval, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null),
member procedure not_to_be_between(self in ut_expectation_dsinterval, a_lower_bound dsinterval_unconstrained, a_upper_bound dsinterval_unconstrained)
)
/
6 changes: 6 additions & 0 deletions source/expectations/ut_expectation_number.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ create or replace type body ut_expectation_number as
self.to_( ut_be_less_than (a_expected) );
end;

overriding member procedure not_to_equal(self in ut_expectation_number, a_expected number, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation_number.not_to_equal(self in ut_expectation, a_expected number, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_be_between(self in ut_expectation_number, a_lower_bound number, a_upper_bound number) is
begin
ut_utils.debug_log('ut_expectation_number.not_to_be_between(self in ut_expectation_date, a_lower_bound number, a_upper_bound number)');
Expand Down
1 change: 1 addition & 0 deletions source/expectations/ut_expectation_number.tps
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ create or replace type ut_expectation_number under ut_expectation(
member procedure to_be_less_or_equal(self in ut_expectation_number, a_expected number),
member procedure to_be_less_than(self in ut_expectation_number, a_expected number),

overriding member procedure not_to_equal(self in ut_expectation_number, a_expected number, a_nulls_are_equal boolean := null),
member procedure not_to_be_between(self in ut_expectation_number, a_lower_bound number, a_upper_bound number)
)
/
6 changes: 6 additions & 0 deletions source/expectations/ut_expectation_refcursor.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ create or replace type body ut_expectation_refcursor as
self.to_( ut_be_empty() );
end;

overriding member procedure not_to_equal(self in ut_expectation_refcursor, a_expected sys_refcursor, a_exclude varchar2 := null, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation_refcursor.not_to_equal(self in ut_expectation_refcursor, a_expected sys_refcursor, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_exclude, a_nulls_are_equal) );
end;

member procedure not_to_be_empty(self in ut_expectation_refcursor) is
begin
ut_utils.debug_log('ut_expectation_refcursor.not_to_be_empty(self in ut_expectation_refcursor)');
Expand Down
2 changes: 2 additions & 0 deletions source/expectations/ut_expectation_refcursor.tps
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ create or replace type ut_expectation_refcursor under ut_expectation(
*/
overriding member procedure to_equal(self in ut_expectation_refcursor, a_expected sys_refcursor, a_exclude varchar2 := null, a_nulls_are_equal boolean := null),
member procedure to_be_empty(self in ut_expectation_refcursor),

overriding member procedure not_to_equal(self in ut_expectation_refcursor, a_expected sys_refcursor, a_exclude varchar2 := null, a_nulls_are_equal boolean := null),
member procedure not_to_be_empty(self in ut_expectation_refcursor)
)
/
6 changes: 6 additions & 0 deletions source/expectations/ut_expectation_timestamp.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ create or replace type body ut_expectation_timestamp as
self.to_( ut_be_less_than (a_expected) );
end;

overriding member procedure not_to_equal(self in ut_expectation_timestamp, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null) is
begin
ut_utils.debug_log('ut_expectation_timestamp.not_to_equal(self in ut_expectation, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null)');
self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure not_to_be_between(self in ut_expectation_timestamp, a_lower_bound timestamp_unconstrained, a_upper_bound timestamp_unconstrained) is
begin
ut_utils.debug_log('ut_expectation_timestamp.not_to_be_between(self in ut_expectation_timestamp, a_lower_bound timestamp_unconstrained, a_upper_bound timestamp_unconstrained)');
Expand Down
1 change: 1 addition & 0 deletions source/expectations/ut_expectation_timestamp.tps
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ create or replace type ut_expectation_timestamp under ut_expectation(
member procedure to_be_less_or_equal(self in ut_expectation_timestamp, a_expected timestamp_unconstrained),
member procedure to_be_less_than(self in ut_expectation_timestamp, a_expected timestamp_unconstrained),

overriding member procedure not_to_equal(self in ut_expectation_timestamp, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null),
member procedure not_to_be_between(self in ut_expectation_timestamp, a_lower_bound timestamp_unconstrained, a_upper_bound timestamp_unconstrained)
)
/
Loading