1ffe3c632Sopenharmony_ci/**
2ffe3c632Sopenharmony_ci * @fileoverview Test data for int64 encoding and decoding.
3ffe3c632Sopenharmony_ci */
4ffe3c632Sopenharmony_cigoog.module('protobuf.binary.int64TestPairs');
5ffe3c632Sopenharmony_ci
6ffe3c632Sopenharmony_ciconst BufferDecoder = goog.require('protobuf.binary.BufferDecoder');
7ffe3c632Sopenharmony_ciconst Int64 = goog.require('protobuf.Int64');
8ffe3c632Sopenharmony_ciconst {createBufferDecoder} = goog.require('protobuf.binary.bufferDecoderHelper');
9ffe3c632Sopenharmony_ci
10ffe3c632Sopenharmony_ci/**
11ffe3c632Sopenharmony_ci * An array of Pairs of float values and their bit representation.
12ffe3c632Sopenharmony_ci * This is used to test encoding and decoding from/to the protobuf wire format.
13ffe3c632Sopenharmony_ci * @return {!Array<{name: string, longValue: !Int64, bufferDecoder:
14ffe3c632Sopenharmony_ci *     !BufferDecoder, error: ?boolean, skip_writer: ?boolean}>}
15ffe3c632Sopenharmony_ci */
16ffe3c632Sopenharmony_cifunction getInt64Pairs() {
17ffe3c632Sopenharmony_ci  const int64Pairs = [
18ffe3c632Sopenharmony_ci    {
19ffe3c632Sopenharmony_ci      name: 'zero',
20ffe3c632Sopenharmony_ci      longValue: Int64.fromInt(0),
21ffe3c632Sopenharmony_ci      bufferDecoder: createBufferDecoder(0x00),
22ffe3c632Sopenharmony_ci    },
23ffe3c632Sopenharmony_ci    {
24ffe3c632Sopenharmony_ci      name: 'one ',
25ffe3c632Sopenharmony_ci      longValue: Int64.fromInt(1),
26ffe3c632Sopenharmony_ci      bufferDecoder: createBufferDecoder(0x01),
27ffe3c632Sopenharmony_ci    },
28ffe3c632Sopenharmony_ci    {
29ffe3c632Sopenharmony_ci      name: 'minus one',
30ffe3c632Sopenharmony_ci      longValue: Int64.fromInt(-1),
31ffe3c632Sopenharmony_ci      bufferDecoder: createBufferDecoder(
32ffe3c632Sopenharmony_ci          0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01),
33ffe3c632Sopenharmony_ci    },
34ffe3c632Sopenharmony_ci    {
35ffe3c632Sopenharmony_ci      name: 'max signed int 2^63 - 1',
36ffe3c632Sopenharmony_ci      longValue: Int64.fromBits(0xFFFFFFFF, 0x7FFFFFFF),
37ffe3c632Sopenharmony_ci      bufferDecoder: createBufferDecoder(
38ffe3c632Sopenharmony_ci          0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F),
39ffe3c632Sopenharmony_ci
40ffe3c632Sopenharmony_ci    },
41ffe3c632Sopenharmony_ci    {
42ffe3c632Sopenharmony_ci      name: 'value min signed int -2^63 (64 bit)',
43ffe3c632Sopenharmony_ci      longValue: Int64.fromBits(0xFFFFFFFF, 0xFFFFFFFF),
44ffe3c632Sopenharmony_ci      bufferDecoder: createBufferDecoder(
45ffe3c632Sopenharmony_ci          0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01),
46ffe3c632Sopenharmony_ci    },
47ffe3c632Sopenharmony_ci    {
48ffe3c632Sopenharmony_ci      name: 'errors out for 11 bytes',
49ffe3c632Sopenharmony_ci      longValue: Int64.fromInt(-1),
50ffe3c632Sopenharmony_ci      bufferDecoder: createBufferDecoder(
51ffe3c632Sopenharmony_ci          0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF),
52ffe3c632Sopenharmony_ci      error: true,
53ffe3c632Sopenharmony_ci      skip_writer: true,
54ffe3c632Sopenharmony_ci    },
55ffe3c632Sopenharmony_ci  ];
56ffe3c632Sopenharmony_ci  return [...int64Pairs];
57ffe3c632Sopenharmony_ci}
58ffe3c632Sopenharmony_ci
59ffe3c632Sopenharmony_ciexports = {getInt64Pairs};
60