Added testing! call kraken like so ./kraken --test ../path/to/test/name_of_test_without_extention This will make kraken compile and run name_of_test_without_extention.krak and compare the output it generates on stdout to name_of_test_without_extention.expected_results. If they pass, then it records the pass, if not, it records the failure and saves the intermediate files generated. It has revealed some bugs which I will fix in upcoming commits.
This commit is contained in:
31
include/Tester.h
Normal file
31
include/Tester.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#ifndef TESTER_H
|
||||
#define TESTER_H
|
||||
|
||||
class Tester {
|
||||
public:
|
||||
Tester(std::string krakenInvocation, std::string krakenGrammerLocation);
|
||||
~Tester();
|
||||
int ssystem(std::string command);
|
||||
bool run(std::string fileName);
|
||||
bool compareFiles(std::string file1Path, std::string file2Path);
|
||||
void cleanExtras(std::string fileName);
|
||||
|
||||
private:
|
||||
std::string krakenInvocation;
|
||||
std::string krakenGrammerLocation;
|
||||
std::string removeCmd;
|
||||
std::string resultsExtention;
|
||||
std::string expectedExtention;
|
||||
std::string krakenExtention;
|
||||
std::string shell;
|
||||
std::string changePermissions;
|
||||
std::string redirect;
|
||||
};
|
||||
#endif
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
|
||||
std::string intToString(int theInt);
|
||||
std::string replaceExEscape(std::string first, std::string search, std::string replace);
|
||||
@@ -16,6 +18,9 @@ std::string strSlice(std::string str, int begin, int end);
|
||||
int findPerenEnd(std::string str, int i);
|
||||
std::vector<std::string> split(const std::string &str, char delim);
|
||||
std::string join(const std::vector<std::string> &strVec, std::string joinStr);
|
||||
std::string readFile(std::istream &file);
|
||||
|
||||
|
||||
template <typename T>
|
||||
bool contains(std::vector<T> vec, T item) {
|
||||
for (auto i : vec)
|
||||
|
||||
Reference in New Issue
Block a user