From 25167bd44c9fbe4ecc2f56941a505e678a7f2271 Mon Sep 17 00:00:00 2001 From: Emmanuel Nyarko Date: Sun, 11 Feb 2024 17:39:24 +0000 Subject: [PATCH] adding more tests for std::string on all platforms --- source/stdcpp/test/string.d | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/stdcpp/test/string.d b/source/stdcpp/test/string.d index 438fdfa..5b6c80c 100644 --- a/source/stdcpp/test/string.d +++ b/source/stdcpp/test/string.d @@ -28,15 +28,13 @@ unittest assert(a.back() == 'a'); a.resize(4); // shrinks a to "hell" assert(a.size() == 4); - auto b = std_string("Hi, this is a test for string capacity growth for a length more than the base SSO"); - assert(b.capacity == stringCapacity("Hi, this is a test for string capacity growth for a length more than the base SSO")); + immutable LongStr = "Hi, this is a test for string capacity growth for a length more than the base SSO"; + auto b = std_string(LongStr); + assert(b.capacity == stringCapacity(LongStr.ptr)); a.swap(b); // a and b swaps - assert(a.capacity == stringCapacity("Hi, this is a test for string capacity growth for a length more than the base SSO")); + assert(a.capacity == stringCapacity(LongStr.ptr)); assert(b.capacity == stringCapacity("hell")); // a was shrinked to hell so b contains 'hell' b.pop_back(); assert(b.size() == 3); - assert(a.empty == 0); - a.clear(); - assert(a.empty == 1); }