#include "contracts.hpp" #include #include int main() { using signal_garden::align_up; using signal_garden::checked_bytes; const auto max = std::numeric_limits::max(); const bool ok = align_up(0, 256) == 0 && align_up(257, 256) == 512 && align_up(9, 3) == 9 && align_up(10, 3) == 12 && !align_up(1, 0) && !align_up(max, 2) && align_up(max, 1) == max && checked_bytes(1024, 32, 32768) == 32768 && !checked_bytes(1025, 32, 32768) && !checked_bytes(max, 2, max) && checked_bytes(0, 32, 32768) == 0 && !checked_bytes(4, 0, 100); if (!ok) { std::cerr << "allocation contract test failed\n"; return 1; } std::cout << "alignment and allocation-boundary tests passed\n"; }