Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: s/ASSERT/assert/ #10544

Merged
merged 1 commit into from
Jan 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions test/parallel/test-readdouble.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Tests to verify we're reading in doubles correctly
*/
require('../common');
var ASSERT = require('assert');
const assert = require('assert');

/*
* Test (64 bit) double
Expand All @@ -19,8 +19,8 @@ function test(clazz) {
buffer[5] = 0x55;
buffer[6] = 0xd5;
buffer[7] = 0x3f;
ASSERT.equal(1.1945305291680097e+103, buffer.readDoubleBE(0));
ASSERT.equal(0.3333333333333333, buffer.readDoubleLE(0));
assert.equal(1.1945305291680097e+103, buffer.readDoubleBE(0));
assert.equal(0.3333333333333333, buffer.readDoubleLE(0));

buffer[0] = 1;
buffer[1] = 0;
Expand All @@ -30,18 +30,18 @@ function test(clazz) {
buffer[5] = 0;
buffer[6] = 0xf0;
buffer[7] = 0x3f;
ASSERT.equal(7.291122019655968e-304, buffer.readDoubleBE(0));
ASSERT.equal(1.0000000000000002, buffer.readDoubleLE(0));
assert.equal(7.291122019655968e-304, buffer.readDoubleBE(0));
assert.equal(1.0000000000000002, buffer.readDoubleLE(0));

buffer[0] = 2;
ASSERT.equal(4.778309726801735e-299, buffer.readDoubleBE(0));
ASSERT.equal(1.0000000000000004, buffer.readDoubleLE(0));
assert.equal(4.778309726801735e-299, buffer.readDoubleBE(0));
assert.equal(1.0000000000000004, buffer.readDoubleLE(0));

buffer[0] = 1;
buffer[6] = 0;
buffer[7] = 0;
ASSERT.equal(7.291122019556398e-304, buffer.readDoubleBE(0));
ASSERT.equal(5e-324, buffer.readDoubleLE(0));
assert.equal(7.291122019556398e-304, buffer.readDoubleBE(0));
assert.equal(5e-324, buffer.readDoubleLE(0));

buffer[0] = 0xff;
buffer[1] = 0xff;
Expand All @@ -51,13 +51,13 @@ function test(clazz) {
buffer[5] = 0xff;
buffer[6] = 0x0f;
buffer[7] = 0x00;
ASSERT.ok(isNaN(buffer.readDoubleBE(0)));
ASSERT.equal(2.225073858507201e-308, buffer.readDoubleLE(0));
assert.ok(isNaN(buffer.readDoubleBE(0)));
assert.equal(2.225073858507201e-308, buffer.readDoubleLE(0));

buffer[6] = 0xef;
buffer[7] = 0x7f;
ASSERT.ok(isNaN(buffer.readDoubleBE(0)));
ASSERT.equal(1.7976931348623157e+308, buffer.readDoubleLE(0));
assert.ok(isNaN(buffer.readDoubleBE(0)));
assert.equal(1.7976931348623157e+308, buffer.readDoubleLE(0));

buffer[0] = 0;
buffer[1] = 0;
Expand All @@ -67,42 +67,42 @@ function test(clazz) {
buffer[5] = 0;
buffer[6] = 0xf0;
buffer[7] = 0x3f;
ASSERT.equal(3.03865e-319, buffer.readDoubleBE(0));
ASSERT.equal(1, buffer.readDoubleLE(0));
assert.equal(3.03865e-319, buffer.readDoubleBE(0));
assert.equal(1, buffer.readDoubleLE(0));

buffer[6] = 0;
buffer[7] = 0x40;
ASSERT.equal(3.16e-322, buffer.readDoubleBE(0));
ASSERT.equal(2, buffer.readDoubleLE(0));
assert.equal(3.16e-322, buffer.readDoubleBE(0));
assert.equal(2, buffer.readDoubleLE(0));

buffer[7] = 0xc0;
ASSERT.equal(9.5e-322, buffer.readDoubleBE(0));
ASSERT.equal(-2, buffer.readDoubleLE(0));
assert.equal(9.5e-322, buffer.readDoubleBE(0));
assert.equal(-2, buffer.readDoubleLE(0));

buffer[6] = 0x10;
buffer[7] = 0;
ASSERT.equal(2.0237e-320, buffer.readDoubleBE(0));
ASSERT.equal(2.2250738585072014e-308, buffer.readDoubleLE(0));
assert.equal(2.0237e-320, buffer.readDoubleBE(0));
assert.equal(2.2250738585072014e-308, buffer.readDoubleLE(0));

buffer[6] = 0;
ASSERT.equal(0, buffer.readDoubleBE(0));
ASSERT.equal(0, buffer.readDoubleLE(0));
ASSERT.equal(false, 1 / buffer.readDoubleLE(0) < 0);
assert.equal(0, buffer.readDoubleBE(0));
assert.equal(0, buffer.readDoubleLE(0));
assert.equal(false, 1 / buffer.readDoubleLE(0) < 0);

buffer[7] = 0x80;
ASSERT.equal(6.3e-322, buffer.readDoubleBE(0));
ASSERT.equal(0, buffer.readDoubleLE(0));
ASSERT.equal(true, 1 / buffer.readDoubleLE(0) < 0);
assert.equal(6.3e-322, buffer.readDoubleBE(0));
assert.equal(0, buffer.readDoubleLE(0));
assert.equal(true, 1 / buffer.readDoubleLE(0) < 0);

buffer[6] = 0xf0;
buffer[7] = 0x7f;
ASSERT.equal(3.0418e-319, buffer.readDoubleBE(0));
ASSERT.equal(Infinity, buffer.readDoubleLE(0));
assert.equal(3.0418e-319, buffer.readDoubleBE(0));
assert.equal(Infinity, buffer.readDoubleLE(0));

buffer[6] = 0xf0;
buffer[7] = 0xff;
ASSERT.equal(3.04814e-319, buffer.readDoubleBE(0));
ASSERT.equal(-Infinity, buffer.readDoubleLE(0));
assert.equal(3.04814e-319, buffer.readDoubleBE(0));
assert.equal(-Infinity, buffer.readDoubleLE(0));
}


Expand Down
38 changes: 19 additions & 19 deletions test/parallel/test-readfloat.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Tests to verify we're reading in floats correctly
*/
require('../common');
var ASSERT = require('assert');
const assert = require('assert');

