2013-11-15 07:11:21 +00:00
|
|
|
#include "bench_framework.hpp"
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
class test : public benchmark::test_case
|
|
|
|
{
|
|
|
|
double value_;
|
|
|
|
public:
|
|
|
|
test(mapnik::parameters const& params)
|
|
|
|
: test_case(params),
|
|
|
|
value_(-0.1234) {}
|
|
|
|
bool validate() const
|
|
|
|
{
|
|
|
|
std::ostringstream s;
|
|
|
|
s << value_;
|
|
|
|
return (s.str() == "-0.1234");
|
|
|
|
}
|
2014-12-12 16:59:45 +00:00
|
|
|
bool operator()() const
|
2013-11-15 07:11:21 +00:00
|
|
|
{
|
|
|
|
std::string out;
|
|
|
|
for (std::size_t i=0;i<iterations_;++i) {
|
|
|
|
std::ostringstream s;
|
|
|
|
s << value_;
|
|
|
|
out = s.str();
|
|
|
|
}
|
2014-12-12 16:59:45 +00:00
|
|
|
return true;
|
2013-11-15 07:11:21 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-11-19 20:23:37 +00:00
|
|
|
BENCHMARK(test,"ostringstream double->string")
|