/// /// @file number_of_bits.cpp /// @brief Test numberOfBits() function. /// /// Copyright (C) 2021 Kim Walisch, /// /// This file is distributed under the BSD License. See the COPYING /// file in the top level directory. /// #include #include #include using namespace std; void check(bool OK) { cout << " " << (OK ? "OK" : "ERROR") << "\n"; if (!OK) exit(1); } int main() { cout << "numberOfBits() = " << (int) numberOfBits(); check(numberOfBits() == 8); cout << "numberOfBits() = " << (int) numberOfBits(); check(numberOfBits() == 8); cout << "numberOfBits() = " << numberOfBits(); check(numberOfBits() == 16); cout << "numberOfBits() = " << numberOfBits(); check(numberOfBits() == 16); cout << "numberOfBits() = " << numberOfBits(); check(numberOfBits() == 32); cout << "numberOfBits() = " << numberOfBits(); check(numberOfBits() == 32); cout << "numberOfBits() = " << numberOfBits(); check(numberOfBits() == 64); cout << "numberOfBits() = " << numberOfBits(); check(numberOfBits() == 64); cout << endl; cout << "All tests passed successfully!" << endl; return 0; }