Pickler
Have you ever just wanted pickles to the point where you needed them in your code. Well do we have the test sweet for you. We prosent PICKLER the light weight unpickling API. Let me ask you this. Is your code stuck in a pickle well, this AIP will salve all of your pickle stuck situations. Just include this into your cmake project and start writing with pickles.
Techinal Definitions
So PICKLER alows for unit testing with 100% natrual pickles. Not the GMO testing that you get with the googles goods. Lets go back to basics, what is a pickle?
- Pickle : Is a unit test.
- Pickle_Jar : This allows use to catagorize the pickles and tests them.
- Pickle_Shelf : This holds all of the Pickle_Jars and tests all of the jars.
The definitions for passing a test are a little different. Here are the definitions.
-
Pickled : This means that a pickle test passed.
-
Droped the Pickle : This means that a pickle test failed.
-
Pickles In Jar : This means that all pickles passed.
-
Pickle Jar Broke: This means that one or more of the pickles failed there test.
-
Pickle Shelf Good : This means that all Pickle Jars passed.
-
Pickle Shelf Fell : This means that one or more Pickle Jars failed.
How To Use
To init the Pickler Lib first include Pickler.h
#include "Pickler.h"
After includeing Pickler next we need to init Pickler. This is vary simple. Just
add into your int main() INSTALLSHELF This creates a safe place to put your pickle
jars.
#include "Pickler.h"
int main() {
// init the shelf
INSTALLSHELF();
}
Once The shelf is created we can create Pickle Jars. To Create a pickle jar
call CREATEJAR(name) This will create a pickle jar. The Pickle Jar must be created
after the shelf. The Pickle Jar requires a name. This name should be entererd in
plain text and with no speshial characters and should be treated like a varaible name.
#include "Pickler.h"
int main() {
// init the shelf
INSTALLSHELF();
// Creating Pickle Jar
CREATEJAR(jar_name);
}
Next we can make Pickles. To Create a Pickle just use the `PICKLE' macro. Treate this like a lambda expretion. A Pickle should look like this.
#include "Pickler.h"
int main() {
// init the shelf
INSTALLSHELF();
// Creating Pickle Jar
CREATEJAR(jar_name);
// Creating a pickle
PICKLE(pickle_name) {
// test contents.
}();
PICKLE(pickle_name2) {
// test contents.
}();
}
To make the pickle functions not throw a error you must add a ASSERT(message, passed). The assert
will reporte to the pickle jar to tell the pickle jar to see if the pickle was droped
or was pickled. (Faled or Successed). Here is how to use the ASSERT(message, passed).
#include "Pickler.h"
int main() {
// init the shelf
INSTALLSHELF();
// Creating Pickle Jar
CREATEJAR(jar_name);
// Creating a pickle
PICKLE(pickle_name) {
// test contents.
ASSERT("This is a test that will faile", false)
}();
PICKLE(pickle_name2) {
// test contents.
ASSERT("This is a test that will successed", true)
}();
}
There are two objects that will make the assert a little easier to use. There is
SAME(value1,value2) and DIFFERENT(value1,value2) that will test to see if the
objects are the same or they are different.
#include "Pickler.h"
int main() {
// init the shelf
INSTALLSHELF();
// Creating Pickle Jar
CREATEJAR(jar_name);
// Creating a pickle
PICKLE(pickle_name) {
// test contents.
ASSERT("This is a test that will successed", DIFFERENT(1,2))
}();
PICKLE(pickle_name2) {
// test contents.
ASSERT("This is a test that will successed", SAME(2,2))
}();
}
Now we need to add pickles to the pickle jar. To add pickles to the pickle jar use
ADDPICKLE(jar,pickle) to add a pickle to a pickle jar.
#include "Pickler.h"
int main() {
// init the shelf
INSTALLSHELF();
// Creating Pickle Jar
CREATEJAR(jar_name);
// Creating a pickle
PICKLE(pickle_name) {
// test contents.
ASSERT("This is a test that will successed", DIFFERENT(1,2))
}();
PICKLE(pickle_name2) {
// test contents.
ASSERT("This is a test that will successed", SAME(2,2))
}();
// Adding pickls to pickle jar
ADDPICKLE(jar_name, pickle_name);
ADDPICKLE(jar_name, pickle_name2);
}
The pickles have now been added to the pickle jar, but now we need to add the
pickle jar to the pickle shelf. To do this just simply add PUTJARONSHELF(jar).
This macro will add the pickle jar to the shelf.
#include "Pickler.h"
int main() {
// init the shelf
INSTALLSHELF();
// Creating Pickle Jar
CREATEJAR(jar_name);
// Creating a pickle
PICKLE(pickle_name) {
// test contents.
ASSERT("This is a test that will successed", DIFFERENT(1,2))
}();
PICKLE(pickle_name2) {
// test contents.
ASSERT("This is a test that will successed", SAME(2,2))
}();
// Adding pickls to pickle jar
ADDPICKLE(jar_name, pickle_name);
ADDPICKLE(jar_name, pickle_name2);
// Adding pickle jar to pickle shelf.
PUTJARONSHELF(jar_name);
}
Now The last step to use Pickler. For the return of main just return PICKLESHELF.
Thats it.
#include "Pickler.h"
int main() {
// init the shelf
INSTALLSHELF();
// Creating Pickle Jar
CREATEJAR(jar_name);
// Creating a pickle
PICKLE(pickle_name) {
// test contents.
ASSERT("This is a test that will successed", DIFFERENT(1,2))
}();
PICKLE(pickle_name2) {
// test contents.
ASSERT("This is a test that will successed", SAME(2,2))
}();
// Adding pickls to pickle jar
ADDPICKLE(jar_name, pickle_name);
ADDPICKLE(jar_name, pickle_name2);
// Adding pickle jar to pickle shelf.
PUTJARONSHELF(jar_name);
return PICKLESHELF;
}
Now you are a master of pickling software. Use these skills as a Pickler master wizly because now you hold a great power of pickling software.