fix: Adding Header guards.
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
#ifndef INCLUDE_SET_LIST_
|
||||||
|
#define INCLUDE_SET_LIST_
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
struct SETBlockMeta
|
struct SETBlockMeta
|
||||||
@@ -31,3 +34,5 @@ void set_ll_free_all(struct SETBlockMeta *head);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct SETBlockMeta *set_ll_free_one(struct SETBlockMeta *head, void *address);
|
struct SETBlockMeta *set_ll_free_one(struct SETBlockMeta *head, void *address);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
117
include/set.h
117
include/set.h
@@ -2,6 +2,11 @@
|
|||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -18,66 +23,66 @@
|
|||||||
#ifndef INCLUDE_SET_H
|
#ifndef INCLUDE_SET_H
|
||||||
#define INCLUDE_SET_H
|
#define INCLUDE_SET_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Meta data for one test function.
|
* Meta data for one test function.
|
||||||
*
|
*
|
||||||
* See also: struct SETSuit
|
* See also: struct SETSuit
|
||||||
*/
|
*/
|
||||||
struct SETest
|
struct SETest
|
||||||
{
|
{
|
||||||
void (*function)(struct SETest *test);
|
void (*function)(struct SETest *test);
|
||||||
const char *error_msg;
|
const char *error_msg;
|
||||||
const char *name;
|
const char *name;
|
||||||
bool passed;
|
bool passed;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Meta data for one test suit.
|
* Meta data for one test suit.
|
||||||
*
|
*
|
||||||
* See also: struct SETest
|
* See also: struct SETest
|
||||||
*/
|
*/
|
||||||
struct SETSuit
|
struct SETSuit
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
struct SETest *tests;
|
struct SETest *tests;
|
||||||
int len;
|
int len;
|
||||||
int shm_key;
|
int shm_key;
|
||||||
bool (*setup)();
|
bool (*setup)();
|
||||||
bool (*tear_down)();
|
bool (*tear_down)();
|
||||||
bool passed;
|
bool passed;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal function header for bundle. Use BUNDLE() macro to define bundle in
|
* Internal function header for bundle. Use BUNDLE() macro to define bundle
|
||||||
* test.
|
* in test.
|
||||||
*/
|
*/
|
||||||
void set_bundle_suits(struct SETSuit **suits, int *counter, bool count);
|
void set_bundle_suits(struct SETSuit **suits, int *counter, bool count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty suit_setup. Resolving EMPTY in a suit constructor gets
|
* Empty suit_setup. Resolving EMPTY in a suit constructor gets
|
||||||
* us here.
|
* us here.
|
||||||
*
|
*
|
||||||
* Note: Use EMPTY instead of this function.
|
* Note: Use EMPTY instead of this function.
|
||||||
*/
|
*/
|
||||||
static bool EMPTY_suit_setup() { return true; }
|
static bool EMPTY_suit_setup() { return true; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty suit_tear_down. Resolving EMPTY in a suit constructor gets
|
* Empty suit_tear_down. Resolving EMPTY in a suit constructor gets
|
||||||
* us here.
|
* us here.
|
||||||
*
|
*
|
||||||
* Note: Use EMPTY instead of this function.
|
* Note: Use EMPTY instead of this function.
|
||||||
*/
|
*/
|
||||||
static bool EMPTY_suit_tear_down() { return true; }
|
static bool EMPTY_suit_tear_down() { return true; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal header for global setup. Use SETUP() macro instead.
|
* Internal header for global setup. Use SETUP() macro instead.
|
||||||
*/
|
*/
|
||||||
bool set_up();
|
bool set_up();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal header for global tear down. Use TEAR_DOWN() macro instead.
|
* Internal header for global tear down. Use TEAR_DOWN() macro instead.
|
||||||
*/
|
*/
|
||||||
bool tear_down();
|
bool tear_down();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global setup function.
|
* Global setup function.
|
||||||
@@ -246,3 +251,7 @@ bool tear_down();
|
|||||||
void test_name##_test(struct SETest *test)
|
void test_name##_test(struct SETest *test)
|
||||||
|
|
||||||
#endif // !INCLUDE_SET_H
|
#endif // !INCLUDE_SET_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include "set.h"
|
#include "set.h"
|
||||||
|
|
||||||
#ifndef ASSERT_H
|
#ifndef INCLUDE_SET_ASSERT_H
|
||||||
#define ASSERT_H
|
#define INCLUDE_SET_ASSERT_H
|
||||||
|
|
||||||
#define STATIC_ASSERT(condition) (void)sizeof(char[1 - 2 * (!(condition))])
|
#define STATIC_ASSERT(condition) (void)sizeof(char[1 - 2 * (!(condition))])
|
||||||
|
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifndef INCLUDE_SET_UTILS_H_
|
||||||
|
#define INCLUDE_SET_UTILS_H_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns pointer to formatted the string.
|
* Returns pointer to formatted the string.
|
||||||
*
|
*
|
||||||
@@ -52,3 +55,5 @@ void *set_calloc(size_t n, size_t size);
|
|||||||
* See also: set_malloc()
|
* See also: set_malloc()
|
||||||
*/
|
*/
|
||||||
void *set_realloc(size_t n);
|
void *set_realloc(size_t n);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user