+16
-2
lines changedFilter options
+16
-2
lines changed Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ const BigInt: DataType = {
34
34
}
35
35
36
36
const buffer = new WritableTrackingBuffer(8);
37
-
buffer.writeInt64LE(Number(parameter.value));
37
+
buffer.writeBigInt64LE(typeof parameter.value === 'bigint' ? parameter.value : globalThis.BigInt(parameter.value));
38
38
yield buffer.data;
39
39
},
40
40
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1
1
const { assert } = require('chai');
2
-
const { typeByName: { Int, SmallInt, TinyInt } } = require('../../src/data-type');
2
+
const { typeByName: { Int, SmallInt, TinyInt, BigInt } } = require('../../src/data-type');
3
3
4
4
describe('integer-data-types', function() {
5
5
describe('int data type test', function() {
@@ -46,4 +46,18 @@ describe('integer-data-types', function() {
46
46
});
47
47
});
48
48
});
49
+
50
+
describe('big int data type test', function() {
51
+
const params = [
52
+
{ param: { value: 9223372036854775807n }, expected: 9223372036854775807n },
53
+
{ param: { value: -9223372036854775808n }, expected: -9223372036854775808n }
54
+
];
55
+
56
+
params.forEach(function(item) {
57
+
it('test valid parameter values', function() {
58
+
const buffer = Buffer.concat([...BigInt.generateParameterData(item.param, {})]);
59
+
assert.equal(buffer.readBigInt64LE(0), item.expected);
60
+
});
61
+
});
62
+
});
49
63
});
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4