Skip to content

Commit cedfdfc

Browse files
committed
added unit test framework: jsunittest and some initial basic tests
1 parent 8124af4 commit cedfdfc

File tree

3 files changed

+1159
-0
lines changed

3 files changed

+1159
-0
lines changed

jtab-unittest.html

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
<html>
4+
<head>
5+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6+
7+
<title>jTab - Unit Tests</title>
8+
9+
<script src="unit_test_assets/jsunittest.js" type="text/javascript"></script>
10+
11+
<link rel="stylesheet" href="unit_test_assets/unittest.css" type="text/css" />
12+
13+
<!-- START: for jtab -->
14+
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
15+
<link type="text/css" rel="stylesheet" href="css/jtab-helper.css"/>
16+
<script src="javascripts/prototype.js" type="text/javascript"></script>
17+
<script src="javascripts/raphael.js" type="text/javascript"></script>
18+
<script src="javascripts/jtab.js" type="text/javascript"></script>
19+
<!-- END: for jtab -->
20+
</head>
21+
<body>
22+
23+
24+
<div id="content">
25+
26+
<div id="header">
27+
<h1>jTab - Unit Tests</h1>
28+
<p>
29+
This file tests the core algirithms in <strong>jtab.js</strong>.
30+
</p>
31+
</div>
32+
33+
<!-- Log output (one per Runner, via {testLog: "testlog"} option)-->
34+
<div id="testlog"></div>
35+
36+
<!-- Put sample/test html here -->
37+
<div id="sample">
38+
</div>
39+
</div>
40+
41+
<script type="text/javascript">
42+
// <![CDATA[
43+
44+
new Test.Unit.Runner({
45+
setup: function() {
46+
},
47+
48+
teardown: function() {
49+
},
50+
51+
testUnitTestFrameworkOperational: function() { with(this) {
52+
assert(true);
53+
}},
54+
55+
56+
testChord_C_fingering: function() { with(this) {
57+
var token = 'C';
58+
var modelChordArray = [ 1, [-1 ], [3,3], [2,2], [0 ], [1,1], [0 ] ];
59+
var c = new jtabChord(token);
60+
assert( c.isValid, "jtabChord('" + token + "') should be valid" );
61+
assert( ! c.isCaged, "jtabChord('" + token + "') should not be CAGED" );
62+
assertHashEqual( modelChordArray, c.chordArray, "jtabChord('" + token + "') returned incorrect chordArray" );
63+
}},
64+
65+
testChord_C1_fingering: function() { with(this) {
66+
var token = 'C:1';
67+
var modelChordArray = [ 1, [-1 ], [3,3], [2,2], [0 ], [1,1], [0 ] ];
68+
69+
var c = new jtabChord(token);
70+
assert( c.isValid, "jtabChord('" + token + "') should be valid" );
71+
assert( c.isCaged, "jtabChord('" + token + "') should be CAGED" );
72+
assertHashEqual( modelChordArray, c.chordArray, "jtabChord('" + token + "') returned incorrect chordArray" );
73+
}},
74+
75+
testChord_C2_fingering: function() { with(this) {
76+
var token = 'C:2';
77+
var modelChordArray = [ 3, [-1,-1 ], [3,1], [5,2], [5,3], [5,4], [3,1] ];
78+
79+
var c = new jtabChord(token);
80+
assert( c.isValid, "jtabChord('" + token + "') should be valid" );
81+
assert( c.isCaged, "jtabChord('" + token + "') should be CAGED" );
82+
assertHashEqual( modelChordArray, c.chordArray, "jtabChord('" + token + "') returned incorrect chordArray" );
83+
}},
84+
});
85+
// ]]>
86+
</script>
87+
</body>
88+
</html>

0 commit comments

Comments
 (0)