You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/userguide/expectations.md
+73-3Lines changed: 73 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1096,15 +1096,85 @@ SUCCESS
1096
1096
1097
1097
## to_be_within of
1098
1098
1099
-
This fuzzy matcher is designed to allow user to compare a numbers and dates within distance of error.
1099
+
This matcher is created to determine wheter expected value is approximately equal or "close" to another value.
1100
1100
1101
-
We are allowing a numbers to be compared within a absolute distance from other number of within a percentage calculated based on expected value.
1101
+
Matcher will allow to compare numbers as well as dates.
1102
1102
1103
-
When comparing a date a distance is measured in interval.
1103
+
When comparing a number the tolerance / distance can be expressed as another postive number or a percentage.
1104
1104
1105
+
When comparing a two dates tolerance can be expressed in interval time either Day-To-Second or Year-To-Month.
1105
1106
1107
+
Matcher for numbers will calculate a absolute distance between expected and actual and check whether that value is within a tolerance.
1106
1108
1109
+
When comparing a date a distance is measured in interval, the check is done that actual value is within date range of expected taking into account interval plus and minus.
Copy file name to clipboardExpand all lines: source/expectations/matchers/ut_be_within.tpb
+16-7Lines changed: 16 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -60,16 +60,25 @@ create or replace type body ut_be_within as
60
60
begin
61
61
if self.expected.data_type = a_actual.data_type then
62
62
if self.expected is of (ut_data_value_number) and self.is_pct = 0 then
63
-
l_result := abs((treat(self.expected as ut_data_value_number).data_value - treat(a_actual as ut_data_value_number).data_value)) <= treat(self.dist as ut_data_value_number).data_value;
63
+
l_result := abs((treat(self.expected as ut_data_value_number).data_value - treat(a_actual as ut_data_value_number).data_value)) <=
64
+
treat(self.dist as ut_data_value_number).data_value;
64
65
elsif self.expected is of (ut_data_value_number) and self.is_pct = 1 then
65
-
l_result := treat(self.dist as ut_data_value_number).data_value >= ((treat(self.expected as ut_data_value_number).data_value - treat(a_actual as ut_data_value_number).data_value ) * 100 ) /
66
-
(treat(self.expected as ut_data_value_number).data_value) ;
66
+
l_result := treat(self.dist as ut_data_value_number).data_value >=
67
+
(
68
+
((treat(self.expected as ut_data_value_number).data_value - treat(a_actual as ut_data_value_number).data_value ) * 100 ) /
69
+
(treat(self.expected as ut_data_value_number).data_value)) ;
67
70
elsif self.expected is of (ut_data_value_date) and self.dist is of ( ut_data_value_yminterval) then
68
-
l_result := treat(a_actual as ut_data_value_date).data_value between (treat(self.expected as ut_data_value_date).data_value) - treat(self.dist as ut_data_value_yminterval).data_value
69
-
and (treat(self.expected as ut_data_value_date).data_value) + treat(self.dist as ut_data_value_yminterval).data_value;
71
+
l_result := treat(a_actual as ut_data_value_date).data_value
72
+
between
73
+
(treat(self.expected as ut_data_value_date).data_value) - treat(self.dist as ut_data_value_yminterval).data_value
74
+
and
75
+
(treat(self.expected as ut_data_value_date).data_value) + treat(self.dist as ut_data_value_yminterval).data_value;
70
76
elsif self.expected is of (ut_data_value_date) and self.dist is of ( ut_data_value_dsinterval) then
71
-
l_result := treat(a_actual as ut_data_value_date).data_value between (treat(self.expected as ut_data_value_date).data_value) - treat(self.dist as ut_data_value_dsinterval).data_value
72
-
and (treat(self.expected as ut_data_value_date).data_value) + treat(self.dist as ut_data_value_dsinterval).data_value;
77
+
l_result := treat(a_actual as ut_data_value_date).data_value
78
+
between
79
+
(treat(self.expected as ut_data_value_date).data_value) - treat(self.dist as ut_data_value_dsinterval).data_value
80
+
and
81
+
(treat(self.expected as ut_data_value_date).data_value) + treat(self.dist as ut_data_value_dsinterval).data_value;
73
82
end if;
74
83
else
75
84
l_result := (self as ut_matcher).run_matcher(a_actual);
0 commit comments