Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
48abf1a
Initial checkin
lwasylow Jun 1, 2020
7041912
added expectation
lwasylow Jun 2, 2020
13d86b6
Adding more methods
lwasylow Jun 2, 2020
caeeb30
Adding contain and not contain
lwasylow Jun 2, 2020
8ff4f6b
Adding code and tests,.
lwasylow Jun 6, 2020
89cb0bc
Fixingtoo long names
lwasylow Jun 6, 2020
a5481ac
fixing issue
lwasylow Jun 6, 2020
9ee0e75
Update documentation and tests
lwasylow Jun 7, 2020
a660208
First code corrections
lwasylow Jun 14, 2020
ada1ea4
Resolving another comment
lwasylow Jun 14, 2020
fe1b0cb
Updating issues
lwasylow Jun 14, 2020
013db74
Update tble
lwasylow Jun 14, 2020
b5c73b4
Separated into two different matchers
jgebal Jun 19, 2020
2e721da
CHECKPOINT
lwasylow Jun 19, 2020
fbc0f26
Merge branch 'feature/rework_matcher' of https://github.com/utPLSQL/u…
lwasylow Jun 19, 2020
f182430
Update uninstall
lwasylow Jun 19, 2020
e3fb2d7
Update progress
lwasylow Jun 19, 2020
322e0a1
Making code a bit more readable
lwasylow Jun 19, 2020
ff15596
Added tests for `be_within_pct`
jgebal Jun 20, 2020
3cae9a2
Fixed test issue
jgebal Jun 20, 2020
22549db
Fixed stacktrace for failed expectations on chained matchers.
jgebal Jun 21, 2020
1d771a5
Update timestamps
lwasylow Jun 25, 2020
363c333
Fixed and simplified matcher
jgebal Jun 27, 2020
0ea8925
Fixed native dynamic SQL types compatibility for 11g
jgebal Jun 28, 2020
7c01afb
Fixed native dynamic SQL types compatibility for 11g
jgebal Jun 28, 2020
66d92fc
Merge branch 'develop' into feature/rework_matcher
jgebal Jan 28, 2022
590fb38
Improving test stability (flaky tests)
jgebal Jan 28, 2022
5e2642a
Removing reference to ut3_develop schema.
jgebal Jan 28, 2022
ed06e33
Relaxed sql-injection check to work with 11g2
jgebal Jan 28, 2022
38f3cbc
Fixed issues with comparison of dates&timestamps using interval year-…
jgebal Jan 30, 2022
86e84c8
Improving code coverage.
jgebal Jan 31, 2022
718ac0d
Improved test stability.
jgebal Jan 31, 2022
6dbef20
Fixing build process to build using develop branch as testing framewo…
jgebal Jan 31, 2022
25b55b4
Improving test coverage.
jgebal Jan 31, 2022
5b5a5c0
Improving matcher documentation
jgebal Jan 31, 2022
7fec0f9
Added tests for 0 value of actual and expected and actual greater tha…
jgebal Feb 2, 2022
fd7ef9c
Fixed issues with precission of distance. `NATURAL` is a subtype of i…
jgebal Feb 2, 2022
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
Fixed issues with comparison of dates&timestamps using interval year-…
…month

Improved error handling for null values and incompatible datatypes
Improved handling of negative dates (BC)
Improved reporting of interval text value
Improved datatypes to handle large&small precissions for timestamps
  • Loading branch information
jgebal committed Jan 30, 2022
commit 38f3cbc1ff2ea87627e6744481715fa6571ad36a
38 changes: 19 additions & 19 deletions docs/userguide/expectations.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,25 +316,25 @@ Since NULL is neither *true* nor *false*, both expectations will report failure.

The matrix below illustrates the data types supported by different matchers.

