Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
bcf1f8d0
Commit
bcf1f8d0
authored
Jul 06, 2015
by
Chinmay Garde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test gravity
parent
30965c09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
newton_test.dart
packages/newton/test/newton_test.dart
+30
-2
No files found.
packages/newton/test/newton_test.dart
View file @
bcf1f8d0
...
...
@@ -8,8 +8,6 @@ import 'package:test/test.dart';
import
'package:newton/newton.dart'
;
typedef
bool
SimulationTestHandler
(
int
millis
);
void
main
(
)
{
test
(
'test_friction'
,
()
{
var
friction
=
new
Friction
(
0.3
,
100.0
,
400.0
);
...
...
@@ -28,4 +26,34 @@ void main() {
expect
(
friction
.
isDone
(
5.0
),
true
);
expect
(
friction
.
x
(
5.0
)
>
431
&&
friction
.
x
(
5.0
)
<
432
,
true
);
});
test
(
'test_gravity'
,
()
{
var
gravity
=
new
Gravity
(
200.0
,
100.0
,
600.0
,
0.0
);
expect
(
gravity
.
isDone
(
0.0
),
false
);
expect
(
gravity
.
x
(
0.0
),
100.0
);
expect
(
gravity
.
dx
(
0.0
),
0.0
);
// Starts at 100
expect
(
gravity
.
x
(
0.25
),
106.25
);
expect
(
gravity
.
x
(
0.50
),
125
);
expect
(
gravity
.
x
(
0.75
),
156.25
);
expect
(
gravity
.
x
(
1.00
),
200
);
expect
(
gravity
.
x
(
1.25
),
256.25
);
expect
(
gravity
.
x
(
1.50
),
325
);
expect
(
gravity
.
x
(
1.75
),
406.25
);
// Starts at 0.0
expect
(
gravity
.
dx
(
0.25
),
50.0
);
expect
(
gravity
.
dx
(
0.50
),
100
);
expect
(
gravity
.
dx
(
0.75
),
150.00
);
expect
(
gravity
.
dx
(
1.00
),
200.0
);
expect
(
gravity
.
dx
(
1.25
),
250.0
);
expect
(
gravity
.
dx
(
1.50
),
300
);
expect
(
gravity
.
dx
(
1.75
),
350
);
expect
(
gravity
.
isDone
(
2.5
),
true
);
expect
(
gravity
.
x
(
2.5
),
725
);
expect
(
gravity
.
dx
(
2.5
),
500.0
);
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment