diff options
author | geronimo <geronimo013@gmx.de> | 2012-07-30 09:12:30 +0200 |
---|---|---|
committer | geronimo <geronimo013@gmx.de> | 2012-07-30 09:12:30 +0200 |
commit | 2331befb330683d0e5459f9ca2d522f2f06c3d7e (patch) | |
tree | e95c3c4e40d57cbcf6af16d2736f34dce0279c4b /tests | |
parent | 570a18b0d0a9a00b240504ac949214d6cc96949b (diff) | |
download | cmp-2331befb330683d0e5459f9ca2d522f2f06c3d7e.tar.gz cmp-2331befb330683d0e5459f9ca2d522f2f06c3d7e.tar.bz2 |
worked out commandreader
Diffstat (limited to 'tests')
-rw-r--r-- | tests/FilesystemTest/FilesystemTest.layout | 4 | ||||
-rw-r--r-- | tests/MetaScanTest/MetaScanTest.layout | 4 | ||||
-rw-r--r-- | tests/MetaScanTest/main.cpp | 34 |
3 files changed, 28 insertions, 14 deletions
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 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <CodeBlocks_layout_file> <ActiveTarget name="Debug" /> - <File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <File name="main.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <Cursor> - <Cursor1 position="407" topLine="0" /> + <Cursor1 position="438" topLine="0" /> </Cursor> </File> </CodeBlocks_layout_file> 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 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <CodeBlocks_layout_file> <ActiveTarget name="Debug" /> - <File name="main.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <Cursor> - <Cursor1 position="1602" topLine="0" /> + <Cursor1 position="1575" topLine="9" /> </Cursor> </File> </CodeBlocks_layout_file> 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; |