Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.0.26 - fix stdv #8

Merged
merged 4 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 40 additions & 10 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,71 @@ 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: |
dart --version
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 1.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

## 1.0.25

- `Decimal`:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/statistics_decimal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ extension DecimalOnIterableDecimalExtension on Iterable<Decimal> {

var average = mean;

var first = itr.current;
var first = itr.current - average;
var total = first * first;

while (itr.moveNext()) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/statistics_dynamic_int.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -1690,7 +1690,7 @@ extension DynamicIntOnIterableDynamicIntExtension on Iterable<DynamicInt> {

var average = mean;

var first = itr.current;
var first = itr.current - average;
var total = first * first;

while (itr.moveNext()) {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/statistics_extension_num.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ extension IterableNumExtension on Iterable<num> {

var average = mean;

var first = itr.current;
var first = itr.current - average;
var total = first * first;

while (itr.moveNext()) {
Expand Down Expand Up @@ -439,7 +439,7 @@ extension IterableDoubleExtension on Iterable<double> {

var average = mean;

var first = itr.current;
var first = itr.current - average;
var total = first * first;

while (itr.moveNext()) {
Expand Down Expand Up @@ -731,7 +731,7 @@ extension IterableIntExtension on Iterable<int> {

var average = mean;

var first = itr.current;
var first = itr.current - average;
var total = (first * first).toDouble();

while (itr.moveNext()) {
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
12 changes: 6 additions & 6 deletions test/statistics_extension_num_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ void main() {
test('standardDeviation', () {
expect(<int>[].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(<int>[10, 20, 30].standardDeviation, equals(8.16496580927726));
});

Expand Down Expand Up @@ -551,8 +551,8 @@ void main() {
test('standardDeviation', () {
expect(<double>[].standardDeviation, equals(0));
expect(<double>[0.0].standardDeviation, equals(0));
expect(<double>[10.0].standardDeviation, equals(10));
expect(<double>[10.0, 20.0].standardDeviation, equals(7.905694150420948));
expect(<double>[10.0].standardDeviation, equals(0));
expect(<double>[10.0, 20.0].standardDeviation, equals(5));
expect(<double>[10.0, 20.0, 30.0].standardDeviation,
equals(8.16496580927726));
});
Expand Down Expand Up @@ -784,8 +784,8 @@ void main() {
test('standardDeviation', () {
expect(<num>[].standardDeviation, equals(0));
expect(<num>[0.0].standardDeviation, equals(0));
expect(<num>[10].standardDeviation, equals(10));
expect(<num>[10, 20.0].standardDeviation, equals(7.905694150420948));
expect(<num>[10].standardDeviation, equals(0));
expect(<num>[10, 20.0].standardDeviation, equals(5.0));
expect(<num>[10.0, 20, 30.0].standardDeviation, equals(8.16496580927726));
});

Expand Down
6 changes: 3 additions & 3 deletions test/statistics_tools_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ void main() {
test('standardDeviation', () {
expect(<int>[].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));
});

Expand Down Expand Up @@ -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');

Expand Down