Files
iZo/tests/system_time_debug.cpp

26 lines
802 B
C++

#include "test_support.hpp"
#include <izo/Debug.hpp>
#include <izo/System.hpp>
#include <izo/Time.hpp>
int main() {
const auto info = izo::GetSystemInfo();
CHECK(info.logicalCpuCount > 0);
CHECK(info.totalMemoryBytes > 0);
CHECK(info.availableMemoryBytes <= info.totalMemoryBytes);
CHECK(info.osName == "Linux");
CHECK(!info.osVersion.empty());
const auto battery = izo::GetBatteryInfo();
CHECK(battery.levelPercent >= -1 && battery.levelPercent <= 100);
const auto before = izo::MonotonicNow();
izo::SleepFor(std::chrono::milliseconds(5));
CHECK(izo::MonotonicNow() > before);
izo::SleepFor(std::chrono::nanoseconds(-1));
(void)izo::IsDebuggerAttached();
izo::DebugOutput("iZo debug output test\n");
izo::InstallCrashHandler(nullptr);
}