fix: More C++ support.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
|
#ifndef __cplusplus
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -7,14 +8,16 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#ifndef INCLUDE_SET_H
|
#ifndef INCLUDE_SET_H
|
||||||
#define INCLUDE_SET_H
|
#define INCLUDE_SET_H
|
||||||
|
|
||||||
#define SET_MAX_ERROR_MSG_SIZE 256
|
|
||||||
#define SET_MAX_NAME_SIZE 64
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Meta data for one test function.
|
* Meta data for one test function.
|
||||||
*
|
*
|
||||||
|
@@ -25,7 +25,8 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct SETBlockMeta *meta = address - (sizeof(struct SETBlockMeta));
|
struct SETBlockMeta *meta =
|
||||||
|
(struct SETBlockMeta *)address - (sizeof(struct SETBlockMeta));
|
||||||
|
|
||||||
if (meta->prev == NULL)
|
if (meta->prev == NULL)
|
||||||
{
|
{
|
||||||
|
@@ -48,7 +48,7 @@ int create_shared_suit_space(size_t size)
|
|||||||
void *set_malloc(size_t n)
|
void *set_malloc(size_t n)
|
||||||
{
|
{
|
||||||
void *blocks = malloc(n + sizeof(struct SETBlockMeta));
|
void *blocks = malloc(n + sizeof(struct SETBlockMeta));
|
||||||
struct SETBlockMeta *meta = blocks;
|
struct SETBlockMeta *meta = (struct SETBlockMeta *)blocks;
|
||||||
meta->next = NULL;
|
meta->next = NULL;
|
||||||
meta->prev = NULL;
|
meta->prev = NULL;
|
||||||
|
|
||||||
|
12
testtest.cpp
Normal file
12
testtest.cpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include "set.h"
|
||||||
|
#include "set_asserts.h"
|
||||||
|
|
||||||
|
NO_SETUP;
|
||||||
|
|
||||||
|
NO_TEAR_DOWN;
|
||||||
|
|
||||||
|
TEST(Basic) { ASSERT_EQ(1, 1); }
|
||||||
|
|
||||||
|
SUIT(Basic) { ADD_TEST(Basic); }
|
||||||
|
|
||||||
|
BUNDLE() { ADD_SUIT(Basic); }
|
Reference in New Issue
Block a user