Skip to content

Commit

Permalink
Merge pull request #46 from skunkteam/aggregation-sumarea-floating-po…
Browse files Browse the repository at this point in the history
…int-fix

fix: Adjusted floating point comparison in aggregation queries tests.
  • Loading branch information
pavadeli authored Mar 18, 2024
2 parents 65ffb72 + 6f79068 commit f073cb2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test-suite/tests/2-basic-query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ describe('aggregation queries', () => {
const sumArea = fs.exported.AggregateField.sum('area');
await expect(getAggregate(allCities.aggregate({ sumArea }))).resolves.toEqual({
// Known current limitation of the Rust emulator, depending of the order of the aggregation we
// either get the first or the second number (you know, floating point).
sumArea: expect.toBeWithin(308.4, 308.40000000000003),
// either get the exact sum of 308.4 or slightly more (you know, floating point).
sumArea: expect.toBeWithin(308.4, 308.4000001),
});

await expect(getAggregate(biggerCities.aggregate({ sumArea }))).resolves.toEqual({
Expand All @@ -434,8 +434,8 @@ describe('aggregation queries', () => {
await expect(getAggregate(allCities.aggregate(fields))).resolves.toEqual({
count: 4,
// Known current limitation of the Rust emulator, depending of the order of the aggregation we
// either get the first or the second number (you know, floating point).
sumArea: expect.toBeWithin(308.4, 308.40000000000003),
// either get the exact sum of 308.4 or slightly more (you know, floating point).
sumArea: expect.toBeWithin(308.4, 308.4000001),
averagePopulation: 62_499,
});

Expand Down

0 comments on commit f073cb2

Please sign in to comment.