blob: d32d9669e5051e2a4b8f808dd8c6aad4a23b5047 [file] [log] [blame]
Jeff Thompson3b3aabf2013-06-21 16:50:20 -07001/*
2 * File: test-no-boost.cpp
3 * Author: jefft0
4 *
5 * Created on June 10, 2013, 4:21 PM
6 */
7
8#include <cstdlib>
9#include <sstream>
10#include <iostream>
Jeff Thompson539e79f2013-06-28 12:51:05 -070011#include <ndn-cpp/Name.hpp>
Jeff Thompson3b3aabf2013-06-21 16:50:20 -070012
13using namespace std;
14using namespace ndn;
15
Jeff Thompson2fb4b1b2013-07-01 15:10:43 -070016unsigned char Name1[] = {
Jeff Thompson539e79f2013-06-28 12:51:05 -070017#if 0
Jeff Thompson7afc98e2013-06-27 14:33:53 -0700180x01, 0xd2,
Jeff Thompson539e79f2013-06-28 12:51:05 -070019#endif
Jeff Thompson7afc98e2013-06-27 14:33:53 -070020 0xf2, 0xfa, 0x9d, 0x6e, 0x64, 0x6e, 0x00, 0xfa, 0x9d, 0x61, 0x62, 0x63, 0x00, 0x00,
Jeff Thompson539e79f2013-06-28 12:51:05 -070021#if 0
Jeff Thompson7afc98e2013-06-27 14:33:53 -070022 0x05, 0x9a, 0x8e, 0x32, 0x00,
23 0x05, 0xa2, 0x8e, 0x34, 0x00,
24 0x03, 0xe2,
25 0x02, 0x85, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
26 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
27 0x00,
28 0x02, 0xda, 0xfa, 0x9d, 0x61, 0x62, 0x63, 0x00, 0xea, 0x00, 0x00, 0x05, 0xaa, 0x8e, 0x31, 0x00, 0x02,
29 0xfa, 0x8e, 0x34, 0x00, 0x02, 0xd2, 0x8e, 0x32, 0x00, 0x03, 0x82, 0x9d, 0x01, 0xe0, 0x00, 0x00, 0x02, 0xca, 0xb5, 0x61,
30 0x62, 0x61, 0x62, 0x61, 0x62, 0x00,
310x00,
Jeff Thompson539e79f2013-06-28 12:51:05 -070032#endif
Jeff Thompson7afc98e2013-06-27 14:33:53 -0700331
34};
35
Jeff Thompson3b3aabf2013-06-21 16:50:20 -070036/*
37 *
38 */
Jeff Thompson7afc98e2013-06-27 14:33:53 -070039int main(int argc, char** argv)
40{
41 try {
Jeff Thompson539e79f2013-06-28 12:51:05 -070042 Name name;
Jeff Thompson2fb4b1b2013-07-01 15:10:43 -070043 name.decode(Name1, sizeof(Name1));
44 cout << "Name " << name.to_uri() << endl;
45
Jeff Thompson1f3f5172013-07-01 19:02:36 -070046 vector<unsigned char> encoding;
47 name.encode(encoding);
48 unsigned char *encodingBuffer = &encoding[0];
49 unsigned int encodingLength = encoding.size();
50 cout << "Name encoding length " << encodingLength << " vs. sizeof(Name1) " << sizeof(Name1) << endl;
51
Jeff Thompson7afc98e2013-06-27 14:33:53 -070052 } catch (exception &e) {
53 cout << "exception " << e.what() << endl;
54 }
Jeff Thompson3b3aabf2013-06-21 16:50:20 -070055 return 0;
56}