diff options
author | akhropov <akhropov@yandex-team.ru> | 2022-02-10 16:46:32 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:32 +0300 |
commit | 00afc96e9c0298054b7386fa7fb9e3cc3d67b974 (patch) | |
tree | cb7a9f4a92c0d4cc5a86eeed49ad71e810953c1f /util/string/cast_ut.cpp | |
parent | 83a8efcf3af051e3dd59c00d1d5dafc96412ec1e (diff) | |
download | ydb-00afc96e9c0298054b7386fa7fb9e3cc3d67b974.tar.gz |
Restoring authorship annotation for <akhropov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string/cast_ut.cpp')
-rw-r--r-- | util/string/cast_ut.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/util/string/cast_ut.cpp b/util/string/cast_ut.cpp index 033450c38c..e7be19c96a 100644 --- a/util/string/cast_ut.cpp +++ b/util/string/cast_ut.cpp @@ -40,31 +40,31 @@ UNIT_ASSERT_VALUES_EQUAL(TryIntFromStringForCheck<base>(IntToString<base>(val), result), false); \ UNIT_ASSERT_VALUES_EQUAL(result, def); -template <class A> -struct TRet { +template <class A> +struct TRet { template <int base> inline A IntFromStringForCheck(const TString& str) { - return IntFromString<A, base>(str); - } + return IntFromString<A, base>(str); + } template <int base> inline bool TryIntFromStringForCheck(const TString& str, A& result) { return TryIntFromString<base>(str, result); } - template <class B> + template <class B> inline void CheckOK(B v) { UNIT_ASSERT_VALUES_EQUAL(FromString<A>(ToString(v)), v); // char UNIT_ASSERT_VALUES_EQUAL(FromString<A>(ToWtring(v)), v); // wide char HEX_MACROS_MAP(OK_HEX_CHECK, A, v); - } + } - template <class B> + template <class B> inline void CheckExc(B v) { UNIT_ASSERT_EXCEPTION(FromString<A>(ToString(v)), yexception); // char UNIT_ASSERT_EXCEPTION(FromString<A>(ToWtring(v)), yexception); // wide char HEX_MACROS_MAP(EXC_HEX_CHECK, A, v); - } + } template <class B> inline void CheckTryOK(B v) { @@ -89,16 +89,16 @@ struct TRet { TRY_HEX_MACROS_MAP(TRY_FAIL_HEX_CHECK, A, v, convV, defaultV); } -}; - -template <> -struct TRet<bool> { - template <class B> +}; + +template <> +struct TRet<bool> { + template <class B> inline void CheckOK(B v) { UNIT_ASSERT_VALUES_EQUAL(FromString<bool>(ToString(v)), v); - } - - template <class B> + } + + template <class B> inline void CheckTryOK(B v) { B convV; UNIT_ASSERT_VALUES_EQUAL(TryFromString<bool>(ToString(v), convV), true); @@ -107,8 +107,8 @@ struct TRet<bool> { template <class B> inline void CheckExc(B v) { - UNIT_ASSERT_EXCEPTION(FromString<bool>(ToString(v)), yexception); - } + UNIT_ASSERT_EXCEPTION(FromString<bool>(ToString(v)), yexception); + } template <class B> inline void CheckTryFail(B v) { @@ -117,13 +117,13 @@ struct TRet<bool> { UNIT_ASSERT_VALUES_EQUAL(TryFromString<bool>(ToString(v), convV), false); UNIT_ASSERT_VALUES_EQUAL(defaultV, convV); } -}; - -template <class A> -inline TRet<A> F() { - return TRet<A>(); -}; - +}; + +template <class A> +inline TRet<A> F() { + return TRet<A>(); +}; + #if 0 template <class T> inline void CheckConvertToBuffer(const T& value, const size_t size, const TString& canonValue) { @@ -181,7 +181,7 @@ Y_UNIT_TEST_SUITE(TCastTest) { test1(bool, false); test2(bool, ""); test2(bool, "a"); - + test2(ui8, -1); test1(i8, -1); test1(i8, SCHAR_MAX); |