Embedded Artistry Framework
Embedded Systems C++ Framework
Macros | Functions
memmem.c File Reference
#include "string_tests.h"
#include <string.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <cmocka.h>
Include dependency graph for memmem.c:

Macros

#define N(s, tail, sub)
 
#define T(s, sub, n)
 
#define T_NULL(s, sub, n)
 

Functions

static void check_input (void **state)
 
int memmem_tests (void)
 

Macro Definition Documentation

◆ N

#define N (   s,
  tail,
  sub 
)
Value:
{ \
char* p = s tail; \
char* q = memmem(p, strlen(s), sub, strlen(sub)); \
assert_ptr_equal(q, NULL); \
}
void * memmem(const void *l, size_t l_len, const void *s, size_t s_len)
Find substring s in memory area l.
Definition: memmem.c:34
static const char * s[]
Definition: heapsort.c:22
size_t strlen(const char *str)
Returns the length of the given null-terminated byte string.
Definition: strlen.c:77
#define NULL
Definition: test_suite.cpp:15
static void * p[ALLOCATION_TEST_COUNT]
Definition: malloc_freelist.c:21

◆ T

#define T (   s,
  sub,
  n 
)
Value:
{ \
char* p = s; \
char* q = memmem(p, strlen(p), sub, strlen(sub)); \
assert_ptr_not_equal(q, NULL); \
assert_ptr_equal(q - p, n); \
}
void * memmem(const void *l, size_t l_len, const void *s, size_t s_len)
Find substring s in memory area l.
Definition: memmem.c:34
static const char * s[]
Definition: heapsort.c:22
size_t strlen(const char *str)
Returns the length of the given null-terminated byte string.
Definition: strlen.c:77
#define NULL
Definition: test_suite.cpp:15
static int n[]
Definition: heapsort.c:32
static void * p[ALLOCATION_TEST_COUNT]
Definition: malloc_freelist.c:21

◆ T_NULL

#define T_NULL (   s,
  sub,
  n 
)
Value:
{ \
char* p = s; \
char* q = memmem(p, strlen(p), sub, strlen(sub)); \
assert_ptr_equal(q, NULL); \
}
void * memmem(const void *l, size_t l_len, const void *s, size_t s_len)
Find substring s in memory area l.
Definition: memmem.c:34
static const char * s[]
Definition: heapsort.c:22
size_t strlen(const char *str)
Returns the length of the given null-terminated byte string.
Definition: strlen.c:77
#define NULL
Definition: test_suite.cpp:15
static void * p[ALLOCATION_TEST_COUNT]
Definition: malloc_freelist.c:21

Function Documentation

◆ check_input()

static void check_input ( void **  state)
static

References N, T, and T_NULL.

Referenced by memmem_tests().

◆ memmem_tests()

int memmem_tests ( void  )

References check_input(), memmem_tests(), and NULL.

Referenced by memmem_tests(), and string_tests().

Here is the caller graph for this function: