Main MRPT website > C++ reference for MRPT 1.9.9
format_unittest.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include <mrpt/utils/utils_defs.h>
11 #include <gtest/gtest.h>
12 
13 using namespace mrpt;
14 using namespace mrpt::utils;
15 using namespace mrpt::math;
16 using namespace std;
17 
18 // Load data from constant file and check for exact match.
19 TEST(FormatTest, LargeStrings)
20 {
21  string test_str;
22  const size_t test_str_len = 30000;
23  test_str.assign(test_str_len, 'A');
24 
25  std::string s =
26  mrpt::format("%u %s", static_cast<unsigned int>(10), test_str.c_str());
27 
28  const size_t out_str_len = s.size();
29 
30  // If it works, out len must be that of the string, plus 3 from "10 "
31  EXPECT_EQ(out_str_len, (test_str_len + 3));
32 }
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
STL namespace.
GLdouble s
Definition: glext.h:3676
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
TEST(FormatTest, LargeStrings)
GLsizei const GLchar ** string
Definition: glext.h:4101
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019