-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathsint64_test_pairs.js
60 lines (56 loc) · 1.65 KB
/
sint64_test_pairs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* @fileoverview Test data for sint64 encoding and decoding.
*/
goog.module('protobuf.binary.sint64TestPairs');
const BufferDecoder = goog.require('protobuf.binary.BufferDecoder');
const Int64 = goog.require('protobuf.Int64');
const {createBufferDecoder} = goog.require('protobuf.binary.bufferDecoderHelper');
/**
* An array of Pairs of float values and their bit representation.
* This is used to test encoding and decoding from/to the protobuf wire format.
* @return {!Array<{name: string, longValue: !Int64, bufferDecoder:
* !BufferDecoder, error: ?boolean, skip_writer: ?boolean}>}
*/
function getSint64Pairs() {
const sint64Pairs = [
{
name: 'zero',
longValue: Int64.fromInt(0),
bufferDecoder: createBufferDecoder(0x00),
},
{
name: 'one ',
longValue: Int64.fromInt(1),
bufferDecoder: createBufferDecoder(0x02),
},
{
name: 'minus one',
longValue: Int64.fromInt(-1),
bufferDecoder: createBufferDecoder(0x01),
},
{
name: 'two',
longValue: Int64.fromInt(2),
bufferDecoder: createBufferDecoder(0x04),
},
{
name: 'minus two',
longValue: Int64.fromInt(-2),
bufferDecoder: createBufferDecoder(0x03),
},
{
name: 'min value',
longValue: Int64.getMinValue(),
bufferDecoder: createBufferDecoder(
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01),
},
{
name: 'max value',
longValue: Int64.getMaxValue(),
bufferDecoder: createBufferDecoder(
0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01),
},
];
return [...sint64Pairs];
}
exports = {getSint64Pairs};