From 2331befb330683d0e5459f9ca2d522f2f06c3d7e Mon Sep 17 00:00:00 2001 From: geronimo Date: Mon, 30 Jul 2012 09:12:30 +0200 Subject: worked out commandreader --- tests/FilesystemTest/FilesystemTest.layout | 4 ++-- tests/MetaScanTest/MetaScanTest.layout | 4 ++-- tests/MetaScanTest/main.cpp | 34 +++++++++++++++++++++--------- 3 files changed, 28 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/tests/FilesystemTest/FilesystemTest.layout b/tests/FilesystemTest/FilesystemTest.layout index 6d88bc4..d39418a 100644 --- a/tests/FilesystemTest/FilesystemTest.layout +++ b/tests/FilesystemTest/FilesystemTest.layout @@ -1,9 +1,9 @@ - + - + diff --git a/tests/MetaScanTest/MetaScanTest.layout b/tests/MetaScanTest/MetaScanTest.layout index c9eeb3d..d189d61 100644 --- a/tests/MetaScanTest/MetaScanTest.layout +++ b/tests/MetaScanTest/MetaScanTest.layout @@ -1,9 +1,9 @@ - + - + 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 #include #include #include +#include #include #include #include @@ -14,15 +18,10 @@ #include #include #include +#include -//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; -- cgit v1.2.3