From 1fc31037fe0bed89c6fb3809c936bf2d8538c703 Mon Sep 17 00:00:00 2001 From: Aaron Madlon-Kay Date: Wed, 3 Jul 2024 15:52:15 +0900 Subject: [PATCH] Improve test comparison --- test/data_test.dart | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test/data_test.dart b/test/data_test.dart index 9ae8a1a..028a619 100644 --- a/test/data_test.dart +++ b/test/data_test.dart @@ -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);