summaryrefslogtreecommitdiff
path: root/tests/MetaScanTest/main.cpp
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-07-30 09:12:30 +0200
committergeronimo <geronimo013@gmx.de>2012-07-30 09:12:30 +0200
commit2331befb330683d0e5459f9ca2d522f2f06c3d7e (patch)
treee95c3c4e40d57cbcf6af16d2736f34dce0279c4b /tests/MetaScanTest/main.cpp
parent570a18b0d0a9a00b240504ac949214d6cc96949b (diff)
downloadcmp-2331befb330683d0e5459f9ca2d522f2f06c3d7e.tar.gz
cmp-2331befb330683d0e5459f9ca2d522f2f06c3d7e.tar.bz2
worked out commandreader
Diffstat (limited to 'tests/MetaScanTest/main.cpp')
-rw-r--r--tests/MetaScanTest/main.cpp34
1 files changed, 24 insertions, 10 deletions
diff --git a/tests/MetaScanTest/main.cpp b/tests/MetaScanTest/main.cpp
index 62c1bda..751186e 100644
--- a/tests/MetaScanTest/main.cpp
+++ b/tests/MetaScanTest/main.cpp
@@ -1,10 +1,14 @@
/*
- * test case for scanning of meta data
+ * File: MetaScanTest.cc
+ * Author: django
+ *
+ * Created on 27.07.2012, 10:03
*/
#include <File.h>
#include <FileReader.h>
#include <LineReader.h>
#include <ConfigReader.h>
+#include <CommandReader.h>
#include <iostream>
#include <stdlib.h>
#include <string.h>
@@ -14,15 +18,10 @@
#include <unistd.h>
#include <wait.h>
#include <tr1/tuple>
+#include <util.h>
-//static const char *mediaInfo = NULL;
-//static const char *ffmpeg = NULL;
static void testPipe(const char *chk = NULL);
-#define ASSERT_IS(rv, x) if (x != rv) { fprintf(stderr, "assertation failed at %s #%d\n",__FILE__,__LINE__); exit(-1); }
-#define ASSERT_NOT(rv, x) if (x == rv) { fprintf(stderr, "assertation failed at %s #%d\n",__FILE__,__LINE__); exit(-1); }
-#define FAIL(s) fprintf(stderr, s);
-
static void parseConfig(const char *FileName)
{
cConfigReader *cr = new cConfigReader(new cLineReader(new cFileReader(new cFile(FileName))));
@@ -55,6 +54,21 @@ enum PipeFileDescriptors {
WRITE_FD = 1
};
+static void testCommandReader()
+{
+ cCommandReader *cr = new cCommandReader("/bin/ls");
+ cLineReader *lr = new cLineReader(cr);
+ const char *line;
+
+ cr->AddCommandParameter("-al");
+ cr->AddCommandParameter("--color");
+
+ while ((line = lr->ReadLine())) {
+ std::cout << "from command: " << line << std::endl;
+ }
+ delete lr;
+};
+
static void testPipe(const char *chk)
{
int parent2Child[2];
@@ -137,10 +151,10 @@ int main()
parseConfig("srserver.conf");
std::cout << std::endl << "===========================================" << std::endl << std::endl;
- testPipe();
+ testCommandReader();
- std::cout << std::endl << "===========================================" << std::endl << std::endl;
- testMediaFiles("testMedia.files");
+// std::cout << std::endl << "===========================================" << std::endl << std::endl;
+// testMediaFiles("testMedia.files");
cFile::Cleanup();
return 0;