diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-11 17:32:01 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-11 17:32:01 +0200 |
commit | 0bfda486167432a9da8eec62b4578a22592a9275 (patch) | |
tree | 968d622d3918c9ac969de8b9c1e97e67b6cbee8b /tests | |
parent | f8bb2faef4b272ed150eb3ca4cedaa79da410694 (diff) |
Add generation of detach functions
New option: --generate-detach. Also added detach/attach functionality
to var_seq, non-STL str_seq, and string_base.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cxx/hybrid/sequences/driver.cxx | 23 | ||||
-rw-r--r-- | tests/cxx/hybrid/union/makefile | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/tests/cxx/hybrid/sequences/driver.cxx b/tests/cxx/hybrid/sequences/driver.cxx index 1a27e9b..f3d848e 100644 --- a/tests/cxx/hybrid/sequences/driver.cxx +++ b/tests/cxx/hybrid/sequences/driver.cxx @@ -271,6 +271,16 @@ main () assert (s[0] == "aaa" && s[1] == "ccc" && s[2] == "bbb"); } + { + var s; + s.push_back (new string ("aaa")); + s.push_back (new string ("bbb")); + s.push_back (new string ("ccc")); + delete s.detach (s.begin () + 1); + s.attach (s.begin () + 1, new string ("bbb")); + assert (s[0] == "aaa" && s[1] == "bbb" && s[2] == "ccc"); + } + // // str_seq // @@ -355,6 +365,19 @@ main () s[2] == string ("bbb")); } + { + str s; + s.reserve (2); + s.push_back_copy ("aaa"); + s.push_back_copy ("bbb"); + s.push_back_copy ("ccc"); + delete[] s.detach (s.begin () + 1); + s.attach (s.begin () + 1, strdupc ("bbb")); + assert (s[0] == string ("aaa") && + s[1] == string ("bbb") && + s[2] == string ("ccc")); + } + #else { diff --git a/tests/cxx/hybrid/union/makefile b/tests/cxx/hybrid/union/makefile index c4b0af8..a345fdd 100644 --- a/tests/cxx/hybrid/union/makefile +++ b/tests/cxx/hybrid/union/makefile @@ -43,7 +43,7 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(out_root)/xsde/xsde $(gen): xsde := $(out_root)/xsde/xsde $(gen): xsde_options += --generate-parser --generate-serializer \ ---generate-aggregate +--generate-aggregate --generate-detach $(call include-dep,$(dep)) |