/*
* Test (32 bit) float
Expand All @@ -15,56 +15,56 @@ function test(clazz) {
buffer[1] = 0;
buffer[2] = 0x80;
buffer[3] = 0x3f;
ASSERT.equal(4.600602988224807e-41, buffer.readFloatBE(0));
ASSERT.equal(1, buffer.readFloatLE(0));
assert.equal(4.600602988224807e-41, buffer.readFloatBE(0));
assert.equal(1, buffer.readFloatLE(0));

buffer[0] = 0;
buffer[1] = 0;
buffer[2] = 0;
buffer[3] = 0xc0;
ASSERT.equal(2.6904930515036488e-43, buffer.readFloatBE(0));
ASSERT.equal(-2, buffer.readFloatLE(0));
assert.equal(2.6904930515036488e-43, buffer.readFloatBE(0));
assert.equal(-2, buffer.readFloatLE(0));

buffer[0] = 0xff;
buffer[1] = 0xff;
buffer[2] = 0x7f;
buffer[3] = 0x7f;
ASSERT.ok(isNaN(buffer.readFloatBE(0)));
ASSERT.equal(3.4028234663852886e+38, buffer.readFloatLE(0));
assert.ok(isNaN(buffer.readFloatBE(0)));
assert.equal(3.4028234663852886e+38, buffer.readFloatLE(0));

buffer[0] = 0xab;
buffer[1] = 0xaa;
buffer[2] = 0xaa;
buffer[3] = 0x3e;
ASSERT.equal(-1.2126478207002966e-12, buffer.readFloatBE(0));
ASSERT.equal(0.3333333432674408, buffer.readFloatLE(0));
assert.equal(-1.2126478207002966e-12, buffer.readFloatBE(0));
assert.equal(0.3333333432674408, buffer.readFloatLE(0));

buffer[0] = 0;
buffer[1] = 0;
buffer[2] = 0;
buffer[3] = 0;
ASSERT.equal(0, buffer.readFloatBE(0));
ASSERT.equal(0, buffer.readFloatLE(0));
ASSERT.equal(false, 1 / buffer.readFloatLE(0) < 0);
assert.equal(0, buffer.readFloatBE(0));
assert.equal(0, buffer.readFloatLE(0));
assert.equal(false, 1 / buffer.readFloatLE(0) < 0);

buffer[3] = 0x80;
ASSERT.equal(1.793662034335766e-43, buffer.readFloatBE(0));
ASSERT.equal(0, buffer.readFloatLE(0));
ASSERT.equal(true, 1 / buffer.readFloatLE(0) < 0);
assert.equal(1.793662034335766e-43, buffer.readFloatBE(0));
assert.equal(0, buffer.readFloatLE(0));
assert.equal(true, 1 / buffer.readFloatLE(0) < 0);

buffer[0] = 0;
buffer[1] = 0;
buffer[2] = 0x80;
buffer[3] = 0x7f;
ASSERT.equal(4.609571298396486e-41, buffer.readFloatBE(0));
ASSERT.equal(Infinity, buffer.readFloatLE(0));
assert.equal(4.609571298396486e-41, buffer.readFloatBE(0));
assert.equal(Infinity, buffer.readFloatLE(0));

buffer[0] = 0;
buffer[1] = 0;
buffer[2] = 0x80;
buffer[3] = 0xff;
ASSERT.equal(4.627507918739843e-41, buffer.readFloatBE(0));
ASSERT.equal(-Infinity, buffer.readFloatLE(0));
assert.equal(4.627507918739843e-41, buffer.readFloatBE(0));
assert.equal(-Infinity, buffer.readFloatLE(0));
}


Expand Down
62 changes: 31 additions & 31 deletions test/parallel/test-readint.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Tests to verify we're reading in signed integers correctly
*/
require('../common');
var ASSERT = require('assert');
const assert = require('assert');

