Lines Matching +full:1 +full:p1

8 #define SSHBUF_INTERNAL 1	/* access internals for testing */
27 #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
33 struct sshbuf *p1; in sshbuf_tests() local
40 p1 = sshbuf_new(); in sshbuf_tests()
41 ASSERT_PTR_NE(p1, NULL); in sshbuf_tests()
45 ASSERT_SIZE_T_GT(sshbuf_max_size(p1), 0); in sshbuf_tests()
49 ASSERT_SIZE_T_GT(sshbuf_avail(p1), 0); in sshbuf_tests()
53 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 0); in sshbuf_tests()
57 ASSERT_INT_EQ(sshbuf_set_max_size(p1, 65536), 0); in sshbuf_tests()
58 ASSERT_SIZE_T_EQ(sshbuf_max_size(p1), 65536); in sshbuf_tests()
62 ASSERT_SIZE_T_EQ(sshbuf_avail(p1), 65536); in sshbuf_tests()
66 sshbuf_free(p1); in sshbuf_tests()
70 p1 = sshbuf_new(); in sshbuf_tests()
71 ASSERT_PTR_NE(p1, NULL); in sshbuf_tests()
72 ASSERT_INT_EQ(sshbuf_consume(p1, 0), 0); in sshbuf_tests()
73 ASSERT_INT_EQ(sshbuf_consume(p1, 1), SSH_ERR_MESSAGE_INCOMPLETE); in sshbuf_tests()
74 sshbuf_free(p1); in sshbuf_tests()
78 p1 = sshbuf_new(); in sshbuf_tests()
79 ASSERT_PTR_NE(p1, NULL); in sshbuf_tests()
80 ASSERT_INT_EQ(sshbuf_consume_end(p1, 0), 0); in sshbuf_tests()
81 ASSERT_INT_EQ(sshbuf_consume_end(p1, 1), SSH_ERR_MESSAGE_INCOMPLETE); in sshbuf_tests()
82 sshbuf_free(p1); in sshbuf_tests()
86 p1 = sshbuf_new(); in sshbuf_tests()
87 ASSERT_PTR_NE(p1, NULL); in sshbuf_tests()
88 r = sshbuf_reserve(p1, 1, &dp); in sshbuf_tests()
92 r = sshbuf_reserve(p1, 3, &dp); in sshbuf_tests()
101 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 4); in sshbuf_tests()
105 cdp = sshbuf_ptr(p1); in sshbuf_tests()
108 ASSERT_U8_EQ(cdp[1], 0x22); in sshbuf_tests()
114 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 4); in sshbuf_tests()
115 ASSERT_INT_EQ(sshbuf_consume(p1, 0), 0); in sshbuf_tests()
116 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 4); in sshbuf_tests()
117 r = sshbuf_consume(p1, 64); in sshbuf_tests()
119 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 4); in sshbuf_tests()
120 ASSERT_INT_EQ(sshbuf_consume(p1, 1), 0); in sshbuf_tests()
121 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 3); in sshbuf_tests()
122 cdp = sshbuf_ptr(p1); in sshbuf_tests()
123 ASSERT_PTR_NE(p1, NULL); in sshbuf_tests()
125 ASSERT_INT_EQ(sshbuf_consume(p1, 2), 0); in sshbuf_tests()
126 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 1); in sshbuf_tests()
127 cdp = sshbuf_ptr(p1); in sshbuf_tests()
128 ASSERT_PTR_NE(p1, NULL); in sshbuf_tests()
130 r = sshbuf_consume(p1, 2); in sshbuf_tests()
132 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 1); in sshbuf_tests()
133 ASSERT_INT_EQ(sshbuf_consume(p1, 1), 0); in sshbuf_tests()
134 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 0); in sshbuf_tests()
135 r = sshbuf_consume(p1, 1); in sshbuf_tests()
137 sshbuf_free(p1); in sshbuf_tests()
141 p1 = sshbuf_new(); in sshbuf_tests()
142 ASSERT_PTR_NE(p1, NULL); in sshbuf_tests()
143 r = sshbuf_reserve(p1, 4, &dp); in sshbuf_tests()
150 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 4); in sshbuf_tests()
151 r = sshbuf_consume_end(p1, 5); in sshbuf_tests()
153 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 4); in sshbuf_tests()
154 ASSERT_INT_EQ(sshbuf_consume_end(p1, 3), 0); in sshbuf_tests()
155 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 1); in sshbuf_tests()
156 cdp = sshbuf_ptr(p1); in sshbuf_tests()
159 r = sshbuf_consume_end(p1, 2); in sshbuf_tests()
161 ASSERT_INT_EQ(sshbuf_consume_end(p1, 1), 0); in sshbuf_tests()
162 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 0); in sshbuf_tests()
163 sshbuf_free(p1); in sshbuf_tests()
167 p1 = sshbuf_new(); in sshbuf_tests()
168 ASSERT_PTR_NE(p1, NULL); in sshbuf_tests()
169 ASSERT_INT_EQ(sshbuf_set_max_size(p1, 1223), 0); in sshbuf_tests()
170 ASSERT_SIZE_T_EQ(sshbuf_max_size(p1), 1223); in sshbuf_tests()
171 ASSERT_SIZE_T_EQ(sshbuf_avail(p1), 1223); in sshbuf_tests()
172 r = sshbuf_reserve(p1, 1223, &dp); in sshbuf_tests()
176 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 1223); in sshbuf_tests()
177 ASSERT_SIZE_T_EQ(sshbuf_avail(p1), 0); in sshbuf_tests()
178 r = sshbuf_reserve(p1, 1, &dp); in sshbuf_tests()
184 ASSERT_INT_EQ(sshbuf_consume(p1, 223), 0); in sshbuf_tests()
185 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 1000); in sshbuf_tests()
186 ASSERT_SIZE_T_EQ(sshbuf_avail(p1), 223); in sshbuf_tests()
187 r = sshbuf_reserve(p1, 224, &dp); in sshbuf_tests()
190 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 1000); in sshbuf_tests()
191 ASSERT_SIZE_T_EQ(sshbuf_avail(p1), 223); in sshbuf_tests()
192 r = sshbuf_reserve(p1, 223, &dp); in sshbuf_tests()
196 cdp = sshbuf_ptr(p1); in sshbuf_tests()
203 r = sshbuf_set_max_size(p1, 1000); in sshbuf_tests()
206 ASSERT_INT_EQ(sshbuf_set_max_size(p1, sz), 0); in sshbuf_tests()
207 ASSERT_SIZE_T_EQ(sshbuf_max_size(p1), sz); in sshbuf_tests()
208 ASSERT_SIZE_T_EQ(sshbuf_avail(p1), sz - 1223); in sshbuf_tests()
209 ASSERT_INT_EQ(sshbuf_len(p1), 1223); in sshbuf_tests()
214 r = sshbuf_reserve(p1, 1, &dp); in sshbuf_tests()
218 cdp = sshbuf_ptr(p1); in sshbuf_tests()
222 ASSERT_MEM_FILLED_EQ(cdp + 1223, 0xff, 1); in sshbuf_tests()
223 ASSERT_SIZE_T_EQ(sshbuf_alloc(p1) % SSHBUF_SIZE_INC, 0); in sshbuf_tests()
224 sshbuf_free(p1); in sshbuf_tests()
228 p1 = sshbuf_new(); in sshbuf_tests()
229 ASSERT_PTR_NE(p1, NULL); in sshbuf_tests()
230 ASSERT_INT_EQ(sshbuf_set_max_size(p1, 1223), 0); in sshbuf_tests()
231 ASSERT_SIZE_T_EQ(sshbuf_max_size(p1), 1223); in sshbuf_tests()
232 r = sshbuf_reserve(p1, 1223, &dp); in sshbuf_tests()
236 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 1223); in sshbuf_tests()
237 sshbuf_reset(p1); in sshbuf_tests()
238 ASSERT_SIZE_T_EQ(sshbuf_max_size(p1), 1223); in sshbuf_tests()
239 ASSERT_SIZE_T_EQ(sshbuf_len(p1), 0); in sshbuf_tests()
240 ASSERT_SIZE_T_EQ(sshbuf_avail(p1), 1223); in sshbuf_tests()
241 sshbuf_free(p1); in sshbuf_tests()