From b15aa9057a36a9cbb7cef956e9b2ea08d8647820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sat, 1 Jan 2022 10:47:21 -0800 Subject: [PATCH] Added a few more trim tests. --- tests/string_test.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/string_test.cpp b/tests/string_test.cpp index 5ba7a5f..c39ce3b 100644 --- a/tests/string_test.cpp +++ b/tests/string_test.cpp @@ -476,15 +476,25 @@ 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(bx::strTrim("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", "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", "abv"), "abvgd") ); REQUIRE(0 == bx::strCmp(bx::strRTrim("/555333/podmac/", "/"), "/555333/podmac") );