Sigrid Solveig Haflínudóttirinitial import8808c535 months agoHistory
74 lines · 1.3 KB · C
RawDownload
#include <stdio.h>#include <stddef.h>#include <stdint.h>#include <setjmp.h>#include <string.h>#include <stdbool.h>#include <stdarg.h>#include <cmocka.h> struct buffer_in_the_middle { //# encoder	char a[8]; //#1	char b[8]; //#2	char c[8]; //#3 	char d[8]; //#5	int e; // #6	uint64_t f; //#7	uint64_t g; //#8 	uint8_t *h; //#10 num_at=h_size	int h_size; 	uint8_t buffer[256]; //# buffer=here 	char i[32]; //#11	char j[8]; //#12 	int k; //#15	int l; //#16}; #include "test_printer_buffer_in_the_middle.pb.h" voidtest_printer_buffer_in_the_middle(void **state){	struct buffer_in_the_middle m;	char buf[256];	uint8_t bytes[3] = {0, 1, 2}; 	(void)state;	memset(&m, 0, sizeof(m));	strcpy(m.a, "a");	strcpy(m.b, "b");	strcpy(m.c, "c");	strcpy(m.d, "d");	m.e = 1;	m.f = 2;	m.g = 3;	m.h = bytes;	m.h_size = sizeof(bytes);	strcpy(m.i, "i");	strcpy(m.j, "j");	m.k = 4;	m.l = 5;	assert_non_null(pb_seprint_buffer_in_the_middle(&m, buf, buf+sizeof(buf), 0, 1));	assert_string_equal(		buf,		"{\n"		" a = \"a\", // #1\n"		" b = \"b\", // #2\n"		" c = \"c\", // #3\n"		" d = \"d\", // #5\n"		" e = 1, // #6\n"		" f = 2, // #7\n"		" g = 3, // #8\n"		" h = 0x000102 (3 bytes), // #10\n"		" i = \"i\", // #11\n"		" j = \"j\", // #12\n"		" k = 4, // #15\n"		" l = 5, // #16\n"		"}"	);}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t