71eff4dcdc8d9ea00ab9d204bd86a443ed63224e
[libacl.git] / test / string_cat.cpp
1 /*******************************************************
2  *  Unit test for the String class
3  *
4  * test addition operators
5  ******************************************************
6  *
7  */
8
9 #include "String.h"
10 #include <assert.h>
11
12 int main()
13 {
14    // Default contructor: empty string
15    String s0;
16
17    String s1("abc");
18    String s2("def");
19    String s3, s4;
20
21    s3 = s1 + s2;
22    std::cout << s1 << " + " << s2 << " = " << s3 << "\n";
23    assert(s3 == "abcdef");
24    s4 = s2 + s1;
25    std::cout << s2 << " + " << s1 << " = " << s4 << "\n";
26    assert(s4 == "defabc");
27
28    s3 = s1;
29    s3 += s2;
30    std::cout << s1 << " += " << s2 << " = " << s3 << "\n";
31    assert(s3 == "abcdef");
32
33    return 0;
34 }
35