refactor: remove Flutter dep from geometry (#27)

* fix: removed flutter dependency

* test: fixed tests for assertions

* test: check assertion with isA

* ci: added geometry workflow file

* refactor: changed flame dep to vector_math for vector2

* fix: changed import for vector to vector_math_64

* Update .github/workflows/geometry.yaml

Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com>

Co-authored-by: Allison Ryan <77211884+allisonryan0002@users.noreply.github.com>
pull/28/head
Rui Miguel Alonso 4 years ago committed by GitHub
parent ffef053678
commit b73cddc1a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,18 @@
name: geometry
on:
push:
paths:
- "packages/geometry/**"
- ".github/workflows/geometry.yaml"
pull_request:
paths:
- "packages/geometry/**"
- ".github/workflows/geometry.yaml"
jobs:
build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1
with:
working_directory: packages/geometry

@ -1,5 +1,6 @@
import 'dart:math' as math;
import 'package:flame/extensions.dart';
import 'package:vector_math/vector_math_64.dart';
/// Calculates all [Vector2]s of a circumference.
///

@ -7,13 +7,9 @@ environment:
sdk: ">=2.16.0 <3.0.0"
dependencies:
flame: ^1.0.0
flutter:
sdk: flutter
vector_math: ^2.1.1
dev_dependencies:
flutter_test:
sdk: flutter
mocktail: ^0.2.0
test: ^1.19.2
very_good_analysis: ^2.4.0

@ -1,7 +1,8 @@
// ignore_for_file: prefer_const_constructors, cascade_invocations
import 'package:flame/extensions.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:geometry/geometry.dart';
import 'package:test/test.dart';
import 'package:vector_math/vector_math_64.dart';
class Binomial {
Binomial({required this.n, required this.k});
@ -42,18 +43,18 @@ void main() {
],
step: 2,
),
throwsAssertionError,
throwsA(isA<AssertionError>()),
);
});
test('fails if not enough control points', () {
expect(
() => calculateBezierCurve(controlPoints: [Vector2.zero()]),
throwsAssertionError,
throwsA(isA<AssertionError>()),
);
expect(
() => calculateBezierCurve(controlPoints: []),
throwsAssertionError,
throwsA(isA<AssertionError>()),
);
});
@ -81,15 +82,24 @@ void main() {
group('binomial', () {
test('fails if k is negative', () {
expect(() => binomial(1, -1), throwsAssertionError);
expect(
() => binomial(1, -1),
throwsA(isA<AssertionError>()),
);
});
test('fails if n is negative', () {
expect(() => binomial(-1, 1), throwsAssertionError);
expect(
() => binomial(-1, 1),
throwsA(isA<AssertionError>()),
);
});
test('fails if n < k', () {
expect(() => binomial(1, 2), throwsAssertionError);
expect(
() => binomial(1, 2),
throwsA(isA<AssertionError>()),
);
});
test('for a specific input gives a correct value', () {
@ -131,7 +141,7 @@ void main() {
group('factorial', () {
test('fails if negative number', () {
expect(() => factorial(-1), throwsAssertionError);
expect(() => factorial(-1), throwsA(isA<AssertionError>()));
});
test('for a specific input gives a correct value', () {

Loading…
Cancel
Save