Adds ONE_OF. Breaks some lines at 80 columns.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <deepstate/DeepState.h>
|
||||
#include <deepstate/Stream.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -200,8 +201,16 @@ inline static void ForAll(Closure func) {
|
||||
func(Symbolic<Args>()...);
|
||||
}
|
||||
|
||||
template <typename... FuncTys>
|
||||
inline static void OneOf(FuncTys&&... funcs) {
|
||||
std::function<void(void)> func_arr[sizeof...(FuncTys)] = {funcs...};
|
||||
func_arr[DeepState_SizeInRange(0, sizeof...(funcs))]();
|
||||
}
|
||||
|
||||
} // namespace deepstate
|
||||
|
||||
#define ONE_OF ::deepstate::OneOf
|
||||
|
||||
#define TEST(category, name) \
|
||||
DeepState_EntryPoint(category ## _ ## name)
|
||||
|
||||
|
||||
@@ -29,25 +29,27 @@ DEEPSTATE_BEGIN_EXTERN_C
|
||||
extern void DeepState_LogStream(enum DeepState_LogLevel level);
|
||||
|
||||
/* Stream a C string into the stream's message. */
|
||||
extern void DeepState_StreamCStr(enum DeepState_LogLevel level, const char *begin);
|
||||
extern void DeepState_StreamCStr(enum DeepState_LogLevel level,
|
||||
const char *begin);
|
||||
|
||||
/* TODO(pag): Implement `DeepState_StreamWCStr` with `wchar_t`. */
|
||||
|
||||
/* Stream a some data in the inclusive range `[begin, end]` into the
|
||||
* stream's message. */
|
||||
/*extern void DeepState_StreamData(enum DeepState_LogLevel level, const void *begin,
|
||||
const void *end);*/
|
||||
/*extern void DeepState_StreamData(
|
||||
enum DeepState_LogLevel level, const void *begin, const void *end); */
|
||||
|
||||
/* Stream some formatted input */
|
||||
extern void DeepState_StreamFormat(enum DeepState_LogLevel level, const char *format,
|
||||
...);
|
||||
extern void DeepState_StreamFormat(
|
||||
enum DeepState_LogLevel level, const char *format, ...);
|
||||
|
||||
/* Stream some formatted input */
|
||||
extern void DeepState_StreamVFormat(enum DeepState_LogLevel level, const char *format,
|
||||
va_list args);
|
||||
extern void DeepState_StreamVFormat(
|
||||
enum DeepState_LogLevel level, const char *format, va_list args);
|
||||
|
||||
#define DEEPSTATE_DECLARE_STREAMER(Type, type) \
|
||||
extern void DeepState_Stream ## Type(enum DeepState_LogLevel level, type val);
|
||||
extern void DeepState_Stream ## Type( \
|
||||
enum DeepState_LogLevel level, type val);
|
||||
|
||||
DEEPSTATE_DECLARE_STREAMER(Double, double);
|
||||
DEEPSTATE_DECLARE_STREAMER(Pointer, void *);
|
||||
@@ -66,8 +68,8 @@ DEEPSTATE_DECLARE_STREAMER(Int8, int8_t)
|
||||
|
||||
#undef DEEPSTATE_DECLARE_STREAMER
|
||||
|
||||
DEEPSTATE_INLINE static void DeepState_StreamFloat(enum DeepState_LogLevel level,
|
||||
float val) {
|
||||
DEEPSTATE_INLINE static void DeepState_StreamFloat(
|
||||
enum DeepState_LogLevel level, float val) {
|
||||
DeepState_StreamDouble(level, (double) val);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user