-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3694c4d
commit cc142b1
Showing
21 changed files
with
1,484 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
module.exports = { | ||
ibmi: require('./ibmi/_test.test') | ||
ibmi: require('./ibmi/_test.test'), | ||
altibase: require('./altibase/_test.test') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
module.exports = { | ||
dataType: 'BIGINT', | ||
configurations: [ | ||
{ | ||
size: null, | ||
options: null, | ||
tests: [ | ||
// These tests only run if the N-API version supports BigInt | ||
...(parseInt(process.versions.napi) >= 5 ? [ | ||
{ | ||
name: 'BigInt -> BIGINT (min value)', | ||
values: { | ||
in: { | ||
value: -9223372036854775807n, | ||
expected: -9223372036854775807n, | ||
}, | ||
inout: { | ||
value: -9223372036854775808n, | ||
expected: -9223372036854775807n, | ||
}, | ||
out: { | ||
value: null, | ||
// expected: -9223372036854775808n, | ||
expected: null, // In Altibase, 0x8000000000000000 is null | ||
}, | ||
} | ||
}, | ||
{ | ||
name: 'BigInt -> BIGINT (max value)', | ||
values: { | ||
in: { | ||
value: 9223372036854775806n, | ||
expected: 9223372036854775806n, | ||
}, | ||
inout: { | ||
value: 9223372036854775807n, | ||
expected: 9223372036854775806n, | ||
}, | ||
out: { | ||
value: null, | ||
expected: 9223372036854775807n, | ||
}, | ||
}, | ||
}, | ||
] : []), | ||
{ | ||
name: 'Number -> BIGINT [MIN_SAFE_INTEGER]', | ||
values: { | ||
in: { | ||
value: Number.MIN_SAFE_INTEGER + 1, | ||
expected: Number.MIN_SAFE_INTEGER + 1, | ||
}, | ||
inout: { | ||
value: Number.MIN_SAFE_INTEGER, | ||
expected: Number.MIN_SAFE_INTEGER + 1, | ||
}, | ||
out: { | ||
value: null, | ||
expected: BigInt(Number.MIN_SAFE_INTEGER), | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'Number -> BIGINT [MAX_SAFE_INTEGER]', | ||
values: { | ||
in: { | ||
value: Number.MAX_SAFE_INTEGER - 1, | ||
expected: Number.MAX_SAFE_INTEGER - 1, | ||
}, | ||
inout: { | ||
value: Number.MAX_SAFE_INTEGER, | ||
expected: Number.MAX_SAFE_INTEGER - 1, | ||
}, | ||
out: { | ||
value: null, | ||
expected: BigInt(Number.MAX_SAFE_INTEGER), | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'String -> BIGINT (min value)', | ||
values: { | ||
in: { | ||
value: "-9223372036854775807", | ||
expected: "-9223372036854775807", | ||
}, | ||
inout: { | ||
// value: "-9223372036854775808", | ||
value: "-9223372036854775807", // In Altibase minimum bigint value is -9223372036854775807 | ||
expected: "-9223372036854775807", | ||
}, | ||
|
||
out: { | ||
value: null, | ||
// binding '-9223372036854775808' makes Numeric value out of range error | ||
expected: -9223372036854775807n, | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'String -> BIGINT (max value)', | ||
values: { | ||
in: { | ||
value: "9223372036854775806", | ||
expected: "9223372036854775806", | ||
}, | ||
inout: { | ||
value: "9223372036854775807", | ||
expected: "9223372036854775806", | ||
}, | ||
out: { | ||
value: null, | ||
expected: 9223372036854775807n, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
module.exports = { | ||
dataType: 'BINARY', | ||
configurations: [ | ||
{ | ||
size: '(16)', | ||
options: null, | ||
tests: [ | ||
{ | ||
name: 'Buffer -> BINARY', | ||
values: { | ||
in: { | ||
value: Buffer.from('7468697320697320612074c3a97374', 'hex'), | ||
expected: Buffer.from('7468697320697320612074c3a97374', 'hex'), | ||
}, | ||
inout: { | ||
value: Buffer.from('00112233445566778899aabbccddeeff', 'hex'), | ||
expected: Buffer.from('7468697320697320612074c3a97374', 'hex'), | ||
}, | ||
out: { | ||
value: null, | ||
expected: Buffer.from('00112233445566778899aabbccddeeff', 'hex'), | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'Buffer -> BINARY [empty buffer]', | ||
values: { | ||
in: { | ||
value: Buffer.alloc(0), | ||
expected: Buffer.alloc(0), | ||
}, | ||
inout: { | ||
value: Buffer.alloc(0), | ||
expected: null, // In Altibase, length 0 is treated as null. | ||
}, | ||
out: { | ||
value: null, | ||
expected: null, | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'Buffer -> BINARY [null bytes]', | ||
values: { | ||
in: { | ||
value: Buffer.alloc(16), | ||
expected: Buffer.alloc(16), | ||
}, | ||
inout: { | ||
value: Buffer.alloc(16), | ||
expected: Buffer.alloc(16), | ||
}, | ||
out: { | ||
value: null, | ||
expected: Buffer.alloc(16), | ||
}, | ||
}, | ||
}, | ||
], | ||
} | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
module.exports = { | ||
dataType: 'CHAR', | ||
configurations: [ | ||
{ | ||
size: '(16)', | ||
options: null, | ||
tests: [ | ||
{ | ||
name: 'string -> CHARACTER [empty]', | ||
values: { | ||
in: { | ||
value: '', | ||
expected: '', | ||
}, | ||
inout: { | ||
value: ' ', | ||
expected: null, | ||
}, | ||
out: { | ||
value: null, | ||
expected: ' ', | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'string -> CHAR (partially full values)', | ||
values: { | ||
in: { | ||
value: 'ABCD1234', | ||
expected: 'ABCD1234', | ||
}, | ||
inout: { | ||
value: 'Z Y X W 9', | ||
expected: 'ABCD1234 ', | ||
}, | ||
out: { | ||
value: null, | ||
expected: 'Z Y X W 9 ', | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'string -> CHARACTER (full)', | ||
values: { | ||
in: { | ||
value: 'ABCD1234EFGH5678', | ||
expected: 'ABCD1234EFGH5678', | ||
}, | ||
inout: { | ||
value: 'Z Y X W 9 8 7 6 ', | ||
expected: 'ABCD1234EFGH5678', | ||
}, | ||
out: { | ||
value: null, | ||
expected: 'Z Y X W 9 8 7 6 ', | ||
}, | ||
}, | ||
}, | ||
], | ||
} | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
module.exports = { | ||
dataType: 'CLOB', | ||
configurations: [ | ||
{ | ||
size: '(16)', | ||
options: null, | ||
tests: [ | ||
{ | ||
name: 'string -> CLOB [full]', | ||
values: { | ||
in: { | ||
value: 'ABCD1234EFGH5678', | ||
expected: 'ABCD1234EFGH5678', | ||
}, | ||
inout: { | ||
value: ' A B C D E F G H', | ||
expected: 'ABCD1234EFGH5678', | ||
}, | ||
out: { | ||
value: null, | ||
expected: ' A B C D E F G H', | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'Buffer -> CLOB (partially full values)', | ||
values: { | ||
in: { | ||
value: Buffer.from('7468697320697320612074c3a9737400', 'hex'), | ||
expected: Buffer.from('7468697320697320612074c3a9737400', 'hex'), | ||
}, | ||
inout: { | ||
value: Buffer.from('c8c5d3d3d65a', 'hex'), | ||
expected: Buffer.from('7468697320697320612074c3a9737400', 'hex'), | ||
}, | ||
out: { | ||
value: null, | ||
expected: 'HELLO!', | ||
}, | ||
}, | ||
} | ||
], | ||
}, | ||
], | ||
}; |
Oops, something went wrong.