/*
* Test 8 bit signed integers
Expand All @@ -12,19 +12,19 @@ function test8(clazz) {
var data = new clazz(4);

data[0] = 0x23;
ASSERT.equal(0x23, data.readInt8(0));
assert.equal(0x23, data.readInt8(0));

data[0] = 0xff;
ASSERT.equal(-1, data.readInt8(0));
assert.equal(-1, data.readInt8(0));

data[0] = 0x87;
data[1] = 0xab;
data[2] = 0x7c;
data[3] = 0xef;
ASSERT.equal(-121, data.readInt8(0));
ASSERT.equal(-85, data.readInt8(1));
ASSERT.equal(124, data.readInt8(2));
ASSERT.equal(-17, data.readInt8(3));
assert.equal(-121, data.readInt8(0));
assert.equal(-85, data.readInt8(1));
assert.equal(124, data.readInt8(2));
assert.equal(-17, data.readInt8(3));
}


Expand All @@ -33,13 +33,13 @@ function test16(clazz) {

buffer[0] = 0x16;
buffer[1] = 0x79;
ASSERT.equal(0x1679, buffer.readInt16BE(0));
ASSERT.equal(0x7916, buffer.readInt16LE(0));
assert.equal(0x1679, buffer.readInt16BE(0));
assert.equal(0x7916, buffer.readInt16LE(0));

buffer[0] = 0xff;
buffer[1] = 0x80;
ASSERT.equal(-128, buffer.readInt16BE(0));
ASSERT.equal(-32513, buffer.readInt16LE(0));
assert.equal(-128, buffer.readInt16BE(0));
assert.equal(-32513, buffer.readInt16LE(0));

/* test offset with weenix */
buffer[0] = 0x77;
Expand All @@ -48,16 +48,16 @@ function test16(clazz) {
buffer[3] = 0x6e;
buffer[4] = 0x69;
buffer[5] = 0x78;
ASSERT.equal(0x7765, buffer.readInt16BE(0));
ASSERT.equal(0x6565, buffer.readInt16BE(1));
ASSERT.equal(0x656e, buffer.readInt16BE(2));
ASSERT.equal(0x6e69, buffer.readInt16BE(3));
ASSERT.equal(0x6978, buffer.readInt16BE(4));
ASSERT.equal(0x6577, buffer.readInt16LE(0));
ASSERT.equal(0x6565, buffer.readInt16LE(1));
ASSERT.equal(0x6e65, buffer.readInt16LE(2));
ASSERT.equal(0x696e, buffer.readInt16LE(3));
ASSERT.equal(0x7869, buffer.readInt16LE(4));
assert.equal(0x7765, buffer.readInt16BE(0));
assert.equal(0x6565, buffer.readInt16BE(1));
assert.equal(0x656e, buffer.readInt16BE(2));
assert.equal(0x6e69, buffer.readInt16BE(3));
assert.equal(0x6978, buffer.readInt16BE(4));
assert.equal(0x6577, buffer.readInt16LE(0));
assert.equal(0x6565, buffer.readInt16LE(1));
assert.equal(0x6e65, buffer.readInt16LE(2));
assert.equal(0x696e, buffer.readInt16LE(3));
assert.equal(0x7869, buffer.readInt16LE(4));
}


