Convert String to and from std::string
[libacl.git] / test / string_assign.cpp
index 732523d..f7f8adc 100644 (file)
@@ -72,6 +72,28 @@ int main()
    std::cout << "A string initialized with a String object \"lmn\": \"" << s9 << "\"\n";
    assert(~s9 == 3);
 
+   // Contruct and assign from a std::string object
+
+   std::string x10("abc");
+   String  s10(x10);
+
+   std::cout << "A string constructed from std::string object \"" << x10 << "\": \"" << s10 << "\"\n";
+   assert(~s10 == 3);
+
+   std::string x11("def");
+   String  s11 = x11;
+
+   std::cout << "A string constructed from std::string object \"" << x11 << "\": \"" << s11 << "\"\n";
+   assert(~s11 == 3);
+
+   std::string x12("ghi");
+   String  s12;
+
+   s12 = x12;
+
+   std::cout << "A string assigned from std::string object \"" << x12 << "\": \"" << s12 << "\"\n";
+   assert(~s12 == 3);
+
    return 0;
 }