diff options
author | unixninja92 <charles@unixninja92.com> | 2016-01-03 23:02:44 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-01-08 15:52:10 -0800 |
commit | 4f0e28977d6376ccba599e7089aeb9e3b4f25e5f (patch) | |
tree | 4eab9c52a3395e7976cb36335031e5caa55adf26 /src/test/test_accounting.c | |
parent | cdbb04be102969bd2cece9daf42896e061cc8880 (diff) | |
download | tor-4f0e28977d6376ccba599e7089aeb9e3b4f25e5f.tar.gz tor-4f0e28977d6376ccba599e7089aeb9e3b4f25e5f.zip |
Added AccountRule in and AccountingRule out options
Diffstat (limited to 'src/test/test_accounting.c')
-rw-r--r-- | src/test/test_accounting.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/test_accounting.c b/src/test/test_accounting.c index 25908e942c..7edba988a6 100644 --- a/src/test/test_accounting.c +++ b/src/test/test_accounting.c @@ -61,6 +61,32 @@ test_accounting_limits(void *arg) fake_time += 1; consider_hibernation(fake_time); tor_assert(we_are_hibernating() == 1); + + options->AccountingRule = ACCT_OUT; + + accounting_add_bytes(100, 10, 1); + fake_time += 1; + consider_hibernation(fake_time); + tor_assert(we_are_hibernating() == 0); + + accounting_add_bytes(0, 90, 1); + fake_time += 1; + consider_hibernation(fake_time); + tor_assert(we_are_hibernating() == 1); + + options->AccountingMax = 300; + options->AccountingRule = ACCT_IN; + + accounting_add_bytes(10, 100, 1); + fake_time += 1; + consider_hibernation(fake_time); + tor_assert(we_are_hibernating() == 0); + + accounting_add_bytes(90, 0, 1); + fake_time += 1; + consider_hibernation(fake_time); + tor_assert(we_are_hibernating() == 1); + goto done; done: NS_UNMOCK(get_or_state); |