38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#include "QuickTest.h"
|
|
#include "ICmd.h"
|
|
#include "lib/utils/bts_chrono.h"
|
|
|
|
#include "lib/config/config.h"
|
|
#include "lib/jetfix/codec/f_toa.h"
|
|
#include "lib/jetfix/codec/i32_toa.h"
|
|
#include <double-conversion/double-conversion.h>
|
|
#include <iostream>
|
|
|
|
namespace bts {
|
|
namespace cmd {
|
|
|
|
int QuickTest::execute(std::vector<std::string> const &args) {
|
|
using namespace double_conversion;
|
|
|
|
static char buffer1[102];
|
|
static char buffer2[102];
|
|
static char buffer3[102];
|
|
auto n = std::stod(args[0], nullptr);
|
|
auto p = std::stoi(args[1], nullptr);
|
|
d_toa(n, buffer1, sizeof(buffer1), 7,p);
|
|
d_toa(n, buffer2, sizeof(buffer2),7);
|
|
d_toa(n, buffer3, sizeof(buffer3));
|
|
std::cout << n
|
|
<< " -> " << buffer1 << " (" << strlen(buffer1) << ") "
|
|
<< " -> " << buffer2 << " (" << strlen(buffer2) << ") "
|
|
<< " -> " << buffer3 << " (" << strlen(buffer3) << ") \n";
|
|
return 0;
|
|
}
|
|
|
|
std::string QuickTest::help() {
|
|
return "This is a place holder to make it easy to quickly write discardable "
|
|
"test code";
|
|
}
|
|
}
|
|
}
|