Expand All @@ -68,28 +68,28 @@ function test32(clazz) {
buffer[1] = 0x53;
buffer[2] = 0x16;
buffer[3] = 0x79;
ASSERT.equal(0x43531679, buffer.readInt32BE(0));
ASSERT.equal(0x79165343, buffer.readInt32LE(0));
assert.equal(0x43531679, buffer.readInt32BE(0));
assert.equal(0x79165343, buffer.readInt32LE(0));

buffer[0] = 0xff;
buffer[1] = 0xfe;
buffer[2] = 0xef;
buffer[3] = 0xfa;
ASSERT.equal(-69638, buffer.readInt32BE(0));
ASSERT.equal(-84934913, buffer.readInt32LE(0));
assert.equal(-69638, buffer.readInt32BE(0));
assert.equal(-84934913, buffer.readInt32LE(0));

buffer[0] = 0x42;
buffer[1] = 0xc3;
buffer[2] = 0x95;
buffer[3] = 0xa9;
buffer[4] = 0x36;
buffer[5] = 0x17;
ASSERT.equal(0x42c395a9, buffer.readInt32BE(0));
ASSERT.equal(-1013601994, buffer.readInt32BE(1));
ASSERT.equal(-1784072681, buffer.readInt32BE(2));
ASSERT.equal(-1449802942, buffer.readInt32LE(0));
ASSERT.equal(917083587, buffer.readInt32LE(1));
ASSERT.equal(389458325, buffer.readInt32LE(2));
assert.equal(0x42c395a9, buffer.readInt32BE(0));
assert.equal(-1013601994, buffer.readInt32BE(1));
assert.equal(-1784072681, buffer.readInt32BE(2));
assert.equal(-1449802942, buffer.readInt32LE(0));
assert.equal(917083587, buffer.readInt32LE(1));
assert.equal(389458325, buffer.readInt32LE(2));
}


Expand Down
40 changes: 20 additions & 20 deletions test/parallel/test-readuint.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

require('../common');
var ASSERT = require('assert');
const assert = require('assert');

/*
* We need to check the following things:
Expand All @@ -20,13 +20,13 @@ function test8(clazz) {
data[1] = 23;
data[2] = 23;
data[3] = 23;
ASSERT.equal(23, data.readUInt8(0));
ASSERT.equal(23, data.readUInt8(1));
ASSERT.equal(23, data.readUInt8(2));
ASSERT.equal(23, data.readUInt8(3));
assert.equal(23, data.readUInt8(0));
assert.equal(23, data.readUInt8(1));
assert.equal(23, data.readUInt8(2));
assert.equal(23, data.readUInt8(3));

data[0] = 255; /* If it became a signed int, would be -1 */
ASSERT.equal(255, data.readUInt8(0));
assert.equal(255, data.readUInt8(0));
}


Expand All @@ -45,17 +45,17 @@ function test16(clazz) {
data[1] = 0x23;
data[2] = 0x42;
data[3] = 0x3f;
ASSERT.equal(0x23, data.readUInt16BE(0));
ASSERT.equal(0x2342, data.readUInt16BE(1));
ASSERT.equal(0x423f, data.readUInt16BE(2));
ASSERT.equal(0x2300, data.readUInt16LE(0));
ASSERT.equal(0x4223, data.readUInt16LE(1));
ASSERT.equal(0x3f42, data.readUInt16LE(2));
assert.equal(0x23, data.readUInt16BE(0));
assert.equal(0x2342, data.readUInt16BE(1));
assert.equal(0x423f, data.readUInt16BE(2));
assert.equal(0x2300, data.readUInt16LE(0));
assert.equal(0x4223, data.readUInt16LE(1));
assert.equal(0x3f42, data.readUInt16LE(2));

data[0] = 0xfe;
data[1] = 0xfe;
ASSERT.equal(0xfefe, data.readUInt16BE(0));
ASSERT.equal(0xfefe, data.readUInt16LE(0));
assert.equal(0xfefe, data.readUInt16BE(0));
assert.equal(0xfefe, data.readUInt16LE(0));
}


Expand All @@ -75,12 +75,12 @@ function test32(clazz) {
data[3] = 0x56;
data[4] = 0x23;
data[5] = 0xff;
ASSERT.equal(0x32654256, data.readUInt32BE(0));
ASSERT.equal(0x65425623, data.readUInt32BE(1));
ASSERT.equal(0x425623ff, data.readUInt32BE(2));
ASSERT.equal(0x56426532, data.readUInt32LE(0));
ASSERT.equal(0x23564265, data.readUInt32LE(1));
ASSERT.equal(0xff235642, data.readUInt32LE(2));
assert.equal(0x32654256, data.readUInt32BE(0));
assert.equal(0x65425623, data.readUInt32BE(1));
assert.equal(0x425623ff, data.readUInt32BE(2));
assert.equal(0x56426532, data.readUInt32LE(0));
assert.equal(0x23564265, data.readUInt32LE(1));
assert.equal(0xff235642, data.readUInt32LE(2));
}


Expand Down
Loading