78 lines
2.4 KiB
C
78 lines
2.4 KiB
C
#ifndef Pickler_H
|
|
#define Pickler_H
|
|
|
|
struct pickle{
|
|
const char* name;
|
|
const char* message;
|
|
bool passed;
|
|
};
|
|
|
|
struct pickle_jar {
|
|
const char* name;
|
|
pickle* functions;
|
|
int functionCount;
|
|
bool passed;
|
|
} ;
|
|
|
|
struct pickle_shelf {
|
|
struct pickle_jar* pickle_jars;
|
|
int pickle_jarCount;
|
|
bool passed;
|
|
};
|
|
|
|
struct pickle_jar __pickle_add_jar(pickle_jar*, pickle, const char*);
|
|
struct pickle_shelf __pickle_jar_add_to_shelf(pickle_shelf*, pickle_jar);
|
|
int __pickle_shelf_run(pickle_shelf*);
|
|
|
|
|
|
/// -----Operation functions-----
|
|
/// These operation functions alow quick
|
|
/// and easy comparesons.
|
|
/// So that the user can make tests fast.
|
|
/// Tests should be easy and to create and
|
|
/// simpile to create. More functions will
|
|
/// be on the way but right now we have the
|
|
/// following.
|
|
///
|
|
/// - DIFFERENT(value1, value2): this allows the
|
|
/// user to check if the value is differrent in
|
|
/// any way. (value1 != value2)
|
|
///
|
|
/// - SAME(value1, value2): this allows the user
|
|
/// to check if both values are the same.
|
|
/// (value1 == value2)
|
|
///
|
|
/// - ASSERT(message, value): allows for a custome
|
|
/// message to be displayed when testing. The value
|
|
/// is/needs to be a boolean.
|
|
|
|
#define DIFFERENT(value1, value2) (value1 != value2)
|
|
#define SAME(value1, value2) (value1 == value2)
|
|
#define ASSERT(message, value) return {"name",message, value }
|
|
|
|
/// ------Using Pickle------
|
|
/// When using pickle there are some
|
|
/// helper deffinitions to create your
|
|
/// testing envirment.
|
|
/// - First, Use _INSTALLSHELF_ to
|
|
/// install the pickle shelf.
|
|
/// - Second, we need to create pickle
|
|
/// jars so that we can put pickles in
|
|
/// those jars. To create a pickle jar
|
|
/// run _CREATEJAR_ to create a pickle
|
|
/// jar.
|
|
/// -Third, We can now start canning!
|
|
/// First we need to create Pickls.
|
|
/// To create a pickle we need to run
|
|
/// _PICKLE_ pickle takes a name.
|
|
///
|
|
#define INSTALLSHELF struct pickle_shelf __pickle_shelf__ = { 0, 0, true };
|
|
#define CREATEJAR(jar_name) struct pickle_jar jar_name = {#jar_name, 0, 0, true};
|
|
#define PICKLE(name) struct pickle name = []() -> pickle
|
|
#define ADDPICKLE(jar,pickle) __pickle_add_jar(&jar, pickle, #pickle)
|
|
#define PUTJARONSHELF(jar) __pickle_jar_add_to_shelf(&__pickle_shelf__,jar);
|
|
#define PUTJARONASHELF(shelf,jar) __pickle_jar_add_to_shelf(&shelf,jar);
|
|
#define PICKLESHELF __pickle_shelf_run(&__pickle_shelf__)
|
|
#define APICKLESHELF(shelf) __pickle_shelf_run(&shelf)
|
|
#endif
|