ts_SchemeParser.cpp
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of FZIs ic_workspace.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12 //
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
22 //----------------------------------------------------------------------
23 #include <icl_core/BaseTypes.h>
24 #include <icl_core/SchemeParser.h>
25 
26 #include <boost/test/unit_test.hpp>
27 #include <list>
28 
30 
31 BOOST_AUTO_TEST_SUITE(ts_tParser)
32 
33 BOOST_AUTO_TEST_CASE(TestStaticParser)
34 {
35  BOOST_SPIRIT_NAMESPACE::parse_info<> info;
36  icl_core::Scheme scheme;
38  icl_core::String input = "file:///path/to/file/data.abc#anchor123?foo=bar&test=me";
39 
40  BOOST_CHECK_EQUAL(icl_core::SchemeParser::parseScheme(input, scheme, info), true);
41  BOOST_CHECK_EQUAL(scheme.scheme_type, icl_core::FileScheme);
42  BOOST_CHECK_EQUAL(scheme.specifier, "/path/to/file/data.abc");
43  BOOST_CHECK_EQUAL(scheme.anchor, "anchor123");
44  BOOST_CHECK_EQUAL(scheme.queries[0].name, "foo");
45  BOOST_CHECK_EQUAL(scheme.queries[0].value, "bar");
46  BOOST_CHECK_EQUAL(scheme.queries[1].name, "test");
47  BOOST_CHECK_EQUAL(scheme.queries[1].value, "me");
48 }
49 
50 BOOST_AUTO_TEST_CASE(TestParserClass)
51 {
52  std::list<icl_core::String> input_list;
53 
54  input_list.push_back("file:///path/to/my_file/data.tof");
55  input_list.push_back("file:///path/to/my file/my data.tof");
56  input_list.push_back("file:///path/to/file/data.tof?offset=2000&skip_frames=2");
57 
58  // Test RawScheme
59  input_list.push_back("raw:///path/to/file/data.tof");
60 
61  // Test OutputScheme
62  input_list.push_back("output://video");
63 
64  // Test CameraScheme
65  input_list.push_back("camera://dragonfly1?guid=0123456");
66  input_list.push_back("camera://vision_a3?ip=192.168.95.123#&port=1919");
67 
68  // Test WithoutScheme
69  input_list.push_back("/path/to/file/data.tof");
70 
71  // Test WithoutPath
72  input_list.push_back("data.tof");
73 
74  std::list<icl_core::String>::iterator iter = input_list.begin();
75 
77 
78  while (iter != input_list.end())
79  {
80  BOOST_CHECK_EQUAL(parser.parseScheme(*iter), true);
81  ++iter;
82  }
83 }
84 
85 
86 BOOST_AUTO_TEST_SUITE_END()
file:///path/file?key=value
Definition: SchemeParser.h:65
bool parseScheme(const String &str)
BOOST_AUTO_TEST_CASE(TestStaticParser)
std::string String
Definition: BaseTypes.h:43
SchemeType scheme_type
Definition: SchemeParser.h:74
Contains Interface base classes and base types.
QueryList queries
Definition: SchemeParser.h:78
Contains icl_core::SchemeParser.


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:58