Skip to content

Commit

Permalink
statistics_decimal_test.dart
Browse files Browse the repository at this point in the history
statistics_dynamic_int_test.dart
  • Loading branch information
gmpassos committed Jul 26, 2024
1 parent 39d24ec commit 42f8383
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/statistics_decimal_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,30 @@ void main() {
(~Decimal.parse('-1.00', precision: 2)).toHex(), equals('00000000'));
});

test('sin', () {
expect(Decimal.fromInt(1).sin,
equals(Decimal.fromDouble(0.8414709848078965)));
expect(Decimal.fromInt(-1).sin,
equals(Decimal.fromDouble(-0.8414709848078965)));

expect(Decimal.fromInt(10).sin,
equals(Decimal.fromDouble(-0.5440211108893699)));
expect(Decimal.fromInt(-10).sin,
equals(Decimal.fromDouble(0.5440211108893699)));
});

test('cos', () {
expect(Decimal.fromInt(1).cos,
equals(Decimal.fromDouble(0.5403023058681398)));
expect(Decimal.fromInt(-1).cos,
equals(Decimal.fromDouble(0.5403023058681398)));

expect(Decimal.fromInt(10).cos,
equals(Decimal.fromDouble(-0.8390715290764524)));
expect(Decimal.fromInt(-10).cos,
equals(Decimal.fromDouble(-0.8390715290764524)));
});

test('square', () {
expect(Decimal.parse('0').square.toString(), equals('0.0'));
expect(Decimal.parse('1').square.toString(), equals('1.0'));
Expand Down
24 changes: 24 additions & 0 deletions test/statistics_dynamic_int_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,30 @@ void main() {
equals('3.0'));
});

test('sin', () {
expect(DynamicInt.fromInt(1).sin,
equals(Decimal.fromDouble(0.8414709848078965)));
expect(DynamicInt.fromInt(-1).sin,
equals(Decimal.fromDouble(-0.8414709848078965)));

expect(DynamicInt.fromInt(10).sin,
equals(Decimal.fromDouble(-0.5440211108893699)));
expect(DynamicInt.fromInt(-10).sin,
equals(Decimal.fromDouble(0.5440211108893699)));
});

test('cos', () {
expect(DynamicInt.fromInt(1).cos,
equals(Decimal.fromDouble(0.5403023058681398)));
expect(DynamicInt.fromInt(-1).cos,
equals(Decimal.fromDouble(0.5403023058681398)));

expect(DynamicInt.fromInt(10).cos,
equals(Decimal.fromDouble(-0.8390715290764524)));
expect(DynamicInt.fromInt(-10).cos,
equals(Decimal.fromDouble(-0.8390715290764524)));
});

test('square', () {
expect(1.toDynamicInt().square.toString(), equals('1'));
expect(10.toDynamicInt().square.toString(), equals('100'));
Expand Down

0 comments on commit 42f8383

Please sign in to comment.