MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / test_stl_conversions

Function test_stl_conversions

scripts/test_stringzilla.cpp:1884–1913  ·  view source on GitHub ↗

* @brief Constructs StringZilla classes from STL and vice-versa to ensure that the conversions are working. */

Source from the content-addressed store, hash-verified

1882 * @brief Constructs StringZilla classes from STL and vice-versa to ensure that the conversions are working.
1883 */
1884void test_stl_conversions() {
1885 // From a mutable STL string to StringZilla and vice-versa.
1886 {
1887 std::string stl {"hello"};
1888 sz::string sz = stl;
1889 sz::string_view szv = stl;
1890 sz::string_span szs = stl;
1891 stl = sz;
1892 stl = szv;
1893 stl = szs;
1894 }
1895 // From an immutable STL string to StringZilla.
1896 {
1897 std::string const stl {"hello"};
1898 sz::string sz = stl;
1899 sz::string_view szv = stl;
1900 sz_unused_(sz);
1901 sz_unused_(szv);
1902 }
1903#if SZ_IS_CPP17_ && defined(__cpp_lib_string_view)
1904 // From STL `string_view` to StringZilla and vice-versa.
1905 {
1906 std::string_view stl {"hello"};
1907 sz::string sz = stl;
1908 sz::string_view szv = stl;
1909 stl = sz;
1910 stl = szv;
1911 }
1912#endif
1913}
1914
1915/**
1916 * @brief The sum of an arithmetic progression.

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…