Skip to content

Commit

Permalink
Enable std::string tests on all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Geod24 committed Feb 10, 2024
1 parent 1f423eb commit 44e5ea1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
3 changes: 3 additions & 0 deletions extras/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*******************************************************************************/

#include <list>
#include <string>
#include <vector>

namespace stdcpp {
Expand All @@ -19,6 +20,8 @@ namespace stdcpp {
};
};

template std::size_t stdcpp::test::cppSizeOf<std::string>();

template class std::list<int>;
template std::size_t stdcpp::test::cppSizeOf<std::list<int> >();

Expand Down
27 changes: 16 additions & 11 deletions source/stdcpp/test/string.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
*******************************************************************************/

module stdcpp.test.string;

import stdcpp.test.base;
import stdcpp.string;
version (CppRuntime_Gcc)

/// Test that the sizes matches
unittest
{
assert(cppSizeOf!(std_string) == std_string.sizeof);
}

unittest
{
unittest
{
auto a = std_string("hello");
a.push_back('a');
assert(a.size() == 6);
assert(std_string.sizeof == 32);
// verifying small string optimization
assert(a.capacity == 15);
}
}
auto a = std_string("hello");
a.push_back('a');
assert(a.size() == 6);
// verifying small string optimization
assert(a.capacity == 15);
}

0 comments on commit 44e5ea1

Please sign in to comment.