Skip to content

Commit

Permalink
long string test (100% coverage)
Browse files Browse the repository at this point in the history
  • Loading branch information
SheetJSDev committed Jun 21, 2014
1 parent 1a8f8f3 commit f9733b1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion ctest/fixtures.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
var m = "foobar"; for(var i = 0; i != 11; ++i) m+=m;
var bits = [
[ "foobar", -1628037227, 1 ],
[ "foo bar baz", -228401567, 1 ],
[ "foo bar baz٪", 984445192 ],
[ "foo bar baz٪☃", 140429620],
[ "foo bar baz٪☃🍣", 1531648243]
[ "foo bar baz٪☃🍣", 1531648243],
[ m, 40270464, 1 ]
];
if(typeof module !== "undefined") module.exports = bits;
/* vim: set ts=2: */
Expand Down
2 changes: 1 addition & 1 deletion ctest/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('crc32 bits', function() {
bits.forEach(function(i) {
var l = i[0].length;
var msg = i[0];
if(l > 20) i[0].substr(0,5) + "...(" + l + ")..." + i[0].substr(-5);
if(l > 20) msg = i[0].substr(0,5) + "...(" + l + ")..." + i[0].substr(-5);
it(msg, function() {
if(i[2] === 1) assert.equal(X.bstr(i[0]), i[1]|0);
assert.equal(X.str(i[0]), i[1]|0);
Expand Down
4 changes: 3 additions & 1 deletion misc/bits.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
var m = "foobar"; for(var i = 0; i != 11; ++i) m+=m;
var bits = [
[ "foobar", -1628037227, 1 ],
[ "foo bar baz", -228401567, 1 ],
[ "foo bar baz٪", 984445192 ],
[ "foo bar baz٪☃", 140429620],
[ "foo bar baz٪☃🍣", 1531648243]
[ "foo bar baz٪☃🍣", 1531648243],
[ m, 40270464, 1 ]
];
if(typeof module !== "undefined") module.exports = bits;
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('crc32 bits', function() {
bits.forEach(function(i) {
var l = i[0].length;
var msg = i[0];
if(l > 20) i[0].substr(0,5) + "...(" + l + ")..." + i[0].substr(-5);
if(l > 20) msg = i[0].substr(0,5) + "...(" + l + ")..." + i[0].substr(-5);
it(msg, function() {
if(i[2] === 1) assert.equal(X.bstr(i[0]), i[1]|0);
assert.equal(X.str(i[0]), i[1]|0);
Expand Down

0 comments on commit f9733b1

Please sign in to comment.