| Matcher | blob | boolean | clob | date | number | timestamp | timestamp<br>with<br>timezone | timestamp<br>with<br>local<br>timezone | varchar2 | interval<br>year<br>to<br>month | interval<br>day<br>to<br>second | cursor | nested<br>table<br>/ varray | object | json |
| :---------------------: | :--: | :-----: | :--: | :--: | :----: | :-------: | :---------------------------: | :------------------------------------: | :------: | :-----------------------------: | :-----------------------------: | :----: | :-------------------------: | :----: | :--: |
| **be_not_null** | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| **be_null** | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| **be_false** | | X | | | | | | | | | | | | | |
| **be_true** | | X | | | | | | | | | | | | | |
| **be_greater_than** | | | | X | X | X | X | X | | X | X | | | | |
| **be_greater_or_equal** | | | | X | X | X | X | X | | X | X | | | | |
| **be_less_or_equal** | | | | X | X | X | X | X | | X | X | | | | |
| **be_less_than** | | | | X | X | X | X | X | | X | X | | | | |
| **be_between** | | | | X | X | X | X | X | X | X | X | | | | |
| **equal** | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| **contain** | | | | | | | | | | | | X | X | X | |
| **match** | | | X | | | | | | X | | | | | | |
| **be_like** | | | X | | | | | | X | | | | | | |
| **be_empty** | X | | X | | | | | | | | | X | X | | X |
| **have_count** | | | | | | | | | | | | X | X | | X |
| **be_within().of_()** | | | | x | x | | | | | | | | | | |
| **be_within_pct().of()**| | | | | x | | | | | | | | | | |
| Matcher | blob | boolean | clob | date | number | timestamp | timestamp<br>with<br>timezone | timestamp<br>with<br>local<br>timezone | varchar2 | interval<br>year<br>to<br>month | interval<br>day<br>to<br>second | cursor | nested<br>table<br>/ varray | object | json |
| :-----------------------: | :--: | :-----: | :--: | :--: | :----: | :-------: | :---------------------------: | :------------------------------------: | :------: | :-----------------------------: | :-----------------------------: | :----: | :-------------------------: | :----: | :--: |
| **be_not_null** | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| **be_null** | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| **be_false** | | X | | | | | | | | | | | | | |
| **be_true** | | X | | | | | | | | | | | | | |
| **be_greater_than** | | | | X | X | X | X | X | | X | X | | | | |
| **be_greater_or_equal** | | | | X | X | X | X | X | | X | X | | | | |
| **be_less_or_equal** | | | | X | X | X | X | X | | X | X | | | | |
| **be_less_than** | | | | X | X | X | X | X | | X | X | | | | |
| **be_between** | | | | X | X | X | X | X | X | X | X | | | | |
| **equal** | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
| **contain** | | | | | | | | | | | | X | X | X | |
| **match** | | | X | | | | | | X | | | | | | |
| **be_like** | | | X | | | | | | X | | | | | | |
| **be_empty** | X | | X | | | | | | | | | X | X | | X |
| **have_count** | | | | | | | | | | | | X | X | | X |
| **be_within().of_()** | | | | x | x | | | | | | | | | | |
| **be_within_pct().of_()** | | | | | x | | | | | | | | | | |

# Expecting exceptions

Expand Down
33 changes: 24 additions & 9 deletions source/core/ut_utils.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -919,12 +919,20 @@ create or replace package body ut_utils is
when l_minute > 1 then ' '||l_minute ||' minutes'
end ||
case
when l_second = 1 then ' '||l_second ||' second'
when l_second > 1 then ' '||l_second ||' seconds'
end;
return trim(leading ' ' from l_result);
when l_second > 1 then ' '||l_second ||' seconds'
when l_second = 1 then ' '||l_second ||' second'
when l_second > 0 then ' '||l_second ||' seconds'
end;
l_result :=
case
when a_interval is null then 'NULL'
when l_result is null then '0 seconds'
else ltrim(l_result,' ')
end;

return l_result;
end;

function interval_to_text(a_interval yminterval_unconstrained) return varchar2 is
l_year varchar2(4) := extract(year from a_interval);
l_month varchar2(20) := extract(month from a_interval);
Expand All @@ -935,10 +943,17 @@ create or replace package body ut_utils is
when l_year > 1 then l_year ||' years'
end ||
case
when l_month = 1 then ' '||l_month ||' month'
when l_month > 1 then ' '||l_month ||' months'
end;
return trim(leading ' ' from l_result);
when l_month > 1 then ' '||l_month ||' months'
when l_month = 1 then ' '||l_month ||' month'
end;
l_result :=
case
when a_interval is null then 'NULL'
when l_result is null then '0 months'
else ltrim(l_result,' ')
end;

