Skip to content
This repository was archived by the owner on Aug 12, 2020. It is now read-only.

Commit 967d587

Browse files
committed
fixed narrowing warnings in unit tests
1 parent fada9a5 commit 967d587

File tree

1 file changed

+77
-80
lines changed

1 file changed

+77
-80
lines changed

test/unit_tests/cql_message_result.cpp

Lines changed: 77 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -38,84 +38,81 @@ BOOST_AUTO_TEST_SUITE(cql_message_result)
3838
// INSERT INTO test_cf (ascii, blob, text, varchar, varint, a_set, a_list, a_map) VALUES ('ascii', '', '', '', 0, {}, [], {});
3939

4040

41-
char TEST_MESSAGE_RESULT[] = { 0x00, 0x00, 0x00, 0x02, // result_type(int=2)
42-
0x00, 0x00, 0x00, 0x01, // metadata flags(int=1)
43-
0x00, 0x00, 0x00, 0x11, // metadata column_count(int=17)
44-
0x00, 0x02, 0x6b, 0x6d, // metadata global_table_spec(string=km)
45-
0x00, 0x07, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x66, // metadata global_table_spec(string=test_cf)
46-
0x00, 0x05, 0x61, 0x73, 0x63, 0x69, 0x69, 0x00, 0x01, // 0 'ascii' type=ascii index 25
47-
0x00, 0x06, 0x61, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x00, 0x20, 0x00, 0x04, // 1 'a_list' type=list<boolean>
48-
0x00, 0x05, 0x61, 0x5f, 0x6d, 0x61, 0x70, 0x00, 0x21, 0x00, 0x0d, 0x00, 0x09, // 2 'a_map' type=map<varchar, int>
49-
0x00, 0x05, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x00, 0x22, 0x00, 0x09, // 3 'a_set' type=set<boolean>
50-
0x00, 0x06, 0x62, 0x69, 0x67, 0x69, 0x6e, 0x74, 0x00, 0x02, // 4 'bigint' type=bigint
51-
0x00, 0x04, 0x62, 0x6c, 0x6f, 0x62, 0x00, 0x03, // 5 'blob' type=blob
52-
0x00, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x00, 0x04, // 6 'boolean' type=boolean
53-
0x00, 0x07, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x00, 0x06, // 7 'decimal' type=decimal
54-
0x00, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x00, 0x07, // 8 'double' type=double
55-
0x00, 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x00, 0x08, // 9 'float' type=float
56-
0x00, 0x03, 0x69, 0x6e, 0x74, 0x00, 0x09, // 10 'int' type=int
57-
0x00, 0x04, 0x74, 0x65, 0x78, 0x74, 0x00, 0x0d, // 11 'text' type=varchar
58-
0x00, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x0b, // 12 'timestamp' type=timestamp
59-
0x00, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x75, 0x75, 0x69, 0x64, 0x00, 0x0f, // 13 'timeuuid' type=timeuuid
60-
0x00, 0x04, 0x75, 0x75, 0x69, 0x64, 0x00, 0x0c, // 14 'uuid' type=uuid
61-
0x00, 0x07, 0x76, 0x61, 0x72, 0x63, 0x68, 0x61, 0x72, 0x00, 0x0d, // 15 'varchar' type=varchar
62-
0x00, 0x06, 0x76, 0x61, 0x72, 0x69, 0x6e, 0x74, 0x00, 0x0e, // 16 'varint' type=varint
63-
0x00, 0x00, 0x00, 0x02, // row_count(int=1)
64-
65-
// begin row 0
66-
0x00, 0x00, 0x00, 0x05, 0x61, 0x73, 0x63, 0x69, 0x69, // 0 ascii('ascii')
67-
0x00, 0x00, 0x00, 0x0b, // 1 list(true, true, false)
68-
0x00, 0x03, // list size of 3
69-
0x00, 0x01, 0x01, // list item true
70-
0x00, 0x01, 0x01, // list item true
71-
0x00, 0x01, 0x00, // list item false
72-
0x00, 0x00, 0x00, 0x14, // 2 map{'a' : 1, 'b' : 2}
73-
0x00, 0x02, // map size of 2
74-
0x00, 0x01, 0x61, // map key a
75-
0x00, 0x04, 0x00, 0x00, 0x00, 0x01, // map val 1
76-
0x00, 0x01, 0x62, // map key b
77-
0x00, 0x04, 0x00, 0x00, 0x00, 0x02, // map val 2
78-
0x00, 0x00, 0x00, 0x14, // 3 set{1, 2, 3}
79-
0x00, 0x03, // set size of 3
80-
0x00, 0x04, 0x00, 0x00, 0x00, 0x01, // set item 1
81-
0x00, 0x04, 0x00, 0x00, 0x00, 0x02, // set item 2
82-
0x00, 0x04, 0x00, 0x00, 0x00, 0x03, // set item 3
83-
0x00, 0x00, 0x00, 0x08, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 4 bigint(9223372036854775807)
84-
0x00, 0x00, 0x00, 0x04, 0xde, 0xad, 0xbe, 0xef, // 5 blob(0xDEADBEEF)
85-
0x00, 0x00, 0x00, 0x01, 0x01, // 6 bool(true)
86-
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x12, 0xbc, 0x87, 0x69, // 7 decimal(3.14345321)
87-
0x00, 0x00, 0x00, 0x08, 0x40, 0x09, 0x25, 0xca, 0xcb, 0xeb, 0xa6, 0x57, // 8 double(3.14345321)
88-
0x00, 0x00, 0x00, 0x04, 0x40, 0x48, 0xf5, 0xc3, // 9 float(3.14)
89-
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x3a, // 10 int(314)
90-
0x00, 0x00, 0x00, 0x04, 0x74, 0x65, 0x78, 0x74, // 11 varchar(text)
91-
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x49, 0xe8, 0xf2, 0x3e, // 12 timestamp(1240003134)
92-
0x00, 0x00, 0x00, 0x10, 0xaf, 0xbf, 0xe1, 0xe0, 0x80, 0xff, 0x11, 0xe2, 0x9e, 0x96, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66, // 13 timeuuid(afbfe1e0-80ff-11e2-9e96-0800200c9a66)
93-
0x00, 0x00, 0x00, 0x10, 0x21, 0xc9, 0xb0, 0x31, 0xa3, 0xdc, 0x45, 0x56, 0xb4, 0x2f, 0x12, 0xc2, 0x86, 0x7c, 0x7d, 0x4a, // 14 uuid(21c9b031-a3dc-4556-b42f-12c2867c7d4a)
94-
0x00, 0x00, 0x00, 0x07, 0x76, 0x61, 0x72, 0x63, 0x68, 0x61, 0x72, // 15 varchar('varchar')
95-
0x00, 0x00, 0x00, 0x10, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 16 varint(170141183460469231731687303715884105727)
96-
97-
// begin row 1 (mostly null)
98-
0x00, 0x00, 0x00, 0x06, 0x61, 0x73, 0x63, 0x69, 0x69, 0x32, // 0 ascii('ascii2')
99-
0xff, 0xff, 0xff, 0xff,
100-
0xff, 0xff, 0xff, 0xff,
101-
0xff, 0xff, 0xff, 0xff,
102-
0xff, 0xff, 0xff, 0xff,
103-
0x00, 0x00, 0x00, 0x00, // 5
104-
0xff, 0xff, 0xff, 0xff,
105-
0xff, 0xff, 0xff, 0xff,
106-
0xff, 0xff, 0xff, 0xff,
107-
0xff, 0xff, 0xff, 0xff,
108-
0xff, 0xff, 0xff, 0xff,
109-
0x00, 0x00, 0x00, 0x00, // 11
110-
0xff, 0xff, 0xff, 0xff,
111-
0xff, 0xff, 0xff, 0xff,
112-
0xff, 0xff, 0xff, 0xff,
113-
0x00, 0x00, 0x00, 0x00, // 15
114-
0x00, 0x00, 0x00, 0x01, 0x00 };
115-
116-
117-
118-
41+
const unsigned char
42+
TEST_MESSAGE_RESULT[] = { 0x00, 0x00, 0x00, 0x02, // result_type(int=2)
43+
0x00, 0x00, 0x00, 0x01, // metadata flags(int=1)
44+
0x00, 0x00, 0x00, 0x11, // metadata column_count(int=17)
45+
0x00, 0x02, 0x6b, 0x6d, // metadata global_table_spec(string=km)
46+
0x00, 0x07, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x66, // metadata global_table_spec(string=test_cf)
47+
0x00, 0x05, 0x61, 0x73, 0x63, 0x69, 0x69, 0x00, 0x01, // 0 'ascii' type=ascii index 25
48+
0x00, 0x06, 0x61, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x00, 0x20, 0x00, 0x04, // 1 'a_list' type=list<boolean>
49+
0x00, 0x05, 0x61, 0x5f, 0x6d, 0x61, 0x70, 0x00, 0x21, 0x00, 0x0d, 0x00, 0x09, // 2 'a_map' type=map<varchar, int>
50+
0x00, 0x05, 0x61, 0x5f, 0x73, 0x65, 0x74, 0x00, 0x22, 0x00, 0x09, // 3 'a_set' type=set<boolean>
51+
0x00, 0x06, 0x62, 0x69, 0x67, 0x69, 0x6e, 0x74, 0x00, 0x02, // 4 'bigint' type=bigint
52+
0x00, 0x04, 0x62, 0x6c, 0x6f, 0x62, 0x00, 0x03, // 5 'blob' type=blob
53+
0x00, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x00, 0x04, // 6 'boolean' type=boolean
54+
0x00, 0x07, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x00, 0x06, // 7 'decimal' type=decimal
55+
0x00, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x00, 0x07, // 8 'double' type=double
56+
0x00, 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x00, 0x08, // 9 'float' type=float
57+
0x00, 0x03, 0x69, 0x6e, 0x74, 0x00, 0x09, // 10 'int' type=int
58+
0x00, 0x04, 0x74, 0x65, 0x78, 0x74, 0x00, 0x0d, // 11 'text' type=varchar
59+
0x00, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x0b, // 12 'timestamp' type=timestamp
60+
0x00, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x75, 0x75, 0x69, 0x64, 0x00, 0x0f, // 13 'timeuuid' type=timeuuid
61+
0x00, 0x04, 0x75, 0x75, 0x69, 0x64, 0x00, 0x0c, // 14 'uuid' type=uuid
62+
0x00, 0x07, 0x76, 0x61, 0x72, 0x63, 0x68, 0x61, 0x72, 0x00, 0x0d, // 15 'varchar' type=varchar
63+
0x00, 0x06, 0x76, 0x61, 0x72, 0x69, 0x6e, 0x74, 0x00, 0x0e, // 16 'varint' type=varint
64+
0x00, 0x00, 0x00, 0x02, // row_count(int=1)
65+
66+
// begin row 0
67+
0x00, 0x00, 0x00, 0x05, 0x61, 0x73, 0x63, 0x69, 0x69, // 0 ascii('ascii')
68+
0x00, 0x00, 0x00, 0x0b, // 1 list(true, true, false)
69+
0x00, 0x03, // list size of 3
70+
0x00, 0x01, 0x01, // list item true
71+
0x00, 0x01, 0x01, // list item true
72+
0x00, 0x01, 0x00, // list item false
73+
0x00, 0x00, 0x00, 0x14, // 2 map{'a' : 1, 'b' : 2}
74+
0x00, 0x02, // map size of 2
75+
0x00, 0x01, 0x61, // map key a
76+
0x00, 0x04, 0x00, 0x00, 0x00, 0x01, // map val 1
77+
0x00, 0x01, 0x62, // map key b
78+
0x00, 0x04, 0x00, 0x00, 0x00, 0x02, // map val 2
79+
0x00, 0x00, 0x00, 0x14, // 3 set{1, 2, 3}
80+
0x00, 0x03, // set size of 3
81+
0x00, 0x04, 0x00, 0x00, 0x00, 0x01, // set item 1
82+
0x00, 0x04, 0x00, 0x00, 0x00, 0x02, // set item 2
83+
0x00, 0x04, 0x00, 0x00, 0x00, 0x03, // set item 3
84+
0x00, 0x00, 0x00, 0x08, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 4 bigint(9223372036854775807)
85+
0x00, 0x00, 0x00, 0x04, 0xde, 0xad, 0xbe, 0xef, // 5 blob(0xDEADBEEF)
86+
0x00, 0x00, 0x00, 0x01, 0x01, // 6 bool(true)
87+
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x12, 0xbc, 0x87, 0x69, // 7 decimal(3.14345321)
88+
0x00, 0x00, 0x00, 0x08, 0x40, 0x09, 0x25, 0xca, 0xcb, 0xeb, 0xa6, 0x57, // 8 double(3.14345321)
89+
0x00, 0x00, 0x00, 0x04, 0x40, 0x48, 0xf5, 0xc3, // 9 float(3.14)
90+
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x3a, // 10 int(314)
91+
0x00, 0x00, 0x00, 0x04, 0x74, 0x65, 0x78, 0x74, // 11 varchar(text)
92+
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x49, 0xe8, 0xf2, 0x3e, // 12 timestamp(1240003134)
93+
0x00, 0x00, 0x00, 0x10, 0xaf, 0xbf, 0xe1, 0xe0, 0x80, 0xff, 0x11, 0xe2, 0x9e, 0x96, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66, // 13 timeuuid(afbfe1e0-80ff-11e2-9e96-0800200c9a66)
94+
0x00, 0x00, 0x00, 0x10, 0x21, 0xc9, 0xb0, 0x31, 0xa3, 0xdc, 0x45, 0x56, 0xb4, 0x2f, 0x12, 0xc2, 0x86, 0x7c, 0x7d, 0x4a, // 14 uuid(21c9b031-a3dc-4556-b42f-12c2867c7d4a)
95+
0x00, 0x00, 0x00, 0x07, 0x76, 0x61, 0x72, 0x63, 0x68, 0x61, 0x72, // 15 varchar('varchar')
96+
0x00, 0x00, 0x00, 0x10, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 16 varint(170141183460469231731687303715884105727)
97+
98+
// begin row 1 (mostly null)
99+
0x00, 0x00, 0x00, 0x06, 0x61, 0x73, 0x63, 0x69, 0x69, 0x32, // 0 ascii('ascii2')
100+
0xff, 0xff, 0xff, 0xff,
101+
0xff, 0xff, 0xff, 0xff,
102+
0xff, 0xff, 0xff, 0xff,
103+
0xff, 0xff, 0xff, 0xff,
104+
0x00, 0x00, 0x00, 0x00, // 5
105+
0xff, 0xff, 0xff, 0xff,
106+
0xff, 0xff, 0xff, 0xff,
107+
0xff, 0xff, 0xff, 0xff,
108+
0xff, 0xff, 0xff, 0xff,
109+
0xff, 0xff, 0xff, 0xff,
110+
0x00, 0x00, 0x00, 0x00, // 11
111+
0xff, 0xff, 0xff, 0xff,
112+
0xff, 0xff, 0xff, 0xff,
113+
0xff, 0xff, 0xff, 0xff,
114+
0x00, 0x00, 0x00, 0x00, // 15
115+
0x00, 0x00, 0x00, 0x01, 0x00 };
119116

120117

121118
BOOST_AUTO_TEST_CASE(opcode)
@@ -419,8 +416,8 @@ BOOST_AUTO_TEST_CASE(deserialize_data_14)
419416
cql::cql_byte_t* data = 0;
420417
cql::cql_int_t size = 0;
421418

422-
const char test_str[] = {0x21, 0xc9, 0xb0, 0x31, 0xa3, 0xdc, 0x45, 0x56,
423-
0xb4, 0x2f, 0x12, 0xc2, 0x86, 0x7c, 0x7d, 0x4a, 0x00}; // one extra byte for null terminiation
419+
const unsigned char test_str[] = {0x21, 0xc9, 0xb0, 0x31, 0xa3, 0xdc, 0x45, 0x56,
420+
0xb4, 0x2f, 0x12, 0xc2, 0x86, 0x7c, 0x7d, 0x4a, 0x00}; // one extra byte for null terminiation
424421

425422
BOOST_CHECK_EQUAL(true, m.get_data(14, &data, size));
426423
BOOST_CHECK_EQUAL(16, size);

0 commit comments

Comments
 (0)