From 4bc6cf4ef010ebc20b306bcdee19c451eb1a98ec Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Fri, 21 Jul 2023 19:23:43 +0800 Subject: [PATCH] added utos_test.cpp --- CMakeLists.txt | 3 +++ datatype/utos_test.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 datatype/utos_test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index ca7a239..8e6f8a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,9 @@ cm_example_project("DataType" SplitStringTest) add_executable(StrChrTest datatype/strchr_test.cpp) cm_example_project("DataType" StrChrTest) +add_executable(Uint2StrTest datatype/utos_test.cpp) +cm_example_project("DataType" Uint2StrTest) + add_executable(MapTest datatype/MapTest.cpp) cm_example_project("DataType" MapTest) diff --git a/datatype/utos_test.cpp b/datatype/utos_test.cpp new file mode 100644 index 0000000..3c5b05f --- /dev/null +++ b/datatype/utos_test.cpp @@ -0,0 +1,27 @@ +#include +#include +#include + +using namespace std; +using namespace hgl; + +int main(int,char **) +{ + srand(time(nullptr)); + + long int rr=rand(); + + char str[64]; + + for(uint i=2;i<=26+10;i++) + { + utos( str, //输出字符串 + 64, //输出字符串缓冲区长度 + rr, //要转换的数值 + i); //进制 + + cout<