ts_SchemeParser.cpp
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00022 //----------------------------------------------------------------------
00023 #include <icl_core/BaseTypes.h>
00024 #include <icl_core/SchemeParser.h>
00025 
00026 #include <boost/test/unit_test.hpp>
00027 #include <list>
00028 
00029 using icl_core::SchemeParser;
00030 
00031 BOOST_AUTO_TEST_SUITE(ts_tParser)
00032 
00033 BOOST_AUTO_TEST_CASE(TestStaticParser)
00034 {
00035   BOOST_SPIRIT_NAMESPACE::parse_info<> info;
00036   icl_core::Scheme scheme;
00037   scheme.scheme_type = icl_core::OtherScheme;
00038   icl_core::String input = "file:///path/to/file/data.abc#anchor123?foo=bar&test=me";
00039 
00040   BOOST_CHECK_EQUAL(icl_core::SchemeParser::parseScheme(input, scheme, info), true);
00041   BOOST_CHECK_EQUAL(scheme.scheme_type, icl_core::FileScheme);
00042   BOOST_CHECK_EQUAL(scheme.specifier, "/path/to/file/data.abc");
00043   BOOST_CHECK_EQUAL(scheme.anchor, "anchor123");
00044   BOOST_CHECK_EQUAL(scheme.queries[0].name, "foo");
00045   BOOST_CHECK_EQUAL(scheme.queries[0].value, "bar");
00046   BOOST_CHECK_EQUAL(scheme.queries[1].name, "test");
00047   BOOST_CHECK_EQUAL(scheme.queries[1].value, "me");
00048 }
00049 
00050 BOOST_AUTO_TEST_CASE(TestParserClass)
00051 {
00052   std::list<icl_core::String> input_list;
00053 
00054   input_list.push_back("file:///path/to/my_file/data.tof");
00055   input_list.push_back("file:///path/to/my file/my data.tof");
00056   input_list.push_back("file:///path/to/file/data.tof?offset=2000&skip_frames=2");
00057 
00058   // Test RawScheme
00059   input_list.push_back("raw:///path/to/file/data.tof");
00060 
00061   // Test OutputScheme
00062   input_list.push_back("output://video");
00063 
00064   // Test CameraScheme
00065   input_list.push_back("camera://dragonfly1?guid=0123456");
00066   input_list.push_back("camera://vision_a3?ip=192.168.95.123#&port=1919");
00067 
00068   // Test WithoutScheme
00069   input_list.push_back("/path/to/file/data.tof");
00070 
00071   // Test WithoutPath
00072   input_list.push_back("data.tof");
00073 
00074   std::list<icl_core::String>::iterator iter = input_list.begin();
00075 
00076   icl_core::SchemeParser parser;
00077 
00078   while (iter != input_list.end())
00079   {
00080     BOOST_CHECK_EQUAL(parser.parseScheme(*iter), true);
00081     ++iter;
00082   }
00083 }
00084 
00085 
00086 BOOST_AUTO_TEST_SUITE_END()


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:19