diff options
author | 2023-01-04 23:29:18 -0500 | |
---|---|---|
committer | 2023-01-04 23:29:18 -0500 | |
commit | 94b1e168b2b97b48b81f7a8f64406b0a6f64184e (patch) | |
tree | f57362a0fa01bfe8f0ad75a447c4c9e10bc15756 /3rdparty/bx/tests/string_test.cpp | |
parent | 5581eaa50a42256242f32569f59ce10d70ddd8c2 (diff) |
Revert "Update BGFX, BX and BIMG (#10750)" (#10787)
This reverts commit 5581eaa50a42256242f32569f59ce10d70ddd8c2 due to link failure on macOS.
Diffstat (limited to '3rdparty/bx/tests/string_test.cpp')
-rw-r--r-- | 3rdparty/bx/tests/string_test.cpp | 65 |
1 files changed, 7 insertions, 58 deletions
diff --git a/3rdparty/bx/tests/string_test.cpp b/3rdparty/bx/tests/string_test.cpp index cbcb50e8b5a..48ee8d83b9a 100644 --- a/3rdparty/bx/tests/string_test.cpp +++ b/3rdparty/bx/tests/string_test.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2010-2022 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bx/blob/master/LICENSE + * Copyright 2010-2021 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #include "test.h" @@ -16,7 +16,7 @@ TEST_CASE("stringPrintfTy", "") { std::string test; bx::stringPrintf(test, "printf into std::string."); - REQUIRE(0 == bx::strCmp(bx::StringView(test.data(), int32_t(test.length() ) ), "printf into std::string.") ); + REQUIRE(0 == bx::strCmp(bx::StringView(test), "printf into std::string.") ); } TEST_CASE("prettify", "") @@ -333,7 +333,6 @@ TEST_CASE("toString double", "") REQUIRE(testToString(-270.000000, "-270.0") ); REQUIRE(testToString(2.225073858507201e-308, "2.225073858507201e-308") ); REQUIRE(testToString(-79.39773355813419, "-79.39773355813419") ); - REQUIRE(testToString(-1.234567e-9, "-1.234567e-9") ); } template<typename Ty> @@ -475,26 +474,12 @@ TEST_CASE("StringView", "") TEST_CASE("Trim", "") { - REQUIRE(bx::strLTrim("a", "a").isEmpty() ); - REQUIRE(0 == bx::strCmp(bx::strLTrim("aba", "a"), "ba") ); - - REQUIRE(bx::strRTrim("a", "a").isEmpty() ); - REQUIRE(0 == bx::strCmp(bx::strRTrim("aba", "a"), "ab") ); - - REQUIRE(bx::strTrim("a", "a").isEmpty() ); - REQUIRE(0 == bx::strCmp(bx::strTrim("aba", "a"), "b") ); - REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "ab"), "vgd") ); - - REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "vagbd"), "") ); - REQUIRE(0 == bx::strCmp(bx::strTrimPrefix("abvgd", "vagbd"), "abvgd") ); - + REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "vagbd"), "abvgd") ); REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "vgd"), "abvgd") ); REQUIRE(0 == bx::strCmp(bx::strLTrim("/555333/podmac/", "/"), "555333/podmac/") ); - REQUIRE(0 == bx::strCmp(bx::strRTrim("abvgd", "vagbd"), "") ); - REQUIRE(0 == bx::strCmp(bx::strTrimSuffix("abvgd", "vagbd"), "abvgd") ); - + REQUIRE(0 == bx::strCmp(bx::strRTrim("abvgd", "vagbd"), "abvgd") ); REQUIRE(0 == bx::strCmp(bx::strRTrim("abvgd", "abv"), "abvgd") ); REQUIRE(0 == bx::strCmp(bx::strRTrim("/555333/podmac/", "/"), "/555333/podmac") ); @@ -515,10 +500,6 @@ TEST_CASE("TrimSpace", "") REQUIRE(bx::strRTrimSpace("").isEmpty() ); REQUIRE(bx::strTrimSpace( "").isEmpty() ); - REQUIRE(bx::strLTrimSpace("\n").isEmpty() ); - REQUIRE(bx::strRTrimSpace("\n").isEmpty() ); - REQUIRE(bx::strTrimSpace( "\n").isEmpty() ); - const bx::StringView t0("1389"); const bx::StringView t1(" 1389"); const bx::StringView t2("1389 "); @@ -555,48 +536,16 @@ TEST_CASE("strFindBlock", "") REQUIRE(19 == result.getLength() ); } -TEST_CASE("prefix", "") +TEST_CASE("hasPrefix", "") { REQUIRE( bx::hasPrefix("abvgd-1389.0", "abv") ); REQUIRE(!bx::hasPrefix("abvgd-1389.0", "bvg") ); REQUIRE( bx::hasPrefix("abvgd-1389.0", "") ); - - REQUIRE(0 == bx::strCmp(bx::strTrimPrefix("abvgd-1389.0", "abv"), "gd-1389.0") ); - REQUIRE(0 == bx::strCmp(bx::strTrimPrefix("abvgd-1389.0", "xyz"), "abvgd-1389.0") ); } -TEST_CASE("suffix", "") +TEST_CASE("hasSuffix", "") { REQUIRE( bx::hasSuffix("abvgd-1389.0", "389.0") ); REQUIRE(!bx::hasSuffix("abvgd-1389.0", "1389") ); REQUIRE( bx::hasSuffix("abvgd-1389.0", "") ); - - REQUIRE(0 == bx::strCmp(bx::strTrimSuffix("abvgd-1389.0", "389.0"), "abvgd-1") ); - REQUIRE(0 == bx::strCmp(bx::strTrimSuffix("abvgd-1389.0", "xyz"), "abvgd-1389.0") ); -} - -TEST_CASE("0terminated", "") -{ - const bx::StringView t0("1389"); - REQUIRE(t0.is0Terminated() ); - const bx::StringView t1(strTrimPrefix(t0, "13") ); - REQUIRE(!t1.is0Terminated() ); - const bx::StringView t2(strTrimSuffix(t0, "89") ); - REQUIRE(!t2.is0Terminated() ); - - bx::DefaultAllocator crt; - g_allocator = &crt; - - typedef bx::StringT<&g_allocator> String; - - String st; - REQUIRE(st.is0Terminated() ); - - st = strTrimPrefix(t0, "13"); - REQUIRE(2 == st.getLength() ); - REQUIRE(st.is0Terminated() ); - - st = strTrimSuffix(t0, "89"); - REQUIRE(2 == st.getLength() ); - REQUIRE(st.is0Terminated() ); } |