The real world is messy. Egret supports various ways for an expectation to match a range of values.
For the related topic on matching property names / column names please see the munging article.
Strings (text, names, labels) are have two options. They can either be:
- a normal string:
hello
, or"hello"
(quoted) if special characters are used- must match exactly, other than by case (they are case-insensitive)
- or a regular expression:
/bo+/
- denoted by a forward slash at the start, and one at the end
Regular expressions allow us to match wildcards (and many other complex patterns). An example:
/^boo.*/
means match any text that starts with boo and will match
boobook
boobird
booted eagle
booby
A discussion on regular expressions are outside the scope of this article. See this guide for more help: https://regexone.com/.
In general any numeric field on a test, as well as all coordinates for events and segments will accept a variety of syntaxes, including:
- literal values:
1.0
,1
,-1.23
,0.0023
- exponential notation:
4.56e3
,-1E-6
- constants:
ε
,∞
,-∞
- inequality relations:
>
,<
,≥
,≤
- tolerances:
±
- approximations:
~
,≈
- intervals:
[x1, x2]
,(x1, x2]
,[x1, x2)
,(x1, x2)
This syntax allows for a wide range of concepts to be encoded in a dense format. We think this density makes large test-sets easy to work with.
A formal grammar for this syntax is defined interval.ebnf and is shown below.
However, the easiest method of working with this notation is to just look through the examples.
References: number, tolerance, relation, interval, approximation
Used by: expression References: number
Examples:
1.23±0.2
within 0.2 of 1.231.23±ε
➡ within epsilon (the smallest relevant value) of 1.23
Used by: expression References: number
Examples:
>1.23
➡ greater than 1.23<1.23
➡ less than 1.23≥1.23
➡ greater or equal to 1.23≤1.23
➡ less or equal to 1.23
Used by: expression References: number
Examples:
~1.23
➡ loosely approximate (within an order of magnitude) to 1.23 ➡(0.123, 12.3)
- useful for logarithmic values
≈1.23
➡ approximately equal to 1.23. Defined as within5%
of target value≈1.23
➡(1.16, 1.29)
≈11025
➡(10473, 11576)
Used by: expression References: number
Examples:
[1.2, 1.3]
➡ a value that lies between1.2
and1.3
, including endpoints ➡1.2 ≤ x ≤ 1.3
[1.2, 1.3)
➡ a value that lies between1.2
and1.3
, including min, excluding max ➡1.2 ≤ x < 1.3
(1.2, 1.3]
➡ a value that lies between1.2
and1.3
, excluding min, including max ➡1.2 < x ≤ 1.3
(1.2, 1.3)
➡ a value that lies between1.2
and1.3
, excluding endpoints ➡1.2 < x < 1.3
Used by: expression, tolerance, relation, approximation, interval References: constant, real
Any number, including our constants:
Examples:
-1.23
1.23
0.0
∞
Used by: number
Examples:
ε
➡ the smallest representable value. This value is0.001
currently- variable in the app configuration
- used to ignore floating point or rounding errors
- can be used as a value itself, or more commonly as a threshold
- think of it as computers are weird, it is close enough
∞
➡ Positive infinity-∞
➡ Negative infinity
Used by: number References: pos, neg, zero
Used by: real, neg References: digit
Used by: pos