From 3f5c369f0cdde75cd81b6f39fac3d768c1a609d5 Mon Sep 17 00:00:00 2001 From: gmpassos Date: Sat, 30 Sep 2023 04:17:55 -0300 Subject: [PATCH 1/4] 1.0.26 - Fix `IterableNumExtension.standardDeviation`. - sdk: '>=2.14.0 <4.0.0' - intl: ^0.18.1 - dependency_validator: ^3.2.3 --- CHANGELOG.md | 8 ++++++++ lib/src/statistics_extension_num.dart | 2 +- pubspec.yaml | 8 ++++---- test/statistics_extension_num_test.dart | 4 ++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0b5483..5164567 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.0.26 + +- Fix `IterableNumExtension.standardDeviation`. + +- sdk: '>=2.14.0 <4.0.0' +- intl: ^0.18.1 +- dependency_validator: ^3.2.3 + ## 1.0.25 - `Decimal`: diff --git a/lib/src/statistics_extension_num.dart b/lib/src/statistics_extension_num.dart index ed02f20..a1d85c1 100644 --- a/lib/src/statistics_extension_num.dart +++ b/lib/src/statistics_extension_num.dart @@ -148,7 +148,7 @@ extension IterableNumExtension on Iterable { var average = mean; - var first = itr.current; + var first = itr.current - average; var total = first * first; while (itr.moveNext()) { diff --git a/pubspec.yaml b/pubspec.yaml index b8a4d34..ff6f7b5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,20 +1,20 @@ name: statistics description: Statistics package for easy and efficient data manipulation with built-in Bayesian Network (Bayes Net), many mathematical functions and tools. -version: 1.0.25 +version: 1.0.26 homepage: https://github.com/gmpassos/statistics environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.14.0 <4.0.0' dependencies: - intl: ^0.18.0 + intl: ^0.18.1 collection: ^1.17.0 data_serializer: ^1.0.7 dev_dependencies: lints: ^2.0.1 test: ^1.24.0 - dependency_validator: ^3.2.2 + dependency_validator: ^3.2.3 coverage: ^1.6.3 #dependency_overrides: diff --git a/test/statistics_extension_num_test.dart b/test/statistics_extension_num_test.dart index 9498a58..5e80d76 100644 --- a/test/statistics_extension_num_test.dart +++ b/test/statistics_extension_num_test.dart @@ -784,8 +784,8 @@ void main() { test('standardDeviation', () { expect([].standardDeviation, equals(0)); expect([0.0].standardDeviation, equals(0)); - expect([10].standardDeviation, equals(10)); - expect([10, 20.0].standardDeviation, equals(7.905694150420948)); + expect([10].standardDeviation, equals(0)); + expect([10, 20.0].standardDeviation, equals(5.0)); expect([10.0, 20, 30.0].standardDeviation, equals(8.16496580927726)); }); From 99f3aa080d9d8553a9c8bff15e371ce6c0c74433 Mon Sep 17 00:00:00 2001 From: gmpassos Date: Sat, 30 Sep 2023 04:26:07 -0300 Subject: [PATCH 2/4] v1.0.26 - Fix: - `IterableNumExtension.standardDeviation`. - `IterableDoubleExtension.standardDeviation`. - `DecimalOnIterableDecimalExtension.standardDeviation`. - `DynamicIntOnIterableDynamicNumberExtension.standardDeviation`. - sdk: '>=2.14.0 <4.0.0' - intl: ^0.18.1 - dependency_validator: ^3.2.3 --- CHANGELOG.md | 6 +++++- lib/src/statistics_decimal.dart | 2 +- lib/src/statistics_dynamic_int.dart | 4 ++-- lib/src/statistics_extension_num.dart | 4 ++-- test/statistics_extension_num_test.dart | 8 ++++---- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5164567..164385b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## 1.0.26 -- Fix `IterableNumExtension.standardDeviation`. +- Fix: + - `IterableNumExtension.standardDeviation`. + - `IterableDoubleExtension.standardDeviation`. + - `DecimalOnIterableDecimalExtension.standardDeviation`. + - `DynamicIntOnIterableDynamicNumberExtension.standardDeviation`. - sdk: '>=2.14.0 <4.0.0' - intl: ^0.18.1 diff --git a/lib/src/statistics_decimal.dart b/lib/src/statistics_decimal.dart index 02cf7ce..0b0d4df 100644 --- a/lib/src/statistics_decimal.dart +++ b/lib/src/statistics_decimal.dart @@ -1666,7 +1666,7 @@ extension DecimalOnIterableDecimalExtension on Iterable { var average = mean; - var first = itr.current; + var first = itr.current - average; var total = first * first; while (itr.moveNext()) { diff --git a/lib/src/statistics_dynamic_int.dart b/lib/src/statistics_dynamic_int.dart index e0c5b54..876efa6 100644 --- a/lib/src/statistics_dynamic_int.dart +++ b/lib/src/statistics_dynamic_int.dart @@ -1610,7 +1610,7 @@ extension DynamicIntOnIterableDynamicNumberExtension var average = mean; - var first = itr.current; + var first = itr.current - average; var total = first * first; while (itr.moveNext()) { @@ -1690,7 +1690,7 @@ extension DynamicIntOnIterableDynamicIntExtension on Iterable { var average = mean; - var first = itr.current; + var first = itr.current - average; var total = first * first; while (itr.moveNext()) { diff --git a/lib/src/statistics_extension_num.dart b/lib/src/statistics_extension_num.dart index a1d85c1..8817d6a 100644 --- a/lib/src/statistics_extension_num.dart +++ b/lib/src/statistics_extension_num.dart @@ -439,7 +439,7 @@ extension IterableDoubleExtension on Iterable { var average = mean; - var first = itr.current; + var first = itr.current - average; var total = first * first; while (itr.moveNext()) { @@ -731,7 +731,7 @@ extension IterableIntExtension on Iterable { var average = mean; - var first = itr.current; + var first = itr.current - average; var total = (first * first).toDouble(); while (itr.moveNext()) { diff --git a/test/statistics_extension_num_test.dart b/test/statistics_extension_num_test.dart index 5e80d76..f5c03ab 100644 --- a/test/statistics_extension_num_test.dart +++ b/test/statistics_extension_num_test.dart @@ -266,8 +266,8 @@ void main() { test('standardDeviation', () { expect([].standardDeviation, equals(0)); expect([0].standardDeviation, equals(0)); - expect([10].standardDeviation, equals(10)); - expect([10, 20].standardDeviation, equals(7.905694150420948)); + expect([10].standardDeviation, equals(0)); + expect([10, 20].standardDeviation, equals(5)); expect([10, 20, 30].standardDeviation, equals(8.16496580927726)); }); @@ -551,8 +551,8 @@ void main() { test('standardDeviation', () { expect([].standardDeviation, equals(0)); expect([0.0].standardDeviation, equals(0)); - expect([10.0].standardDeviation, equals(10)); - expect([10.0, 20.0].standardDeviation, equals(7.905694150420948)); + expect([10.0].standardDeviation, equals(0)); + expect([10.0, 20.0].standardDeviation, equals(5)); expect([10.0, 20.0, 30.0].standardDeviation, equals(8.16496580927726)); }); From fe1c64234098e5f9510546b94662e92065412580 Mon Sep 17 00:00:00 2001 From: gmpassos Date: Sat, 30 Sep 2023 04:28:18 -0300 Subject: [PATCH 3/4] Update & upgrade Dart CI --- .github/workflows/dart.yml | 50 ++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index b1a6aaa..68290bb 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -9,9 +9,8 @@ on: jobs: build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 - name: Dart version run: | @@ -19,31 +18,62 @@ jobs: uname -a - name: Install dependencies run: dart pub get + - name: Upgrade dependencies + run: dart pub upgrade - name: dart format run: dart format -o none --set-exit-if-changed . - name: dart analyze run: dart analyze --fatal-infos --fatal-warnings . - name: dependency_validator run: dart run dependency_validator - - name: Run tests (VM) - run: dart test --platform vm - - name: Run tests (Chrome) - run: dart test --platform chrome - name: dart doc run: dart doc --dry-run + - name: dart pub publish --dry-run + run: dart pub publish --dry-run + + test_vm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dart-lang/setup-dart@v1 + - name: Dart version + run: | + dart --version + uname -a + - name: Install dependencies + run: dart pub get + - name: Upgrade dependencies + run: dart pub upgrade + - name: Run tests (VM) + run: dart test --platform vm --coverage=./coverage - name: Generate coverage report run: | dart pub global activate coverage - dart run test --coverage=./coverage dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --lcov -o ./coverage/lcov.info -i ./coverage - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: directory: ./coverage/ flags: unittests env_vars: OS,DART fail_ci_if_error: true verbose: true - - name: dart pub publish --dry-run - run: dart pub publish --dry-run + + test_chrome: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dart-lang/setup-dart@v1 + - name: Dart version + run: | + dart --version + uname -a + - name: Install dependencies + run: dart pub get + - name: Upgrade dependencies + run: dart pub upgrade + - name: Run tests (Chrome) + run: dart test --platform chrome From 6439230235a2947c75ef04df3bd0973e4884a14f Mon Sep 17 00:00:00 2001 From: gmpassos Date: Sat, 30 Sep 2023 04:29:46 -0300 Subject: [PATCH 4/4] Fix statistics_tools_test.dart --- test/statistics_tools_test.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/statistics_tools_test.dart b/test/statistics_tools_test.dart index 46ace5d..079e5b3 100644 --- a/test/statistics_tools_test.dart +++ b/test/statistics_tools_test.dart @@ -81,8 +81,8 @@ void main() { test('standardDeviation', () { expect([].standardDeviation, equals(0)); expect([0].standardDeviation, equals(0)); - expect([10].standardDeviation, equals(10)); - expect([10, 20].standardDeviation, equals(7.905694150420948)); + expect([10].standardDeviation, equals(0)); + expect([10, 20].standardDeviation, equals(5)); expect([10, 20, 30].standardDeviation, equals(8.16496580927726)); }); @@ -274,7 +274,7 @@ void main() { expect( chronometer.toString(), matches(RegExp( - r'^test\{ [\d.]+ \w+ · hertz: [\d.]+ Hz · ops: [\d,]+ » [\d.]+\% · ETOC: [\d.]+ \w+ · start: [\d-]+ [\d:.-]+ \.\. \d+\.\d+ \}$'))); + r'^test\{ [\d.]+ \w+ · hertz: [\d.]+ Hz · ops: [\d,]+ » [\d.]+% · ETOC: [\d.]+ \w+ · start: [\d-]+ [\d:.-]+ \.\. \d+\.\d+ \}$'))); var chronometer2 = Chronometer('test2');