-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathsync.html
More file actions
49 lines (48 loc) · 978 Bytes
/
sync.html
File metadata and controls
49 lines (48 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<script src="lib/qunit.js"></script>
<link href="lib/qunit.css" rel="stylesheet">
<script src="lib/jquery.js"></script>
<script src="../jquery-turtle.js"></script>
<body>
<div id="qunit"></div>
<script>
eval($.turtle());
module("Sync test.");
asyncTest("Moves a couple turtles and verifies that sync works.", function() {
var a = new Turtle();
var b = new Turtle();
var reached1 = false, reached2 = false;
speed(10);
a.fd(100);
a.rt(90)
a.fd(100);
a.wear(red);
b.fd(100);
a.plan(function() {
reached2 = true;
});
sync(a, b, function() { reached1 = true; });
ok(!reached1);
ok(!reached2);
b.plan(function() {
ok(reached1);
ok(reached2);
});
a.plan(function() {
ok(reached1);
ok(reached2);
});
a.moveto(turtle);
a.plan(function() {
ok(reached1);
ok(b.touches(a));
});
b.moveto(turtle);
b.plan(function() {
ok(reached1);
ok(b.touches(a));
});
done(function() {
start();
});
});
</script>