-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.html
47 lines (40 loc) · 1.44 KB
/
tests.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tests of 531Calculator</title>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.9.2.css">
<script src="https://code.jquery.com/qunit/qunit-2.9.2.js"></script>
<script src="helpers.js"></script>
<script src="data.js"></script>
<script>
QUnit.test("Unit: roundTo2point5", function(assert) {
assert.equal(roundTo2point5(0), 0);
assert.equal(roundTo2point5(10), 10);
assert.equal(roundTo2point5(15), 15);
assert.equal(roundTo2point5(12.5), 12.5);
assert.equal(roundTo2point5(11.5), 12.5);
assert.equal(roundTo2point5(12.4), 12.5);
assert.equal(roundTo2point5(12.6), 12.5);
assert.equal(roundTo2point5(11), 10);
});
QUnit.test("Integration: computePercentage with tables", function(assert) {
// Week 1
assert.equal(computePercentage(97, 1, 1, true), 63.05);
assert.equal(computePercentage(97, 1, 2, true), 72.75);
assert.equal(computePercentage(97, 1, 3, true), 82.45);
// Week 2
assert.equal(computePercentage(97, 2, 1, true), 67.9);
assert.equal(computePercentage(97, 2, 2, true), 77.6);
assert.equal(computePercentage(97, 2, 3, true), 87.3);
// Week 3
assert.equal(computePercentage(97, 3, 1, true), 72.75);
assert.equal(computePercentage(97, 3, 2, true), 82.45);
assert.equal(computePercentage(97, 3, 3, true), 92.15);
});
</script>
</head>
<body>
<div id="qunit"></div>
</body>
</html>