Skip to content

Commit 913455b

Browse files
Uncomment reduce tests and add more tests for min/max (#374)
1 parent 8d6a551 commit 913455b

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

query/language/reduce.feature

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ Feature: TypeQL Reduce Queries
142142
Then result is a single row with variable 'red_var': value:<val_type>:<red_val>
143143

144144
Examples:
145-
| attr | type | val1 | val2 | val3 | reduction | val_type | red_val |
146-
| age | integer | 6 | 30 | 14 | sum | integer | 50 |
147-
| weight | double | 61.8 | 86.5 | 24.8 | sum | double | 173.1 |
148-
145+
| attr | type | val1 | val2 | val3 | reduction | val_type | red_val |
146+
| age | integer | 6 | 30 | 14 | sum | integer | 50 |
147+
| weight | double | 61.8 | 86.5 | 24.8 | sum | double | 173.1 |
148+
| bank-balance | decimal | 61.8dec | 86.5dec | 24.8dec | sum | decimal | 173.1dec |
149149

150150
Scenario Outline: the <reduction> of an answer set of '<type>' must be assigned to an optional variable
151151
Given connection open schema transaction for database: typedb
@@ -176,15 +176,27 @@ Feature: TypeQL Reduce Queries
176176
Then result is a single row with variable 'red_var': value:<val_type>:<red_val>
177177

178178
Examples:
179-
| attr | type | val1 | val2 | val3 | reduction | val_type | red_val |
180-
| age | integer | 6 | 30 | 14 | max | integer | 30 |
181-
| age | integer | 6 | 30 | 14 | min | integer | 6 |
182-
| age | integer | 6 | 30 | 14 | mean | double | 16.6667 |
183-
| age | integer | 6 | 30 | 14 | median | double | 14 |
184-
| weight | double | 61.8 | 86.5 | 24.8 | max | double | 86.5 |
185-
| weight | double | 61.8 | 86.5 | 24.8 | min | double | 24.8 |
186-
| weight | double | 61.8 | 86.5 | 24.8 | mean | double | 57.7 |
187-
| weight | double | 61.8 | 86.5 | 24.8 | median | double | 61.8 |
179+
| attr | type | val1 | val2 | val3 | reduction | val_type | red_val |
180+
| age | integer | 6 | 30 | 14 | max | integer | 30 |
181+
| age | integer | 6 | 30 | 14 | min | integer | 6 |
182+
| age | integer | 6 | 30 | 14 | mean | double | 16.6667 |
183+
| age | integer | 6 | 30 | 14 | median | double | 14 |
184+
| weight | double | 61.8 | 86.5 | 24.8 | max | double | 86.5 |
185+
| weight | double | 61.8 | 86.5 | 24.8 | min | double | 24.8 |
186+
| weight | double | 61.8 | 86.5 | 24.8 | mean | double | 57.7 |
187+
| weight | double | 61.8 | 86.5 | 24.8 | median | double | 61.8 |
188+
| bank-balance | decimal | 61.8dec | 86.5dec | 24.8dec | max | decimal | 86.5dec |
189+
| bank-balance | decimal | 61.8dec | 86.5dec | 24.8dec | min | decimal | 24.8dec |
190+
| bank-balance | decimal | 61.8dec | 86.5dec | 24.8dec | mean | decimal | 57.7dec |
191+
| bank-balance | decimal | 61.8dec | 86.5dec | 24.8dec | median | decimal | 61.8dec |
192+
| name | string | "Alice" | "Gina" | "Talia" | max | string | "Talia" |
193+
| name | string | "Alice" | "Gina" | "Talia" | min | string | "Alice" |
194+
| birth-date | date | 2000-12-01 | 2001-11-11 | 2003-03-03 | max | date | 2003-03-03 |
195+
| birth-date | date | 2000-12-01 | 2001-11-11 | 2003-03-03 | min | date | 2000-12-01 |
196+
| birth-datetime | datetime | 2000-12-01T12:00:00 | 2001-11-11T12:34:56 | 2003-03-03T00:00:01 | max | datetime | 2003-03-03T00:00:01 |
197+
| birth-datetime | datetime | 2000-12-01T12:00:00 | 2001-11-11T12:34:56 | 2003-03-03T00:00:01 | min | datetime | 2000-12-01T12:00:00 |
198+
| birth-datetime-tz | datetime-tz | 2000-12-01T12:00:00Z | 2001-11-11T12:34:56+12:00 | 2003-03-03T00:00:01-13:00 | max | datetime-tz | 2003-03-03T00:00:01-13:00 |
199+
| birth-datetime-tz | datetime-tz | 2000-12-01T12:00:00Z | 2001-11-11T12:34:56+12:00 | 2003-03-03T00:00:01-13:00 | min | datetime-tz | 2000-12-01T12:00:00Z |
188200

189201

190202
Scenario: the sample standard deviation can be retrieved for an answer set of 'double' values
@@ -366,7 +378,6 @@ Feature: TypeQL Reduce Queries
366378
reduce $min = min($x);
367379
"""
368380

369-
# TODO: 3.x: Commented out rows in the example table
370381
Scenario Outline: an error is thrown when getting the '<reduction>' of attributes that have the inapplicable type, '<type>'
371382
Given connection open schema transaction for database: typedb
372383
Given typeql schema query
@@ -395,7 +406,7 @@ Feature: TypeQL Reduce Queries
395406
| attr | type | value | reduction |
396407
| name | string | "Talia" | sum |
397408
| is-awake | boolean | true | sum |
398-
# | birth-date | datetime | 2000-01-01 | sum |
409+
| birth-date | datetime | 2000-01-01 | sum |
399410

400411

401412
Scenario Outline: an error is thrown when getting the fallible '<reduction>' of attributes that have the inapplicable type, '<type>'
@@ -424,8 +435,6 @@ Feature: TypeQL Reduce Queries
424435
"""
425436
Examples:
426437
| attr | type | value | reduction |
427-
| name | string | "Talia" | max |
428-
| name | string | "Talia" | min |
429438
| name | string | "Talia" | mean |
430439
| name | string | "Talia" | median |
431440
| name | string | "Talia" | std |
@@ -434,11 +443,9 @@ Feature: TypeQL Reduce Queries
434443
| is-awake | boolean | true | mean |
435444
| is-awake | boolean | true | median |
436445
| is-awake | boolean | true | std |
437-
# | birth-date | datetime | 2000-01-01 | max |
438-
# | birth-date | datetime | 2000-01-01 | min |
439-
# | birth-date | datetime | 2000-01-01 | mean |
440-
# | birth-date | datetime | 2000-01-01 | median |
441-
# | birth-date | datetime | 2000-01-01 | std |
446+
| birth-date | datetime | 2000-01-01 | mean |
447+
| birth-date | datetime | 2000-01-01 | median |
448+
| birth-date | datetime | 2000-01-01 | std |
442449

443450

444451
Scenario: when taking the sum of a set of attributes, where some are numeric and others are strings, an error is thrown

0 commit comments

Comments
 (0)