Skip to content

Commit

Permalink
Improve test comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
amake committed Jul 3, 2024
1 parent 068fc70 commit 1fc3103
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions test/data_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ void main() {

test('distributions', () {
const epsilon = 1e-10;
expectEpsilon(ios.distribution.reduce((a, b) => a + b), 1,
epsilon: epsilon);
expectEpsilon(android.distribution.reduce((a, b) => a + b), 1,
epsilon: epsilon);
expect(ios.distribution.reduce((a, b) => a + b), closeTo(1, epsilon));
expect(android.distribution.reduce((a, b) => a + b), closeTo(1, epsilon));
});
}

void expectEpsilon(num actual, num matcher, {required double epsilon}) =>
expect(true, (matcher - actual).abs() < epsilon);

0 comments on commit 1fc3103

Please sign in to comment.