Main MRPT website > C++ reference for MRPT 1.5.6
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 
19 // Load data from constant file and check for exact match.
20 TEST(FormatTest, LargeStrings)
21 {
22  string test_str;
23  const size_t test_str_len = 30000;
24  test_str.assign(test_str_len,'A');
25 
26  std::string s = 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 }
33 
GLdouble s
Definition: glew.h:1295
TEST(FormatTest, LargeStrings)
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
GLsizei const GLcharARB ** string
Definition: glew.h:3293



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018