#include #include "Pickler.h" struct pickle_jar __pickle_add_jar(pickle_jar* jar, pickle p, const char* pname) { auto tmp = new pickle[jar->functionCount + 1]; for (int i = 0; i < jar->functionCount; i++) { tmp[i] = jar->functions[i]; } p.name = pname; tmp[jar->functionCount] = p; jar->functions = tmp; jar->functionCount++; return *jar; } struct pickle_shelf __pickle_jar_add_to_shelf(pickle_shelf* shelf, pickle_jar jar) { struct pickle_jar* tmps = new pickle_jar[shelf->pickle_jarCount + 1]; for(int i = 0; i < shelf->pickle_jarCount; i++) { tmps[i] = shelf->pickle_jars[i]; } tmps[shelf->pickle_jarCount] = jar; shelf->pickle_jars = tmps; shelf->pickle_jarCount++; return *shelf; } void printoutShelf(pickle_shelf shelf) { std::cout << "\033[1;92mPICKLER\033[1;39;49m There are \033[1;92m-[" << shelf.pickle_jarCount << "]-\033[1;39;49m Pickle Jars on the shelf\n"; } void printoutShelfEnd(pickle_shelf shelf) { std::cout << "[====Pickle Shelf====]\n"; if(shelf.passed) { std::cout << "\033[1;92m[==Pickle Shelf Good=]\033[1;39;49m\n"; }else { std::cout << "\033[1;31m[==Pickle Shelf Fell=]\033[1;39;49m\n"; } } void printoutJar(pickle_jar jar) { std::cout << "There are \033[1;92m-["<< jar.functionCount <<"]- Pickles \033[1;39;49min \033[1;94;49m"<< jar.name <<"\033[1;39;49m Pickle Jar\n"; } void printoutJarEnd(pickle_jar jar) { std::cout << "[=====Pickle Jar=====]\n"; if(jar.passed) { std::cout << "\033[1;92m[===Pickles In Jar===]\033[1;39;49m\n"; } else { std::cout << "\033[1;31m[==Pickle Jar Broke==]\033[1;39;49m Broken Jar at \033[1;33m" << jar.name << "\033[1;39;49m\n"; } } void printoutPickle(pickle p) { std::cout << "[======Pickling======] \033[1;92m" << p.name << "\033[1;39;49m Running \n"; if(p.passed) { std::cout << "\033[1;92m[=======Pickled======]\n"; }else { std::cout << "\033[1;31m[==Droped the Pickle=] " << p.message<<"\n"; } std::cout << "[========DONE========]\033[1;39;49m\n"; } int __pickle_shelf_run(pickle_shelf * shelf) { int status = 0; printoutShelf(*shelf); shelf->passed = true; for(int i = 0; i < shelf->pickle_jarCount; i++) { printoutJar(shelf->pickle_jars[i]); shelf->pickle_jars[i].passed = true; for(int j = 0; j < shelf->pickle_jars[i].functionCount; j++) { printoutPickle(shelf->pickle_jars[i].functions[j]); if(!shelf->pickle_jars[i].functions[j].passed) { shelf->pickle_jars[i].passed = false; shelf->passed = false; status--; } } printoutJarEnd(shelf->pickle_jars[i]); } printoutShelfEnd(*shelf); return status; }