Ignore:
Timestamp:
Jun 22, 2017, 12:02:34 AM (21 months ago)
Author:
faldebey
Message:

CoRE tool fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/combine/core.cpp

    r5519 r5527  
    44#include <boost/algorithm/string/classification.hpp>
    55#include <boost/algorithm/string/split.hpp>
     6#include <boost/filesystem.hpp>
    67#include <iostream>
    78#include <algorithm>
     
    1112#include "icgrep-test/icgrep-test.h"
    1213
    13 
    14 
    15 
    1614using namespace std;
    17 using testcase = pair<string, vector<string>>;
    18 
    19 
    20 
    21 void writeREtoFile(string re, string dir, int fileNo){
    22         string fileName = dir + to_string(fileNo);
    23         FILE * file;
    24         file = fopen(fileName.c_str(), "w");
    25         fprintf(file, "%s", re.c_str());
    26         fclose(file);
    27 }
    2815
    2916std::vector<string> vectorizeLine(string line){
     
    3118        boost::split(elements, line, boost::is_any_of(","), boost::token_compress_on);
    3219        return elements;
     20}
     21
     22void clearDir(string path){
     23        namespace fs = boost::filesystem;
     24        fs::path path_to_remove(path);
     25        for (fs::directory_iterator end_dir_it, it(path_to_remove); it!=end_dir_it; ++it) {
     26                fs::remove_all(it->path());
     27        }
    3328}
    3429
     
    6863        else {
    6964                IcgrepTest ictest;
    70                 system("exec rm -r ../icgrep/combine/regs/*");
    71                 system("exec rm -r ../icgrep/combine/files/*");
     65
     66                clearDir("../icgrep/combine/regs");
     67                clearDir("../icgrep/combine/files");
     68
    7269                ictest.prepare();
    7370
     
    8683                vector<string> header = setOptions(vectorizeLine(line), xml);
    8784                int rownum = 1;
    88                 std::vector<testcase> Testcases;
    8985                while(getline(file, line)){
    9086                        row = vectorizeLine(line);
Note: See TracChangeset for help on using the changeset viewer.