return l_result;
end;


Expand Down
6 changes: 3 additions & 3 deletions source/core/ut_utils.pks
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ create or replace package ut_utils authid definer is
gc_more_data_string constant varchar2(5) := '[...]';
gc_more_data_string_len constant integer := length( gc_more_data_string );
gc_number_format constant varchar2(100) := 'TM9';
gc_date_format constant varchar2(100) := 'yyyy-mm-dd"T"hh24:mi:ss';
gc_timestamp_format constant varchar2(100) := 'yyyy-mm-dd"T"hh24:mi:ssxff';
gc_timestamp_tz_format constant varchar2(100) := 'yyyy-mm-dd"T"hh24:mi:ssxff tzh:tzm';
gc_date_format constant varchar2(100) := 'syyyy-mm-dd"T"hh24:mi:ss';
gc_timestamp_format constant varchar2(100) := 'syyyy-mm-dd"T"hh24:mi:ssxff';
gc_timestamp_tz_format constant varchar2(100) := 'syyyy-mm-dd"T"hh24:mi:ssxff tzh:tzm';
gc_null_string constant varchar2(4) := 'NULL';
gc_empty_string constant varchar2(5) := 'EMPTY';

Expand Down
1 change: 1 addition & 0 deletions source/expectations/data_values/ut_data_value.tps
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ create or replace type ut_data_value force authid current_user as object (
limitations under the License.
*/
data_type varchar2(250 char),
data_type_plsql varchar2(250 char),
self_type varchar2(250 char),
not instantiable member function is_null return boolean,
not instantiable member function to_string return varchar2,
Expand Down
1 change: 1 addition & 0 deletions source/expectations/data_values/ut_data_value_blob.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_blob as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'blob';
self.data_type_plsql := 'blob';
return;
end;

Expand Down
1 change: 1 addition & 0 deletions source/expectations/data_values/ut_data_value_boolean.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_boolean as
self.data_value := ut_utils.boolean_to_int(a_value);
self.self_type := $$plsql_unit;
self.data_type := 'boolean';
self.data_type_plsql := 'boolean';
return;
end;

Expand Down
1 change: 1 addition & 0 deletions source/expectations/data_values/ut_data_value_clob.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_clob as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'clob';
self.data_type_plsql := 'clob';
return;
end;

Expand Down
1 change: 1 addition & 0 deletions source/expectations/data_values/ut_data_value_date.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_date as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'date';
self.data_type_plsql := 'date';
return;
end;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_dsinterval as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'interval day to second';
self.data_type_plsql := 'dsinterval_unconstrained';
return;
end;

Expand Down
1 change: 1 addition & 0 deletions source/expectations/data_values/ut_data_value_number.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_number as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'number';
self.data_type_plsql := 'number';
return;
end;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ create or replace type body ut_data_value_refcursor as
self.self_type := $$plsql_unit;
self.data_id := sys_guid();
self.data_type := 'refcursor';
self.data_type_plsql := 'sys_refcursor';
self.compound_type := 'refcursor';
self.extract_path := '/*';
ut_compound_data_helper.cleanup_diff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_timestamp as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'timestamp';
self.data_type_plsql := 'timestamp_unconstrained';
return;
end;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_timestamp_ltz as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'timestamp with local time zone';
self.data_type_plsql := 'timestamp_ltz_unconstrained';
return;
end;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_timestamp_tz as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'timestamp with time zone';
self.data_type_plsql := 'timestamp_tz_unconstrained';
return;
end;

Expand Down
1 change: 1 addition & 0 deletions source/expectations/data_values/ut_data_value_varchar2.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_varchar2 as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'varchar2';
self.data_type_plsql := 'varchar2(32767)';
return;
end;

Expand Down
1 change: 1 addition & 0 deletions source/expectations/data_values/ut_data_value_xmltype.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_xmltype as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'xmltype';
self.data_type_plsql := 'xmltype';
return;
end;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type body ut_data_value_yminterval as
self.data_value := a_value;
self.self_type := $$plsql_unit;
self.data_type := 'interval year to month';
self.data_type_plsql := 'yminterval_unconstrained';
return;
end;

Expand Down
Loading