From 5001bc4fe7e0466ea08253ec7ff4667ebb0ace1b Mon Sep 17 00:00:00 2001 From: "Pawel \"l0ner\" Soltys" Date: Thu, 8 Jan 2015 20:04:27 +0100 Subject: [PATCH] added custom interval test --- CMakeLists.txt | 5 ++++- tmux-mem-cpu-load.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 190ed8b..eef1146 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,9 @@ if( BUILD_TESTING ) add_test( NAME no_arguments COMMAND tmux-mem-cpu-load ) + add_test( NAME custom_interval + COMMAND tmux-mem-cpu-load -i 3 ) + add_test( NAME colors COMMAND tmux-mem-cpu-load --colors ) @@ -74,7 +77,7 @@ if( BUILD_TESTING ) COMMAND tmux-mem-cpu-load -i -1 ) add_test( NAME invalid_graph_lines - COMMAND tmux-mem-cpu-load -g -4 ) + COMMAND tmux-mem-cpu-load --graph_lines -2 ) set_tests_properties( usage invalid_status_interval diff --git a/tmux-mem-cpu-load.cpp b/tmux-mem-cpu-load.cpp index 85b008b..4e343db 100644 --- a/tmux-mem-cpu-load.cpp +++ b/tmux-mem-cpu-load.cpp @@ -85,7 +85,7 @@ std::string cpu_string(unsigned int cpu_usage_delay, unsigned int graph_lines, int main(int argc, char** argv) { using namespace ArgvParse; - unsigned cpu_usage_delay = 1000000; + unsigned cpu_usage_delay = 990000; short graph_lines = 10; // max 32767 should be enough bool use_colors = false; @@ -127,7 +127,7 @@ int main(int argc, char** argv) { std::cerr << "Status interval argument must be one or greater.\n"; return EXIT_FAILURE; } - cpu_usage_delay = delay * 1000000; + cpu_usage_delay = delay * 1000000 - 10000; } if (arg.foundOption("graph-lines")) {