diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-18 21:39:45 +0000 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-18 21:39:45 +0000 |
commit | f255f2498da1fd985ad1ed79362580bbf4675723 (patch) | |
tree | 3cd02e9d3147054820c58aacd1e5d3d336eea0d7 /test-chill/unit-tests/cprog/main.cc | |
parent | 7233faacb7990a6c3a40d2435ede88d7725dfc6e (diff) | |
download | chill-f255f2498da1fd985ad1ed79362580bbf4675723.tar.gz chill-f255f2498da1fd985ad1ed79362580bbf4675723.tar.bz2 chill-f255f2498da1fd985ad1ed79362580bbf4675723.zip |
rm test-chill, create doc subdir
Diffstat (limited to 'test-chill/unit-tests/cprog/main.cc')
-rw-r--r-- | test-chill/unit-tests/cprog/main.cc | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/test-chill/unit-tests/cprog/main.cc b/test-chill/unit-tests/cprog/main.cc deleted file mode 100644 index 3fe960b..0000000 --- a/test-chill/unit-tests/cprog/main.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include <cstdio> -#include <cstdlib> -#include <map> -#include <string> -#include <vector> - -#include "Sorter.h" -#include "QuickSorter.h" -#include "MergeSorter.h" -//#include "InsertionSorter.h" -//#include "ShellSorter.h" - -void read_vector(std::vector<int>& vec, int start, int stop, char** argv) { - for(int i = start; i < stop; i++) { - vec.push_back((int)strtol(argv[i],NULL,0)); - } -} - -void print_vector(std::vector<int>& vec) { - printf("["); - for(std::vector<int>::iterator iter = vec.begin(); iter != vec.end(); iter++) { - printf(" %d ", *iter); - } - printf("]\n"); -} - -void addsorter(std::map<std::string, Sorter*>& m, Sorter* s) { - m[s->name] = s; -} - -int main(int argc, char** argv) { - std::map<std::string, Sorter*> sorter_map; - std::vector<int> vec; - - read_vector(vec, 2, argc, argv); - print_vector(vec); - - addsorter(sorter_map, new QuickSorter()); - addsorter(sorter_map, new MergeSorter()); - //addsorter(sorter_map, new InsertionSorter()); - //addsorter(sorter_map, new ShellSorter()); - sorter_map[std::string(argv[1])]->sort(vec); - print_vector(vec); -} - |