Skip to content

Commit

Permalink
Add unit test for function that takes multiple string views
Browse files Browse the repository at this point in the history
Taken from wlav/CPyCppyy#13
  • Loading branch information
guitargeek committed Apr 9, 2024
1 parent 20ff4c9 commit 0ecbad8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/test_stltypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,24 @@ def test02_string_view_from_unicode(self):

assert "Lorem ipsum dolor sit amet" in str(text)

def test03_multiple_string_view_arguments(self):
"""Function that take multiple std::string_view arguments"""

import cppyy

cppyy.cppdef("""
std::string concat_string_views(std::string_view s1, std::string_view s2)
{
std::string out;
out += s1;
out += " ";
out += s2;
return out;
}
""")

assert cppyy.gbl.concat_string_views("hello", "world") == "hello world"


class TestSTLDEQUE:
def setup_class(cls):
Expand Down

0 comments on commit 0ecbad8

Please sign in to comment.