Remove lints from analysis_options, fix strong-mode for tests,
bump SDK version because of generic methods
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 11d4a14..3ab0961 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,101 +1,4 @@
analyzer:
strong-mode:
implicit-dynamic: False
- implicit-casts: False
- exclude:
- - test
-
-linter:
- rules:
- - always_declare_return_types
- - always_put_control_body_on_new_line
- - always_require_non_null_named_parameters
- - always_specify_types
- - annotate_overrides
-# - avoid_annotating_with_dynamic
- - avoid_as
- - avoid_catches_without_on_clauses
- - avoid_catching_errors
- - avoid_classes_with_only_static_members
- - avoid_empty_else
- - avoid_function_literals_in_foreach_calls
- - avoid_init_to_null
- - avoid_null_checks_in_equality_operators
- - avoid_positional_boolean_parameters
- - avoid_return_types_on_setters
-# - avoid_returning_null
- - avoid_returning_this
- - avoid_setters_without_getters
- - avoid_slow_async_io
-# - avoid_types_on_closure_parameters
- - await_only_futures
- - camel_case_types
- - cancel_subscriptions
- - cascade_invocations
- - close_sinks
-# - comment_references
-# - constant_identifier_names
- - control_flow_in_finally
- - directives_ordering
- - empty_catches
- - empty_constructor_bodies
- - empty_statements
- - hash_and_equals
- - implementation_imports
- - invariant_booleans
- - iterable_contains_unrelated_type
- - join_return_with_assignment
- - library_names
- - library_prefixes
- - list_remove_unrelated_type
- - literal_only_boolean_expressions
- - no_adjacent_strings_in_list
- - no_duplicate_case_values
-# - non_constant_identifier_names
-# - omit_local_variable_types
- - one_member_abstracts
- - only_throw_errors
- - overridden_fields
- - package_api_docs
- - package_names
- - package_prefixed_library_names
-# - parameter_assignments
- - prefer_adjacent_string_concatenation
- - prefer_collection_literals
- - prefer_conditional_assignment
- - prefer_const_constructors
- - prefer_constructors_over_static_methods
- - prefer_contains
- - prefer_expression_function_bodies
- - prefer_final_fields
- - prefer_final_locals
- - prefer_foreach
- - prefer_function_declarations_over_variables
- - prefer_initializing_formals
-# - prefer_interpolation_to_compose_strings
- - prefer_is_empty
- - prefer_is_not_empty
-# - public_member_api_docs
- - recursive_getters
- - slash_for_doc_comments
-# - sort_constructors_first
-# - sort_unnamed_constructors_first
- - super_goes_last
- - test_types_in_equals
- - throw_in_finally
- - type_annotate_public_apis
- - type_init_formals
- - unawaited_futures
- - unnecessary_brace_in_string_interps
-# - unnecessary_getters_setters
- - unnecessary_lambdas
- - unnecessary_null_aware_assignments
- - unnecessary_null_in_if_null_operators
- - unnecessary_overrides
- - unnecessary_this
- - unrelated_type_equality_checks
- - use_rethrow_when_possible
- - use_setters_to_change_properties
- - use_string_buffers
-# - use_to_and_as_if_applicable
- - valid_regexps
\ No newline at end of file
+ implicit-casts: False
\ No newline at end of file
diff --git a/pubspec.yaml b/pubspec.yaml
index 07405bd..66cfa86 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -4,7 +4,7 @@
description: A Vector Math library for 2D and 3D applications.
homepage: https://github.com/google/vector_math.dart
environment:
- sdk: '>=1.0.0 <2.0.0'
+ sdk: '>=1.21.0 <2.0.0'
dev_dependencies:
benchmark_harness: any
browser: any
diff --git a/test/geometry_test.dart b/test/geometry_test.dart
index 93b1603..15f6990 100644
--- a/test/geometry_test.dart
+++ b/test/geometry_test.dart
@@ -80,7 +80,7 @@
MeshGeometry cube = filterUnitCube(filter);
// Check to ensure all the vertices were properly scaled
- Vector3List positions = cube.getViewForAttrib("POSITION");
+ Vector3List positions = cube.getViewForAttrib("POSITION") as Vector3List;
for (int i = 0; i < positions.length; ++i) {
Vector3 position = positions[i];
expect(position.storage[0].abs(), equals(2.0));
@@ -115,7 +115,7 @@
MeshGeometry cube = filterUnitCube(filter);
// Ensure that the same color was applied to all vertices
- Vector4List colors = cube.getViewForAttrib("COLOR");
+ Vector4List colors = cube.getViewForAttrib("COLOR") as Vector4List;
for (int i = 0; i < colors.length; ++i) {
Vector4 color = colors[i];
relativeTest(color, filterColor);
diff --git a/test/matrix2_test.dart b/test/matrix2_test.dart
index c237906..2c7b194 100644
--- a/test/matrix2_test.dart
+++ b/test/matrix2_test.dart
@@ -13,17 +13,18 @@
import 'test_utils.dart';
void testMatrix2Adjoint() {
- var input = new List();
- var expectedOutput = new List();
+ var input = new List<Matrix2>();
+ var expectedOutput = new List<Matrix2>();
- input.add(parseMatrix('''0.830828627896291 0.549723608291140
- 0.585264091152724 0.917193663829810'''));
- expectedOutput.add(parseMatrix(''' 0.917193663829810 -0.549723608291140
- -0.585264091152724 0.830828627896291'''));
- input.add(parseMatrix(''' 1 0
- 0 1'''));
- expectedOutput.add(parseMatrix(''' 1 0
+ input.add(parseMatrix<Matrix2>('''0.830828627896291 0.549723608291140
+ 0.585264091152724 0.917193663829810'''));
+ expectedOutput
+ .add(parseMatrix<Matrix2>(''' 0.917193663829810 -0.549723608291140
+ -0.585264091152724 0.830828627896291'''));
+ input.add(parseMatrix<Matrix2>(''' 1 0
0 1'''));
+ expectedOutput.add(parseMatrix<Matrix2>(''' 1 0
+ 0 1'''));
assert(input.length == expectedOutput.length);
@@ -35,11 +36,11 @@
}
void testMatrix2Determinant() {
- var input = new List();
+ var input = new List<Matrix2>();
List<double> expectedOutput = new List<double>();
- input.add(parseMatrix('''0.830828627896291 0.549723608291140
- 0.585264091152724 0.917193663829810'''));
+ input.add(parseMatrix<Matrix2>('''0.830828627896291 0.549723608291140
+ 0.585264091152724 0.917193663829810'''));
expectedOutput.add(0.440297265243183);
assert(input.length == expectedOutput.length);
diff --git a/test/matrix3_test.dart b/test/matrix3_test.dart
index e225cef..5721a3b 100644
--- a/test/matrix3_test.dart
+++ b/test/matrix3_test.dart
@@ -13,47 +13,47 @@
import 'test_utils.dart';
void testMatrix3Adjoint() {
- var input = new List();
- var expectedOutput = new List();
+ var input = new List<dynamic>();
+ var expectedOutput = new List<dynamic>();
- input.add(
- parseMatrix(''' 0.285839018820374 0.380445846975357 0.053950118666607
+ input.add(parseMatrix<Matrix3>(
+ ''' 0.285839018820374 0.380445846975357 0.053950118666607
0.757200229110721 0.567821640725221 0.530797553008973
0.753729094278495 0.075854289563064 0.779167230102011'''));
- expectedOutput.add(
- parseMatrix(''' 0.402164743710542 -0.292338588868304 0.171305679728352
+ expectedOutput.add(parseMatrix<Matrix3>(
+ ''' 0.402164743710542 -0.292338588868304 0.171305679728352
-0.189908046274114 0.182052622470548 -0.110871609529434
-0.370546805539367 0.265070987960728 -0.125768101844091'''));
- input.add(parseMatrix('''1 0 0
- 0 1 0
- 0 0 1'''));
- expectedOutput.add(parseMatrix('''1 0 0
+ input.add(parseMatrix<Matrix3>('''1 0 0
0 1 0
0 0 1'''));
- input.add(parseMatrix('''1 0 0 0
- 0 1 0 0
- 0 0 1 0
- 0 0 0 1'''));
- expectedOutput.add(parseMatrix('''1 0 0 0
+ expectedOutput.add(parseMatrix<Matrix3>('''1 0 0
+ 0 1 0
+ 0 0 1'''));
+ input.add(parseMatrix<Matrix4>('''1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1'''));
+ expectedOutput.add(parseMatrix<Matrix4>('''1 0 0 0
+ 0 1 0 0
+ 0 0 1 0
+ 0 0 0 1'''));
assert(input.length == expectedOutput.length);
for (int i = 0; i < input.length; i++) {
- var output = input[i].clone();
+ dynamic output = input[i].clone();
output.scaleAdjoint(1.0);
relativeTest(output, expectedOutput[i]);
}
}
void testMatrix3Determinant() {
- var input = new List();
+ var input = new List<Matrix3>();
List<double> expectedOutput = new List<double>();
- input.add(
- parseMatrix('''0.285839018820374 0.380445846975357 0.053950118666607
+ input.add(parseMatrix<Matrix3>(
+ '''0.285839018820374 0.380445846975357 0.053950118666607
0.757200229110721 0.567821640725221 0.530797553008973
0.753729094278495 0.075854289563064 0.779167230102011'''));
expectedOutput.add(0.022713604103796);
@@ -68,33 +68,33 @@
}
void testMatrix3SelfTransposeMultiply() {
- var inputA = new List();
- var inputB = new List();
- var expectedOutput = new List();
+ var inputA = new List<Matrix3>();
+ var inputB = new List<Matrix3>();
+ var expectedOutput = new List<Matrix3>();
- inputA.add(
- parseMatrix('''0.084435845510910 0.800068480224308 0.181847028302852
+ inputA.add(parseMatrix<Matrix3>(
+ '''0.084435845510910 0.800068480224308 0.181847028302852
0.399782649098896 0.431413827463545 0.263802916521990
0.259870402850654 0.910647594429523 0.145538980384717'''));
- inputB.add(
- parseMatrix('''0.136068558708664 0.549860201836332 0.622055131485066
+ inputB.add(parseMatrix<Matrix3>(
+ '''0.136068558708664 0.549860201836332 0.622055131485066
0.869292207640089 0.144954798223727 0.350952380892271
0.579704587365570 0.853031117721894 0.513249539867053'''));
- expectedOutput.add(
- parseMatrix('''0.509665070066463 0.326055864494860 0.326206788210183
+ expectedOutput.add(parseMatrix<Matrix3>(
+ '''0.509665070066463 0.326055864494860 0.326206788210183
1.011795431418814 1.279272055656899 1.116481872383158
0.338435097301446 0.262379221330899 0.280398953455993'''));
- inputA.add(
- parseMatrix('''0.136068558708664 0.549860201836332 0.622055131485066
+ inputA.add(parseMatrix<Matrix3>(
+ '''0.136068558708664 0.549860201836332 0.622055131485066
0.869292207640089 0.144954798223727 0.350952380892271
0.579704587365570 0.853031117721894 0.513249539867053'''));
- inputB.add(
- parseMatrix('''0.084435845510910 0.800068480224308 0.181847028302852
+ inputB.add(parseMatrix<Matrix3>(
+ '''0.084435845510910 0.800068480224308 0.181847028302852
0.399782649098896 0.431413827463545 0.263802916521990
0.259870402850654 0.910647594429523 0.145538980384717'''));
- expectedOutput.add(
- parseMatrix('''0.509665070066463 1.011795431418814 0.338435097301446
+ expectedOutput.add(parseMatrix<Matrix3>(
+ '''0.509665070066463 1.011795431418814 0.338435097301446
0.326055864494860 1.279272055656899 0.262379221330899
0.326206788210183 1.116481872383158 0.280398953455993'''));
assert(inputA.length == inputB.length);
@@ -108,33 +108,33 @@
}
void testMatrix3SelfMultiply() {
- var inputA = new List();
- var inputB = new List();
- var expectedOutput = new List();
+ var inputA = new List<Matrix3>();
+ var inputB = new List<Matrix3>();
+ var expectedOutput = new List<Matrix3>();
- inputA.add(
- parseMatrix('''0.084435845510910 0.800068480224308 0.181847028302852
+ inputA.add(parseMatrix<Matrix3>(
+ '''0.084435845510910 0.800068480224308 0.181847028302852
0.399782649098896 0.431413827463545 0.263802916521990
0.259870402850654 0.910647594429523 0.145538980384717'''));
- inputB.add(
- parseMatrix('''0.136068558708664 0.549860201836332 0.622055131485066
+ inputB.add(parseMatrix<Matrix3>(
+ '''0.136068558708664 0.549860201836332 0.622055131485066
0.869292207640089 0.144954798223727 0.350952380892271
0.579704587365570 0.853031117721894 0.513249539867053'''));
- expectedOutput.add(
- parseMatrix('''0.812399915745417 0.317522849978516 0.426642592595554
+ expectedOutput.add(parseMatrix<Matrix3>(
+ '''0.812399915745417 0.317522849978516 0.426642592595554
0.582350288210078 0.507392169174135 0.535489283769338
0.911348663480233 0.399044409575883 0.555945473748377'''));
- inputA.add(
- parseMatrix('''0.136068558708664 0.549860201836332 0.622055131485066
+ inputA.add(parseMatrix<Matrix3>(
+ '''0.136068558708664 0.549860201836332 0.622055131485066
0.869292207640089 0.144954798223727 0.350952380892271
0.579704587365570 0.853031117721894 0.513249539867053'''));
- inputB.add(
- parseMatrix('''0.084435845510910 0.800068480224308 0.181847028302852
+ inputB.add(parseMatrix<Matrix3>(
+ '''0.084435845510910 0.800068480224308 0.181847028302852
0.399782649098896 0.431413827463545 0.263802916521990
0.259870402850654 0.910647594429523 0.145538980384717'''));
- expectedOutput.add(
- parseMatrix('''0.392967349540540 0.912554468305858 0.260331657549835
+ expectedOutput.add(parseMatrix<Matrix3>(
+ '''0.392967349540540 0.912554468305858 0.260331657549835
0.222551972385485 1.077622741167203 0.247394954900102
0.523353251675581 1.299202246456530 0.405147467960185'''));
assert(inputA.length == inputB.length);
@@ -148,33 +148,33 @@
}
void testMatrix3SelfMultiplyTranspose() {
- var inputA = new List();
- var inputB = new List();
- var expectedOutput = new List();
+ var inputA = new List<Matrix3>();
+ var inputB = new List<Matrix3>();
+ var expectedOutput = new List<Matrix3>();
- inputA.add(
- parseMatrix('''0.084435845510910 0.800068480224308 0.181847028302852
+ inputA.add(parseMatrix<Matrix3>(
+ '''0.084435845510910 0.800068480224308 0.181847028302852
0.399782649098896 0.431413827463545 0.263802916521990
0.259870402850654 0.910647594429523 0.145538980384717'''));
- inputB.add(
- parseMatrix('''0.136068558708664 0.549860201836332 0.622055131485066
+ inputB.add(parseMatrix<Matrix3>(
+ '''0.136068558708664 0.549860201836332 0.622055131485066
0.869292207640089 0.144954798223727 0.350952380892271
0.579704587365570 0.853031117721894 0.513249539867053'''));
- expectedOutput.add(
- parseMatrix('''0.564533756922142 0.253192835205285 0.824764060523193
+ expectedOutput.add(parseMatrix<Matrix3>(
+ '''0.564533756922142 0.253192835205285 0.824764060523193
0.455715101026938 0.502645707562004 0.735161980594196
0.626622330821134 0.408983306176468 1.002156614695209'''));
- inputA.add(
- parseMatrix('''0.136068558708664 0.549860201836332 0.622055131485066
+ inputA.add(parseMatrix<Matrix3>(
+ '''0.136068558708664 0.549860201836332 0.622055131485066
0.869292207640089 0.144954798223727 0.350952380892271
0.579704587365570 0.853031117721894 0.513249539867053'''));
- inputB.add(
- parseMatrix('''0.084435845510910 0.800068480224308 0.181847028302852
+ inputB.add(parseMatrix<Matrix3>(
+ '''0.084435845510910 0.800068480224308 0.181847028302852
0.399782649098896 0.431413827463545 0.263802916521990
0.259870402850654 0.910647594429523 0.145538980384717'''));
- expectedOutput.add(
- parseMatrix('''0.564533756922142 0.455715101026938 0.626622330821134
+ expectedOutput.add(parseMatrix<Matrix3>(
+ '''0.564533756922142 0.455715101026938 0.626622330821134
0.253192835205285 0.502645707562004 0.408983306176468
0.824764060523193 0.735161980594196 1.002156614695209'''));
assert(inputA.length == inputB.length);
diff --git a/test/matrix4_test.dart b/test/matrix4_test.dart
index 2fe67d5..14254ea 100644
--- a/test/matrix4_test.dart
+++ b/test/matrix4_test.dart
@@ -118,9 +118,9 @@
}
void testMatrix4Transpose() {
- var inputA = new List();
- var expectedOutput = new List();
- inputA.add(parseMatrix(
+ var inputA = new List<Matrix4>();
+ var expectedOutput = new List<Matrix4>();
+ inputA.add(parseMatrix<Matrix4>(
'''0.337719409821377 0.780252068321138 0.096454525168389 0.575208595078466
0.900053846417662 0.389738836961253 0.131973292606335 0.059779542947156
0.369246781120215 0.241691285913833 0.942050590775485 0.234779913372406
@@ -134,93 +134,93 @@
}
void testMatrix4VectorMultiplication() {
- var inputA = new List();
- var inputB = new List();
- var expectedOutput = new List();
+ var inputA = new List<Matrix4>();
+ var inputB = new List<Vector4>();
+ var expectedOutput = new List<Vector4>();
- inputA.add(parseMatrix(
+ inputA.add(parseMatrix<Matrix4>(
'''0.337719409821377 0.780252068321138 0.096454525168389 0.575208595078466
0.900053846417662 0.389738836961253 0.131973292606335 0.059779542947156
0.369246781120215 0.241691285913833 0.942050590775485 0.234779913372406
0.111202755293787 0.403912145588115 0.956134540229802 0.353158571222071'''));
- inputB.add(parseVector('''0.821194040197959
- 0.015403437651555
- 0.043023801657808
- 0.168990029462704'''));
- expectedOutput.add(parseVector('''0.390706088480722
- 0.760902311900085
- 0.387152194918898
- 0.198357495624973'''));
+ inputB.add(parseVector<Vector4>('''0.821194040197959
+ 0.015403437651555
+ 0.043023801657808
+ 0.168990029462704'''));
+ expectedOutput.add(parseVector<Vector4>('''0.390706088480722
+ 0.760902311900085
+ 0.387152194918898
+ 0.198357495624973'''));
assert(inputA.length == inputB.length);
assert(expectedOutput.length == inputB.length);
for (int i = 0; i < inputA.length; i++) {
- var output = inputA[i] * inputB[i];
+ var output = inputA[i] * inputB[i] as Vector4;
relativeTest(output, expectedOutput[i]);
}
}
void testMatrix4Multiplication() {
- var inputA = new List();
- var inputB = new List();
- var expectedOutput = new List();
+ var inputA = new List<Matrix4>();
+ var inputB = new List<Matrix4>();
+ var expectedOutput = new List<Matrix4>();
- inputA.add(parseMatrix(
+ inputA.add(parseMatrix<Matrix4>(
'''0.587044704531417 0.230488160211558 0.170708047147859 0.923379642103244
- 0.207742292733028 0.844308792695389 0.227664297816554 0.430207391329584
- 0.301246330279491 0.194764289567049 0.435698684103899 0.184816320124136
- 0.470923348517591 0.225921780972399 0.311102286650413 0.904880968679893'''));
- inputB.add(parseMatrix(
+ 0.207742292733028 0.844308792695389 0.227664297816554 0.430207391329584
+ 0.301246330279491 0.194764289567049 0.435698684103899 0.184816320124136
+ 0.470923348517591 0.225921780972399 0.311102286650413 0.904880968679893'''));
+ inputB.add(parseMatrix<Matrix4>(
'''0.979748378356085 0.408719846112552 0.711215780433683 0.318778301925882
- 0.438869973126103 0.594896074008614 0.221746734017240 0.424166759713807
- 0.111119223440599 0.262211747780845 0.117417650855806 0.507858284661118
- 0.258064695912067 0.602843089382083 0.296675873218327 0.085515797090044'''));
- expectedOutput.add(parseMatrix(
+ 0.438869973126103 0.594896074008614 0.221746734017240 0.424166759713807
+ 0.111119223440599 0.262211747780845 0.117417650855806 0.507858284661118
+ 0.258064695912067 0.602843089382083 0.296675873218327 0.085515797090044'''));
+ expectedOutput.add(parseMatrix<Matrix4>(
'''0.933571062150012 0.978468014433530 0.762614053950618 0.450561572247979
- 0.710396171182635 0.906228190244263 0.489336274658484 0.576762187862375
- 0.476730868989407 0.464650419830879 0.363428748133464 0.415721232510293
- 0.828623949506267 0.953951612073692 0.690010785130483 0.481326146122225'''));
+ 0.710396171182635 0.906228190244263 0.489336274658484 0.576762187862375
+ 0.476730868989407 0.464650419830879 0.363428748133464 0.415721232510293
+ 0.828623949506267 0.953951612073692 0.690010785130483 0.481326146122225'''));
assert(inputA.length == inputB.length);
assert(expectedOutput.length == inputB.length);
for (int i = 0; i < inputA.length; i++) {
- var output = inputA[i] * inputB[i];
+ var output = inputA[i] * inputB[i] as Matrix4;
//print('${inputA[i].cols}x${inputA[i].rows} * ${inputB[i].cols}x${inputB[i].rows} = ${output.cols}x${output.rows}');
relativeTest(output, expectedOutput[i]);
}
}
void testMatrix4Adjoint() {
- var input = new List();
- var expectedOutput = new List();
+ var input = new List<Matrix4>();
+ var expectedOutput = new List<Matrix4>();
- input.add(parseMatrix(
+ input.add(parseMatrix<Matrix4>(
'''0.934010684229183 0.011902069501241 0.311215042044805 0.262971284540144
0.129906208473730 0.337122644398882 0.528533135506213 0.654079098476782
0.568823660872193 0.162182308193243 0.165648729499781 0.689214503140008
0.469390641058206 0.794284540683907 0.601981941401637 0.748151592823709'''));
- expectedOutput.add(parseMatrix(
+ expectedOutput.add(parseMatrix<Matrix4>(
'''0.104914550911225 -0.120218628213523 0.026180662741638 0.044107217835411
-0.081375770192194 -0.233925009984709 -0.022194776259965 0.253560794325371
0.155967414263983 0.300399085119975 -0.261648453454468 -0.076412061081351
-0.104925204524921 0.082065846290507 0.217666653572481 -0.077704028180558'''));
- input.add(parseMatrix('''1 0 0 0
- 0 1 0 0
- 0 0 1 0
- 0 0 0 1'''));
- expectedOutput.add(parseMatrix('''1 0 0 0
+ input.add(parseMatrix<Matrix4>('''1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1'''));
+ expectedOutput.add(parseMatrix<Matrix4>('''1 0 0 0
+ 0 1 0 0
+ 0 0 1 0
+ 0 0 0 1'''));
- input.add(parseMatrix(
+ input.add(parseMatrix<Matrix4>(
'''0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067
0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502
0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433
0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''));
- expectedOutput.add(parseMatrix(
+ expectedOutput.add(parseMatrix<Matrix4>(
'''-0.100386867815513 0.076681891597503 -0.049082198794982 -0.021689260610181
-0.279454715225440 -0.269081505356250 0.114433412778961 0.133858687769130
0.218879650360982 0.073892735462981 0.069073300555062 -0.132069899391626
@@ -236,23 +236,23 @@
}
void testMatrix4Determinant() {
- var input = new List();
+ var input = new List<Matrix4>();
List<double> expectedOutput = new List<double>();
- input.add(parseMatrix(
+ input.add(parseMatrix<Matrix4>(
'''0.046171390631154 0.317099480060861 0.381558457093008 0.489764395788231
0.097131781235848 0.950222048838355 0.765516788149002 0.445586200710899
0.823457828327293 0.034446080502909 0.795199901137063 0.646313010111265
0.694828622975817 0.438744359656398 0.186872604554379 0.709364830858073'''));
expectedOutput.add(-0.199908980087990);
- input.add(parseMatrix(
+ input.add(parseMatrix<Matrix4>(
''' -2.336158020850647 0.358791716162913 0.571930324052307 0.866477090273158
-1.190335868711951 1.132044609886021 -0.693048859451418 0.742195189800671
0.015919048685702 0.552417702663606 1.020805610524362 -1.288062497216858
3.020318574990609 -1.197139524685751 -0.400475005629390 0.441263145991252'''));
expectedOutput.add(-5.002276533849802);
- input.add(parseMatrix(
+ input.add(parseMatrix<Matrix4>(
'''0.934010684229183 0.011902069501241 0.311215042044805 0.262971284540144
0.129906208473730 0.337122644398882 0.528533135506213 0.654079098476782
0.568823660872193 0.162182308193243 0.165648729499781 0.689214503140008
@@ -268,21 +268,21 @@
}
void testMatrix4SelfTransposeMultiply() {
- var inputA = new List();
- var inputB = new List();
- var expectedOutput = new List();
+ var inputA = new List<Matrix4>();
+ var inputB = new List<Matrix4>();
+ var expectedOutput = new List<Matrix4>();
- inputA.add(parseMatrix(
+ inputA.add(parseMatrix<Matrix4>(
'''0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067
0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502
0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433
0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''));
- inputB.add(parseMatrix(
+ inputB.add(parseMatrix<Matrix4>(
'''0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067
0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502
0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433
0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''));
- expectedOutput.add(parseMatrix(
+ expectedOutput.add(parseMatrix<Matrix4>(
'''1.096629343508065 1.170948826011164 0.975285713492989 1.047596917860438
1.170948826011164 1.987289692246011 1.393079247172284 1.945966332001094
0.975285713492989 1.393079247172284 1.138698195167051 1.266161729169725
@@ -299,21 +299,21 @@
}
void testMatrix4SelfMultiply() {
- var inputA = new List();
- var inputB = new List();
- var expectedOutput = new List();
+ var inputA = new List<Matrix4>();
+ var inputB = new List<Matrix4>();
+ var expectedOutput = new List<Matrix4>();
- inputA.add(parseMatrix(
+ inputA.add(parseMatrix<Matrix4>(
'''0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067
0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502
0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433
0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''));
- inputB.add(parseMatrix(
+ inputB.add(parseMatrix<Matrix4>(
'''0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067
0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502
0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433
0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''));
- expectedOutput.add(parseMatrix(
+ expectedOutput.add(parseMatrix<Matrix4>(
'''0.237893273152584 0.241190507375353 0.115471053480014 0.188086069635435
0.916103942227480 1.704973929800637 1.164721763902784 1.675285658272358
0.919182849383279 1.351023203753565 1.053750106199745 1.215382950294249
@@ -330,21 +330,21 @@
}
void testMatrix4SelfMultiplyTranspose() {
- var inputA = new List();
- var inputB = new List();
- var expectedOutput = new List();
+ var inputA = new List<Matrix4>();
+ var inputB = new List<Matrix4>();
+ var expectedOutput = new List<Matrix4>();
- inputA.add(parseMatrix(
+ inputA.add(parseMatrix<Matrix4>(
'''0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067
0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502
0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433
0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''));
- inputB.add(parseMatrix(
+ inputB.add(parseMatrix<Matrix4>(
'''0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067
0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502
0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433
0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''));
- expectedOutput.add(parseMatrix(
+ expectedOutput.add(parseMatrix<Matrix4>(
'''0.232339681975335 0.201799089276976 0.197320406329789 0.642508126615338
0.201799089276976 1.485449982570056 1.144315170085286 1.998154153033270
0.197320406329789 1.144315170085286 1.021602397682138 1.557970885061235
@@ -361,14 +361,14 @@
}
void testMatrix4Translation() {
- var inputA = new List();
- var inputB = new List();
- var output1 = new List();
- var output2 = new List();
+ var inputA = new List<Matrix4>();
+ var inputB = new List<Matrix4>();
+ var output1 = new List<Matrix4>();
+ var output2 = new List<Matrix4>();
inputA.add(new Matrix4.identity());
inputB.add(new Matrix4.translationValues(1.0, 3.0, 5.7));
- output1.add(inputA[0] * inputB[0]);
+ output1.add(inputA[0] * inputB[0] as Matrix4);
output2.add((new Matrix4.identity())..translate(1.0, 3.0, 5.7));
assert(inputA.length == inputB.length);
@@ -380,14 +380,14 @@
}
void testMatrix4Scale() {
- var inputA = new List();
- var inputB = new List();
- var output1 = new List();
- var output2 = new List();
+ var inputA = new List<Matrix4>();
+ var inputB = new List<Matrix4>();
+ var output1 = new List<Matrix4>();
+ var output2 = new List<Matrix4>();
inputA.add(new Matrix4.identity());
inputB.add(new Matrix4.diagonal3Values(1.0, 3.0, 5.7));
- output1.add(inputA[0] * inputB[0]);
+ output1.add(inputA[0] * inputB[0] as Matrix4);
output2.add(new Matrix4.identity()..scale(1.0, 3.0, 5.7));
assert(inputA.length == inputB.length);
@@ -399,8 +399,8 @@
}
void testMatrix4Rotate() {
- var output1 = new List();
- var output2 = new List();
+ var output1 = new List<Matrix4>();
+ var output2 = new List<Matrix4>();
output1.add(new Matrix4.rotationX(1.57079632679));
output2.add(new Matrix4.identity()..rotateX(1.57079632679));
output1.add(new Matrix4.rotationY(1.57079632679 * 0.5));
@@ -410,7 +410,7 @@
{
var axis = new Vector3(1.1, 1.1, 1.1);
axis.normalize();
- num angle = 1.5;
+ double angle = 1.5;
Quaternion q = new Quaternion.axisAngle(axis, angle);
Matrix3 R = q.asRotationMatrix();
@@ -430,10 +430,10 @@
void testMatrix4GetRotation() {
final mat4 = new Matrix4.rotationX(math.PI) *
new Matrix4.rotationY(-math.PI) *
- new Matrix4.rotationZ(math.PI);
+ new Matrix4.rotationZ(math.PI) as Matrix4;
final mat3 = new Matrix3.rotationX(math.PI) *
new Matrix3.rotationY(-math.PI) *
- new Matrix3.rotationZ(math.PI);
+ new Matrix3.rotationZ(math.PI) as Matrix3;
final matRot = mat4.getRotation();
relativeTest(mat3, matRot);
diff --git a/test/opengl_matrix_test.dart b/test/opengl_matrix_test.dart
index 18ee781..c5f904e 100644
--- a/test/opengl_matrix_test.dart
+++ b/test/opengl_matrix_test.dart
@@ -16,14 +16,14 @@
Vector3 focusPosition = new Vector3(0.0, 0.0, -1.0);
Vector3 upDirection = new Vector3(0.0, 1.0, 0.0);
Matrix4 lookat = makeViewMatrix(position, focusPosition, upDirection);
- num n = 0.1;
- num f = 1000.0;
- num l = -10.0;
- num r = 10.0;
- num b = -10.0;
- num t = 10.0;
+ double n = 0.1;
+ double f = 1000.0;
+ double l = -10.0;
+ double r = 10.0;
+ double b = -10.0;
+ double t = 10.0;
Matrix4 frustum = makeFrustumMatrix(l, r, b, t, n, f);
- Matrix4 C = frustum * lookat;
+ Matrix4 C = frustum * lookat as Matrix4;
Vector3 re = new Vector3.zero();
unproject(C, 0.0, 100.0, 0.0, 100.0, 50.0, 50.0, 1.0, re);
}
@@ -45,12 +45,12 @@
}
void testFrustumMatrix() {
- num n = 0.1;
- num f = 1000.0;
- num l = -1.0;
- num r = 1.0;
- num b = -1.0;
- num t = 1.0;
+ double n = 0.1;
+ double f = 1000.0;
+ double l = -1.0;
+ double r = 1.0;
+ double b = -1.0;
+ double t = 1.0;
Matrix4 frustum = makeFrustumMatrix(l, r, b, t, n, f);
relativeTest(
frustum.getColumn(0), new Vector4(2 * n / (r - l), 0.0, 0.0, 0.0));
@@ -92,12 +92,12 @@
}
void testOrthographicMatrix() {
- num n = 0.1;
- num f = 1000.0;
- num l = -1.0;
- num r = 1.0;
- num b = -1.0;
- num t = 1.0;
+ double n = 0.1;
+ double f = 1000.0;
+ double l = -1.0;
+ double r = 1.0;
+ double b = -1.0;
+ double t = 1.0;
Matrix4 ortho = makeOrthographicMatrix(l, r, b, t, n, f);
relativeTest(ortho.getColumn(0), new Vector4(2 / (r - l), 0.0, 0.0, 0.0));
relativeTest(ortho.getColumn(1), new Vector4(0.0, 2 / (t - b), 0.0, 0.0));
diff --git a/test/quad_test.dart b/test/quad_test.dart
index d9492bc..e68e30d 100644
--- a/test/quad_test.dart
+++ b/test/quad_test.dart
@@ -10,7 +10,7 @@
import 'test_utils.dart';
-testQuadCopyNormalInto() {
+void testQuadCopyNormalInto() {
final quad = new Quad.points(
new Vector3(1.0, 0.0, 1.0),
new Vector3(0.0, 2.0, 1.0),
@@ -24,7 +24,7 @@
normal, new Vector3(-0.8944271802902222, -0.4472135901451111, 0.0));
}
-testQuadCopyTriangles() {
+void testQuadCopyTriangles() {
final quad = new Quad.points(
new Vector3(1.0, 0.0, 1.0),
new Vector3(0.0, 2.0, 1.0),
diff --git a/test/scalar_list_view_test.dart b/test/scalar_list_view_test.dart
index d2466a1..fc8352d 100644
--- a/test/scalar_list_view_test.dart
+++ b/test/scalar_list_view_test.dart
@@ -21,7 +21,7 @@
expect(list.buffer[4], equals(0.0));
}
-testScalarListView() {
+void testScalarListView() {
final buffer = new Float32List(10);
final list = new ScalarListView.view(buffer, 1, 4);
expect(list.length, 2);
@@ -39,7 +39,7 @@
expect(buffer[9], equals(0.0));
}
-testScalarListViewFromList() {
+void testScalarListViewFromList() {
List<double> input = new List<double>(3);
input[0] = 1.0;
input[1] = 4.0;
diff --git a/test/test_utils.dart b/test/test_utils.dart
index bc01dc3..9ce96ee 100644
--- a/test/test_utils.dart
+++ b/test/test_utils.dart
@@ -14,21 +14,21 @@
Vector4 $v4(double x, double y, double z, double w) => new Vector4(x, y, z, w);
-void relativeTest(var output, var expectedOutput) {
+void relativeTest(dynamic output, dynamic expectedOutput) {
final num errorThreshold = 0.0005;
num error = relativeError(output, expectedOutput).abs();
expect(error >= errorThreshold, isFalse,
reason: '$output != $expectedOutput : relativeError = $error');
}
-void absoluteTest(var output, var expectedOutput) {
+void absoluteTest(dynamic output, dynamic expectedOutput) {
final num errorThreshold = 0.0005;
num error = absoluteError(output, expectedOutput).abs();
expect(error >= errorThreshold, isFalse,
reason: '$output != $expectedOutput : absoluteError = $error');
}
-makeMatrix(int rows, int cols) {
+dynamic makeMatrix(int rows, int cols) {
if (rows != cols) {
return null;
}
@@ -46,7 +46,7 @@
return null;
}
-parseMatrix(String input) {
+T parseMatrix<T>(String input) {
input = input.trim();
List<String> rows = input.split("\n");
List<double> values = new List<double>();
@@ -69,7 +69,7 @@
}
}
- var m = makeMatrix(rows.length, col_count);
+ dynamic m = makeMatrix(rows.length, col_count);
for (int j = 0; j < rows.length; j++) {
for (int i = 0; i < col_count; i++) {
m[m.index(j, i)] = values[j * col_count + i];
@@ -77,10 +77,10 @@
}
}
- return m;
+ return m as T;
}
-parseVector(String v) {
+T parseVector<T extends Vector>(String v) {
v = v.trim();
Pattern pattern = new RegExp('[\\s]+', multiLine: true, caseSensitive: false);
List<String> rows = v.split(pattern);
@@ -93,7 +93,7 @@
values.add(double.parse(rows[i]));
}
- var r;
+ Vector r;
if (values.length == 2) {
r = new Vector2(values[0], values[1]);
} else if (values.length == 3) {
@@ -102,5 +102,5 @@
r = new Vector4(values[0], values[1], values[2], values[3]);
}
- return r;
+ return r as T;
}
diff --git a/test/vector2_test.dart b/test/vector2_test.dart
index 21bb582..d5890fe 100644
--- a/test/vector2_test.dart
+++ b/test/vector2_test.dart
@@ -98,8 +98,8 @@
inputInv.invert();
// print("input $inputMatrix");
// print("input $inputInv");
- Vector2 resultOld = inputMatrix.transposed() * inputVector;
- Vector2 resultOldvInv = inputInv * inputVector;
+ Vector2 resultOld = inputMatrix.transposed() * inputVector as Vector2;
+ Vector2 resultOldvInv = inputInv * inputVector as Vector2;
Vector2 resultNew = inputVector..postmultiply(inputMatrix);
expect(resultNew.x, equals(resultOld.x));
expect(resultNew.y, equals(resultOld.y));
@@ -111,15 +111,15 @@
final Vector2 inputA = new Vector2(0.417267069084370, 0.049654430325742);
final Vector2 inputB = new Vector2(0.944787189721646, 0.490864092468080);
double expectedOutputCross = inputA.x * inputB.y - inputA.y * inputB.x;
- var result;
+ dynamic result;
result = cross2(inputA, inputB);
relativeTest(result, expectedOutputCross);
result = new Vector2.zero();
- cross2A(1.0, inputA, result);
+ cross2A(1.0, inputA, result as Vector2);
relativeTest(result, new Vector2(-inputA.y, inputA.x));
- cross2B(inputA, 1.0, result);
+ cross2B(inputA, 1.0, result as Vector2);
relativeTest(result, new Vector2(inputA.y, -inputA.x));
- cross2B(inputA, 1.0, result);
+ cross2B(inputA, 1.0, result as Vector2);
relativeTest(result, new Vector2(inputA.y, -inputA.x));
}
@@ -279,13 +279,13 @@
final v1 = new Vector2(-x, -y);
final v2 = new Vector2(-2.0 * x, 2.0 * y)..clamp(v1, v0);
- expect(v2.storage, orderedEquals([-x, y]));
+ expect(v2.storage, orderedEquals(<double>[-x, y]));
}
void testVector2ClampScalar() {
final x = 2.0;
final v0 = new Vector2(-2.0 * x, 2.0 * x)..clampScalar(-x, x);
- expect(v0.storage, orderedEquals([-x, x]));
+ expect(v0.storage, orderedEquals(<double>[-x, x]));
}
void testVector2Floor() {
@@ -293,9 +293,9 @@
final v1 = new Vector2(-0.5, 0.5)..floor();
final v2 = new Vector2(-0.9, 0.9)..floor();
- expect(v0.storage, orderedEquals([-1.0, 0.0]));
- expect(v1.storage, orderedEquals([-1.0, 0.0]));
- expect(v2.storage, orderedEquals([-1.0, 0.0]));
+ expect(v0.storage, orderedEquals(<double>[-1.0, 0.0]));
+ expect(v1.storage, orderedEquals(<double>[-1.0, 0.0]));
+ expect(v2.storage, orderedEquals(<double>[-1.0, 0.0]));
}
void testVector2Ceil() {
@@ -303,9 +303,9 @@
final v1 = new Vector2(-0.5, 0.5)..ceil();
final v2 = new Vector2(-0.9, 0.9)..ceil();
- expect(v0.storage, orderedEquals([0.0, 1.0]));
- expect(v1.storage, orderedEquals([0.0, 1.0]));
- expect(v2.storage, orderedEquals([0.0, 1.0]));
+ expect(v0.storage, orderedEquals(<double>[0.0, 1.0]));
+ expect(v1.storage, orderedEquals(<double>[0.0, 1.0]));
+ expect(v2.storage, orderedEquals(<double>[0.0, 1.0]));
}
void testVector2Round() {
@@ -313,9 +313,9 @@
final v1 = new Vector2(-0.5, 0.5)..round();
final v2 = new Vector2(-0.9, 0.9)..round();
- expect(v0.storage, orderedEquals([0.0, 0.0]));
- expect(v1.storage, orderedEquals([-1.0, 1.0]));
- expect(v2.storage, orderedEquals([-1.0, 1.0]));
+ expect(v0.storage, orderedEquals(<double>[0.0, 0.0]));
+ expect(v1.storage, orderedEquals(<double>[-1.0, 1.0]));
+ expect(v2.storage, orderedEquals(<double>[-1.0, 1.0]));
}
void testVector2RoundToZero() {
@@ -326,12 +326,12 @@
final v4 = new Vector2(-1.5, 1.5)..roundToZero();
final v5 = new Vector2(-1.9, 1.9)..roundToZero();
- expect(v0.storage, orderedEquals([0.0, 0.0]));
- expect(v1.storage, orderedEquals([0.0, 0.0]));
- expect(v2.storage, orderedEquals([0.0, 0.0]));
- expect(v3.storage, orderedEquals([-1.0, 1.0]));
- expect(v4.storage, orderedEquals([-1.0, 1.0]));
- expect(v5.storage, orderedEquals([-1.0, 1.0]));
+ expect(v0.storage, orderedEquals(<double>[0.0, 0.0]));
+ expect(v1.storage, orderedEquals(<double>[0.0, 0.0]));
+ expect(v2.storage, orderedEquals(<double>[0.0, 0.0]));
+ expect(v3.storage, orderedEquals(<double>[-1.0, 1.0]));
+ expect(v4.storage, orderedEquals(<double>[-1.0, 1.0]));
+ expect(v5.storage, orderedEquals(<double>[-1.0, 1.0]));
}
void main() {
diff --git a/test/vector3_test.dart b/test/vector3_test.dart
index b2abc81..5e60ee8 100644
--- a/test/vector3_test.dart
+++ b/test/vector3_test.dart
@@ -97,12 +97,12 @@
List<Vector3> inputA = new List<Vector3>();
List<Vector3> inputB = new List<Vector3>();
List<double> expectedOutput = new List<double>();
- inputA.add(parseVector('''0.417267069084370
- 0.049654430325742
- 0.902716109915281'''));
- inputB.add(parseVector('''0.944787189721646
- 0.490864092468080
- 0.489252638400019'''));
+ inputA.add(parseVector<Vector3>('''0.417267069084370
+ 0.049654430325742
+ 0.902716109915281'''));
+ inputB.add(parseVector<Vector3>('''0.944787189721646
+ 0.490864092468080
+ 0.489252638400019'''));
expectedOutput.add(0.860258396944727);
assert(inputA.length == inputB.length);
assert(inputB.length == expectedOutput.length);
@@ -116,12 +116,12 @@
void testVector3Postmultiplication() {
Matrix3 inputMatrix =
- (new Matrix3.rotationX(.4)) * (new Matrix3.rotationZ(.5));
+ (new Matrix3.rotationX(.4)) * (new Matrix3.rotationZ(.5)) as Matrix3;
Vector3 inputVector = new Vector3(1.0, 2.0, 3.0);
Matrix3 inputInv = new Matrix3.copy(inputMatrix);
inputInv.invert();
- Vector3 resultOld = inputMatrix.transposed() * inputVector;
- Vector3 resultOldvInv = inputInv * inputVector;
+ Vector3 resultOld = inputMatrix.transposed() * inputVector as Vector3;
+ Vector3 resultOldvInv = inputInv * inputVector as Vector3;
Vector3 resultNew = inputVector..postmultiply(inputMatrix);
expect(resultNew.x, equals(resultOld.x));
@@ -137,25 +137,25 @@
List<Vector3> inputB = new List<Vector3>();
List<Vector3> expectedOutput = new List<Vector3>();
- inputA.add(parseVector('''0.417267069084370
- 0.049654430325742
- 0.902716109915281'''));
- inputB.add(parseVector('''0.944787189721646
- 0.490864092468080
- 0.489252638400019'''));
- expectedOutput.add(parseVector(''' -0.418817363004761
- 0.648725602136344
- 0.157908551498227'''));
+ inputA.add(parseVector<Vector3>('''0.417267069084370
+ 0.049654430325742
+ 0.902716109915281'''));
+ inputB.add(parseVector<Vector3>('''0.944787189721646
+ 0.490864092468080
+ 0.489252638400019'''));
+ expectedOutput.add(parseVector<Vector3>(''' -0.418817363004761
+ 0.648725602136344
+ 0.157908551498227'''));
- inputA.add(parseVector('''0.944787189721646
- 0.490864092468080
- 0.489252638400019'''));
- inputB.add(parseVector('''0.417267069084370
- 0.049654430325742
- 0.902716109915281'''));
- expectedOutput.add(parseVector(''' 0.418817363004761
- -0.648725602136344
- -0.157908551498227'''));
+ inputA.add(parseVector<Vector3>('''0.944787189721646
+ 0.490864092468080
+ 0.489252638400019'''));
+ inputB.add(parseVector<Vector3>('''0.417267069084370
+ 0.049654430325742
+ 0.902716109915281'''));
+ expectedOutput.add(parseVector<Vector3>(''' 0.418817363004761
+ -0.648725602136344
+ -0.157908551498227'''));
assert(inputA.length == inputB.length);
assert(inputB.length == expectedOutput.length);
@@ -378,14 +378,14 @@
final v1 = new Vector3(-x, -y, -z);
final v2 = new Vector3(-2.0 * x, 2.0 * y, -2.0 * z)..clamp(v1, v0);
- expect(v2.storage, orderedEquals([-x, y, -z]));
+ expect(v2.storage, orderedEquals(<double>[-x, y, -z]));
}
void testVector3ClampScalar() {
final x = 2.0;
final v0 = new Vector3(-2.0 * x, 2.0 * x, -2.0 * x)..clampScalar(-x, x);
- expect(v0.storage, orderedEquals([-x, x, -x]));
+ expect(v0.storage, orderedEquals(<double>[-x, x, -x]));
}
void testVector3Floor() {
@@ -393,9 +393,9 @@
final v1 = new Vector3(-0.5, 0.5, -0.5)..floor();
final v2 = new Vector3(-0.9, 0.9, -0.5)..floor();
- expect(v0.storage, orderedEquals([-1.0, 0.0, -1.0]));
- expect(v1.storage, orderedEquals([-1.0, 0.0, -1.0]));
- expect(v2.storage, orderedEquals([-1.0, 0.0, -1.0]));
+ expect(v0.storage, orderedEquals(<double>[-1.0, 0.0, -1.0]));
+ expect(v1.storage, orderedEquals(<double>[-1.0, 0.0, -1.0]));
+ expect(v2.storage, orderedEquals(<double>[-1.0, 0.0, -1.0]));
}
void testVector3Ceil() {
@@ -403,9 +403,9 @@
final v1 = new Vector3(-0.5, 0.5, -0.5)..ceil();
final v2 = new Vector3(-0.9, 0.9, -0.9)..ceil();
- expect(v0.storage, orderedEquals([0.0, 1.0, 0.0]));
- expect(v1.storage, orderedEquals([0.0, 1.0, 0.0]));
- expect(v2.storage, orderedEquals([0.0, 1.0, 0.0]));
+ expect(v0.storage, orderedEquals(<double>[0.0, 1.0, 0.0]));
+ expect(v1.storage, orderedEquals(<double>[0.0, 1.0, 0.0]));
+ expect(v2.storage, orderedEquals(<double>[0.0, 1.0, 0.0]));
}
void testVector3Round() {
@@ -413,9 +413,9 @@
final v1 = new Vector3(-0.5, 0.5, -0.5)..round();
final v2 = new Vector3(-0.9, 0.9, -0.9)..round();
- expect(v0.storage, orderedEquals([0.0, 0.0, 0.0]));
- expect(v1.storage, orderedEquals([-1.0, 1.0, -1.0]));
- expect(v2.storage, orderedEquals([-1.0, 1.0, -1.0]));
+ expect(v0.storage, orderedEquals(<double>[0.0, 0.0, 0.0]));
+ expect(v1.storage, orderedEquals(<double>[-1.0, 1.0, -1.0]));
+ expect(v2.storage, orderedEquals(<double>[-1.0, 1.0, -1.0]));
}
void testVector3RoundToZero() {
@@ -426,12 +426,12 @@
final v4 = new Vector3(-1.5, 1.5, -1.5)..roundToZero();
final v5 = new Vector3(-1.9, 1.9, -1.9)..roundToZero();
- expect(v0.storage, orderedEquals([0.0, 0.0, 0.0]));
- expect(v1.storage, orderedEquals([0.0, 0.0, 0.0]));
- expect(v2.storage, orderedEquals([0.0, 0.0, 0.0]));
- expect(v3.storage, orderedEquals([-1.0, 1.0, -1.0]));
- expect(v4.storage, orderedEquals([-1.0, 1.0, -1.0]));
- expect(v5.storage, orderedEquals([-1.0, 1.0, -1.0]));
+ expect(v0.storage, orderedEquals(<double>[0.0, 0.0, 0.0]));
+ expect(v1.storage, orderedEquals(<double>[0.0, 0.0, 0.0]));
+ expect(v2.storage, orderedEquals(<double>[0.0, 0.0, 0.0]));
+ expect(v3.storage, orderedEquals(<double>[-1.0, 1.0, -1.0]));
+ expect(v4.storage, orderedEquals(<double>[-1.0, 1.0, -1.0]));
+ expect(v5.storage, orderedEquals(<double>[-1.0, 1.0, -1.0]));
}
void testVector3ApplyQuaternion() {
diff --git a/test/vector4_test.dart b/test/vector4_test.dart
index 35f4b5d..a4026e3 100644
--- a/test/vector4_test.dart
+++ b/test/vector4_test.dart
@@ -213,7 +213,7 @@
final v1 = new Vector4(-x, -y, -z, -w);
final v2 = new Vector4(-2.0 * x, 2.0 * y, -2.0 * z, 2.0 * w)..clamp(v1, v0);
- expect(v2.storage, orderedEquals([-x, y, -z, w]));
+ expect(v2.storage, orderedEquals(<double>[-x, y, -z, w]));
}
void testVector4ClampScalar() {
@@ -221,7 +221,7 @@
final v0 = new Vector4(-2.0 * x, 2.0 * x, -2.0 * x, 2.0 * x)
..clampScalar(-x, x);
- expect(v0.storage, orderedEquals([-x, x, -x, x]));
+ expect(v0.storage, orderedEquals(<double>[-x, x, -x, x]));
}
void testVector4Floor() {
@@ -229,9 +229,9 @@
final v1 = new Vector4(-0.5, 0.5, -0.5, 0.5)..floor();
final v2 = new Vector4(-0.9, 0.9, -0.5, 0.9)..floor();
- expect(v0.storage, orderedEquals([-1.0, 0.0, -1.0, 0.0]));
- expect(v1.storage, orderedEquals([-1.0, 0.0, -1.0, 0.0]));
- expect(v2.storage, orderedEquals([-1.0, 0.0, -1.0, 0.0]));
+ expect(v0.storage, orderedEquals(<double>[-1.0, 0.0, -1.0, 0.0]));
+ expect(v1.storage, orderedEquals(<double>[-1.0, 0.0, -1.0, 0.0]));
+ expect(v2.storage, orderedEquals(<double>[-1.0, 0.0, -1.0, 0.0]));
}
void testVector4Ceil() {
@@ -239,9 +239,9 @@
final v1 = new Vector4(-0.5, 0.5, -0.5, 0.5)..ceil();
final v2 = new Vector4(-0.9, 0.9, -0.9, 0.9)..ceil();
- expect(v0.storage, orderedEquals([0.0, 1.0, 0.0, 1.0]));
- expect(v1.storage, orderedEquals([0.0, 1.0, 0.0, 1.0]));
- expect(v2.storage, orderedEquals([0.0, 1.0, 0.0, 1.0]));
+ expect(v0.storage, orderedEquals(<double>[0.0, 1.0, 0.0, 1.0]));
+ expect(v1.storage, orderedEquals(<double>[0.0, 1.0, 0.0, 1.0]));
+ expect(v2.storage, orderedEquals(<double>[0.0, 1.0, 0.0, 1.0]));
}
void testVector4Round() {
@@ -249,9 +249,9 @@
final v1 = new Vector4(-0.5, 0.5, -0.5, 0.5)..round();
final v2 = new Vector4(-0.9, 0.9, -0.9, 0.9)..round();
- expect(v0.storage, orderedEquals([0.0, 0.0, 0.0, 0.0]));
- expect(v1.storage, orderedEquals([-1.0, 1.0, -1.0, 1.0]));
- expect(v2.storage, orderedEquals([-1.0, 1.0, -1.0, 1.0]));
+ expect(v0.storage, orderedEquals(<double>[0.0, 0.0, 0.0, 0.0]));
+ expect(v1.storage, orderedEquals(<double>[-1.0, 1.0, -1.0, 1.0]));
+ expect(v2.storage, orderedEquals(<double>[-1.0, 1.0, -1.0, 1.0]));
}
void testVector4RoundToZero() {
@@ -262,12 +262,12 @@
final v4 = new Vector4(-1.5, 1.5, -1.5, 1.5)..roundToZero();
final v5 = new Vector4(-1.9, 1.9, -1.9, 1.9)..roundToZero();
- expect(v0.storage, orderedEquals([0.0, 0.0, 0.0, 0.0]));
- expect(v1.storage, orderedEquals([0.0, 0.0, 0.0, 0.0]));
- expect(v2.storage, orderedEquals([0.0, 0.0, 0.0, 0.0]));
- expect(v3.storage, orderedEquals([-1.0, 1.0, -1.0, 1.0]));
- expect(v4.storage, orderedEquals([-1.0, 1.0, -1.0, 1.0]));
- expect(v5.storage, orderedEquals([-1.0, 1.0, -1.0, 1.0]));
+ expect(v0.storage, orderedEquals(<double>[0.0, 0.0, 0.0, 0.0]));
+ expect(v1.storage, orderedEquals(<double>[0.0, 0.0, 0.0, 0.0]));
+ expect(v2.storage, orderedEquals(<double>[0.0, 0.0, 0.0, 0.0]));
+ expect(v3.storage, orderedEquals(<double>[-1.0, 1.0, -1.0, 1.0]));
+ expect(v4.storage, orderedEquals(<double>[-1.0, 1.0, -1.0, 1.0]));
+ expect(v5.storage, orderedEquals(<double>[-1.0, 1.0, -1.0, 1.0]));
}
void main() {