Operators with std::string
[libacl.git] / test / integer_assign.cpp
1 /*******************************************************
2  *  Unit test for the Integer class
3  *
4  * test contrustor and assignment of Integer objects
5  ******************************************************
6  *
7  */
8
9 #include "Integer.h"
10 #include <assert.h>
11
12 int main()
13 {
14    // Default contructor: all zero
15    Integer i0;
16
17    std::cout << "The default contructor makes a zero number: \"" << i0 << "\"\n";
18    std::cout.flush();
19    assert(i0 == 0);
20
21    // Constructors with a literal value
22    Integer i1(5);
23
24    std::cout << "Contructor with a number = 5: \"" << i1 << "\"\n";
25    std::cout.flush();
26    assert(i1 == 5);
27
28    // Initializer with a literal value
29    Integer i2 = 42;
30
31    std::cout << "Initializer with a number = 42: \"" << i2 << "\"\n";
32    std::cout.flush();
33    assert(i2 == 42);
34
35    // Assignment of a literal value
36    Integer i3;
37    i3 = 123;
38
39    std::cout << "Assignment with a number = 123: \"" << i3 << "\"\n";
40    std::cout.flush();
41    assert(i3 == 123);
42
43    // Contructor with an Integer object
44    Integer i4(i2);
45
46    std::cout << "Contructor with Integer: \"" << i4 << "\"\n";
47    std::cout.flush();
48    assert(i4 == i2);
49
50    // Assignment of a Integer object
51    Integer i5;
52    i5 = i3;
53
54    std::cout << "Assignment with Integer: \"" << i5 << "\"\n";
55    std::cout.flush();
56    assert(i5 == i3);
57
58    return 0;
59 }
60