summaryrefslogtreecommitdiff
path: root/test-chill/unit-tests/cprog/main.cc
diff options
context:
space:
mode:
authorDerick Huth <derickhuth@gmail.com>2015-09-24 12:22:41 -0600
committerDerick Huth <derickhuth@gmail.com>2015-09-24 12:22:41 -0600
commit4631ad76927d433da5d55c3c373a1dfd0f74c9d4 (patch)
treef8dcba88576ec95e403f0c14efd80e970f30a260 /test-chill/unit-tests/cprog/main.cc
parent6eb2b89896da66a77d0dcdf2d72b98c122826949 (diff)
parent0cff3f9a3c4ccd434900162ebef4bd814850f481 (diff)
downloadchill-4631ad76927d433da5d55c3c373a1dfd0f74c9d4.tar.gz
chill-4631ad76927d433da5d55c3c373a1dfd0f74c9d4.tar.bz2
chill-4631ad76927d433da5d55c3c373a1dfd0f74c9d4.zip
Merge pull request #7 from dhuth/master
V0.2.1
Diffstat (limited to 'test-chill/unit-tests/cprog/main.cc')
-rw-r--r--test-chill/unit-tests/cprog/main.cc45
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);
-}
-