@@ -132,10 +132,9 @@ TEST(Encoder, WhenTwoByteLengthByteStringGiven) {
132132}
133133
134134TEST (Encoder, WhenIndefiniteTextStringGiven) {
135- const char *fixed_text = " streaming" ;
136135 cbor_encode_text_string_indefinite (&writer);
137- cbor_encode_text_string (&writer, fixed_text, 5 );
138- cbor_encode_text_string (&writer, &fixed_text[ 5 ], 4 );
136+ cbor_encode_text_string (&writer, " strea " );
137+ cbor_encode_text_string (&writer, " ming " );
139138 LONGS_EQUAL (12 , writer.bufidx );
140139 LONGS_EQUAL (0x7F , writer.buf [0 ]);
141140 LONGS_EQUAL (0x65 , writer.buf [1 ]);
@@ -253,20 +252,20 @@ TEST(Encoder, WhenEncodedLengthMapGiven3) {
253252 0x44 ,0x61 ,0x65 ,0x61 ,0x45 };
254253 cbor_encode_map (&writer, 5 );
255254 // 1st item
256- cbor_encode_text_string (&writer, " a" , 1 );
257- cbor_encode_text_string (&writer, " A" , 1 );
255+ cbor_encode_text_string (&writer, " a" );
256+ cbor_encode_text_string (&writer, " A" );
258257 // 2nd
259- cbor_encode_text_string (&writer, " b" , 1 );
260- cbor_encode_text_string (&writer, " B" , 1 );
258+ cbor_encode_text_string (&writer, " b" );
259+ cbor_encode_text_string (&writer, " B" );
261260 // 3
262- cbor_encode_text_string (&writer, " c" , 1 );
263- cbor_encode_text_string (&writer, " C" , 1 );
261+ cbor_encode_text_string (&writer, " c" );
262+ cbor_encode_text_string (&writer, " C" );
264263 // 4
265- cbor_encode_text_string (&writer, " d" , 1 );
266- cbor_encode_text_string (&writer, " D" , 1 );
264+ cbor_encode_text_string (&writer, " d" );
265+ cbor_encode_text_string (&writer, " D" );
267266 // 5
268- cbor_encode_text_string (&writer, " e" , 1 );
269- cbor_encode_text_string (&writer, " E" , 1 );
267+ cbor_encode_text_string (&writer, " e" );
268+ cbor_encode_text_string (&writer, " E" );
270269 LONGS_EQUAL (21 , writer.bufidx );
271270 MEMCMP_EQUAL (expected, writer.buf , sizeof (expected));
272271}
@@ -275,9 +274,9 @@ TEST(Encoder, WhenIndefiniteLengthMapGiven) {
275274 const uint8_t expected[] = { 0xbf ,0x61 ,0x61 ,0x01 ,0x61 ,0x62 ,0x9f ,0x02 ,
276275 0x03 ,0xff ,0xff };
277276 cbor_encode_map_indefinite (&writer);
278- cbor_encode_text_string (&writer, " a" , 1 );
277+ cbor_encode_text_string (&writer, " a" );
279278 cbor_encode_unsigned_integer (&writer, 1 );
280- cbor_encode_text_string (&writer, " b" , 1 );
279+ cbor_encode_text_string (&writer, " b" );
281280 cbor_encode_array_indefinite (&writer);
282281 cbor_encode_unsigned_integer (&writer, 2 );
283282 cbor_encode_unsigned_integer (&writer, 3 );
@@ -290,10 +289,10 @@ TEST(Encoder, WhenIndefiniteLengthMapInArrayGiven) {
290289 const uint8_t expected[] = { 0x82 ,0x61 ,0x61 ,0xbf ,0x61 ,0x62 ,0x61 ,0x63 ,
291290 0xff };
292291 cbor_encode_array (&writer, 2 );
293- cbor_encode_text_string (&writer, " a" , 1 );
292+ cbor_encode_text_string (&writer, " a" );
294293 cbor_encode_map_indefinite (&writer);
295- cbor_encode_text_string (&writer, " b" , 1 );
296- cbor_encode_text_string (&writer, " c" , 1 );
294+ cbor_encode_text_string (&writer, " b" );
295+ cbor_encode_text_string (&writer, " c" );
297296 cbor_encode_break (&writer);
298297 LONGS_EQUAL (9 , writer.bufidx );
299298 MEMCMP_EQUAL (expected, writer.buf , sizeof (expected));
0 commit comments