| 5 | #include <cassert> |
| 6 | |
| 7 | class BCD { |
| 8 | public: |
| 9 | BCD(int v) |
| 10 | : mValue{Adjust(v)} |
| 11 | {} |
| 12 | |
| 13 | // #A Make BCD convertible to int |
| 14 | operator int() const { return mValue; } |
| 15 | |
| 16 | // #B Provide at least equality comparison |
| 17 | bool operator==(const BCD& rhs) const |
| 18 | { |
| 19 | return rhs.mValue == mValue; |
| 20 | } |
| 21 | |
| 22 | bool operator!=(const BCD& rhs) const |
| 23 | { |
| 24 | return not(*this == rhs); |
| 25 | } |
| 26 | |
| 27 | private: |
| 28 | int mValue; |
| 29 | |
| 30 | static int Adjust(int v); |
| 31 | }; |
| 32 | |
| 33 | int BCD::Adjust(int v) |
| 34 | { |
nothing calls this directly
no outgoing calls
no test coverage detected