#include "test_pbuf.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"
Go to the source code of this file.
◆ TESTBUFSIZE_1
◆ TESTBUFSIZE_2
◆ TESTBUFSIZE_3
◆ pbuf_setup()
Definition at line 16 of file test_pbuf.c.
17{
19}
void lwip_check_ensure_no_alloc(unsigned int skip)
Referenced by pbuf_suite().
◆ pbuf_suite()
END_TEST Suite * pbuf_suite |
( |
void |
| ) |
|
Create the suite including all tests for this module
Definition at line 346 of file test_pbuf.c.
347{
349 TESTFUNC(test_pbuf_alloc_zero_pbufs),
351 TESTFUNC(test_pbuf_copy_unmatched_chains),
352 TESTFUNC(test_pbuf_copy_partial_pbuf),
353 TESTFUNC(test_pbuf_split_64k_on_small_pbufs),
354 TESTFUNC(test_pbuf_queueing_bigger_than_64k),
357 };
359}
Suite * create_suite(const char *name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown)
static struct test_info tests[]
static void pbuf_setup(void)
static void pbuf_teardown(void)
Referenced by main().
◆ pbuf_teardown()
◆ START_TEST() [1/8]
START_TEST |
( |
test_pbuf_alloc_zero_pbufs |
| ) |
|
Definition at line 39 of file test_pbuf.c.
40{
43
45 fail_unless(
p !=
NULL);
48 }
49
51 fail_unless(
p !=
NULL);
54 }
55
57 fail_unless(
p !=
NULL);
60 }
61
63 fail_unless(
p !=
NULL);
66 }
67}
#define LWIP_UNUSED_ARG(x)
struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
u8_t pbuf_free(struct pbuf *p)
◆ START_TEST() [2/8]
END_TEST START_TEST |
( |
test_pbuf_copy_partial_pbuf |
| ) |
|
Definition at line 148 of file test_pbuf.c.
149{
151 char lwip[] = "lwip ";
155
157 fail_unless(
a !=
NULL);
160 fail_unless(
b !=
NULL);
166
167
170
173
176 fail_unless(
strcmp(
"lwip packet", (
char*)
dest->payload) == 0);
177
180 fail_unless(
strcmp(
"llwip packet", (
char*)
dest->payload) == 0);
181
184 fail_unless(
strcmp(
"llwip lwip p", (
char*)
dest->payload) == 0);
185
188 fail_unless(
strcmp(
"lwip lwip p", (
char*)
dest->payload) == 0);
189
192}
int strcmp(const char *String1, const char *String2)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
void pbuf_cat(struct pbuf *h, struct pbuf *t)
err_t pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_len, u16_t offset)
◆ START_TEST() [3/8]
END_TEST START_TEST |
( |
test_pbuf_copy_unmatched_chains |
| ) |
|
Call pbuf_copy on pbufs with chains of different sizes
Definition at line 100 of file test_pbuf.c.
101{
106
108
109
110 for (
i = 0;
i < 8;
i++) {
112 fail_unless(
p !=
NULL);
113 for (
j = 0;
j <
p->len;
j++) {
115 }
118 } else {
120 }
121 }
124 }
125
126
130 fail_unless(
p !=
NULL);
133 fail_unless(
p !=
NULL);
135
136
141 }
142
145}
unsigned short int uint16_t
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
u8_t pbuf_get_at(const struct pbuf *p, u16_t offset)
err_t pbuf_copy(struct pbuf *p_to, const struct pbuf *p_from)
◆ START_TEST() [4/8]
END_TEST START_TEST |
( |
test_pbuf_copy_zero_pbuf |
| ) |
|
Call pbuf_copy on a pbuf with zero length
Definition at line 71 of file test_pbuf.c.
72{
73 struct pbuf *p1, *p2, *p3;
76
78 fail_unless(p1 !=
NULL);
79 fail_unless(p1->
ref == 1);
80
82 fail_unless(p2 !=
NULL);
83 fail_unless(p2->
ref == 1);
85
87 fail_unless(p1->
ref == 1);
88 fail_unless(p2->
ref == 1);
89
93
96}
◆ START_TEST() [5/8]
END_TEST START_TEST |
( |
test_pbuf_get_put_at_edge |
| ) |
|
Definition at line 317 of file test_pbuf.c.
318{
325
326 fail_if(
p->tot_len ==
p->len);
329
330
332
335 "Bad data at pos %d, was %02X, expected %02X",
p->len, *
out,
testdata);
336
338 fail_unless(*
out == getdata,
339 "pbuf_get_at() returned bad data at pos %d, was %02X, expected %02X",
p->len, getdata, *
out);
341}
GLdouble GLdouble GLdouble GLdouble q
void pbuf_put_at(struct pbuf *p, u16_t offset, u8_t data)
◆ START_TEST() [6/8]
END_TEST START_TEST |
( |
test_pbuf_queueing_bigger_than_64k |
| ) |
|
Definition at line 207 of file test_pbuf.c.
208{
213
216 }
219 }
222 }
223
225 fail_unless(p1 !=
NULL);
227 fail_unless(p2 !=
NULL);
229 fail_unless(p3 !=
NULL);
236
239
240 pbuf_split_64k(p1, &rest2);
243 pbuf_split_64k(rest2, &rest3);
246
253
257}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
u16_t pbuf_copy_partial(const struct pbuf *buf, void *dataptr, u16_t len, u16_t offset)
err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len)
_Check_return_ int __cdecl rand(void)
static u8_t testbuf_1a[TESTBUFSIZE_1]
static u8_t testbuf_2[TESTBUFSIZE_2]
static u8_t testbuf_1[TESTBUFSIZE_1]
static u8_t testbuf_3a[TESTBUFSIZE_3]
static u8_t testbuf_3[TESTBUFSIZE_3]
static u8_t testbuf_2a[TESTBUFSIZE_2]
◆ START_TEST() [7/8]
END_TEST START_TEST |
( |
test_pbuf_split_64k_on_small_pbufs |
| ) |
|
Definition at line 195 of file test_pbuf.c.
196{
199
201 pbuf_split_64k(
p, &rest);
202 fail_unless(
p->tot_len == 1);
204}
◆ START_TEST() [8/8]
END_TEST START_TEST |
( |
test_pbuf_take_at_edge |
| ) |
|
Definition at line 264 of file test_pbuf.c.
265{
273
274 fail_if(
p->tot_len ==
p->len);
277
278
281
285 "Bad data at pos %d, was %02X, expected %02X",
i,
out[
i],
testdata[
i]);
286 }
287
288
291
294 "Bad data at pos %d, was %02X, expected %02X",
p->len - 1,
out[
p->len - 1],
testdata[0]);
298 "Bad data at pos %d, was %02X, expected %02X",
p->len - 1 +
i,
out[
i-1],
testdata[
i]);
299 }
300
301
304
308 "Bad data at pos %d, was %02X, expected %02X",
p->len+
i,
out[
i],
testdata[
i]);
309 }
311}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
err_t pbuf_take_at(struct pbuf *buf, const void *dataptr, u16_t len, u16_t offset)
◆ testbuf_1
◆ testbuf_1a
◆ testbuf_2
◆ testbuf_2a
◆ testbuf_3
◆ testbuf_3a