diff options
| -rw-r--r-- | test/test_data.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua index 478bf78..1b6c580 100644 --- a/test/test_data.lua +++ b/test/test_data.lua @@ -209,4 +209,13 @@ assert(same_second ~= nil and same_second >= 0, local r4 = data.new_rate_counter() assert(r4:sample(nil, 100) == nil, 'a nil byte count gives nil') +-- The fallback interval is a constructor argument, and the widget passes +-- conky's real update_interval rather than letting it default. That is the +-- path that ships, so it is the path that gets a test: at a 5s interval the +-- same 2048 bytes must read as 409.6 B/s, not 1024. +local r5 = data.new_rate_counter(5) +r5:sample(1000, 100) +assert(r5:sample(3048, 100) == 2048 / 5, + 'an explicit fallback interval must be used, got ' .. tostring(r5:sample(3048, 100))) + print('test_data: all assertions passed') |
