[Pkg-mozext-commits] [perspectives-extension] 22/44: Unit tests - Rename variable
David Prévot
taffit at moszumanska.debian.org
Sat Jun 6 02:55:28 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository perspectives-extension.
commit 99fe852de4f6992bd5165d5ded66468dd34b3ceb
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date: Tue Nov 4 22:19:12 2014 -0700
Unit tests - Rename variable
The names 'day_first_seen'/'day_last_seen' are more clear
now that the start and end variables have been corrected.
Also increase day_first_seen from 3 days ago to 4;
so we can safely subtract enough from day_last_seen
yet have day_last_seen still be >=1 (so it is valid test data).
Add sanity checks to test data:
- check lengths >= 1
- quorum sizes >= 1
---
test/test.html | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/test/test.html b/test/test.html
index a914a03..5b8da16 100644
--- a/test/test.html
+++ b/test/test.html
@@ -245,10 +245,11 @@ function client_sanity() {
}
];
- var days_last_seen = 3;
+ var day_first_seen = 4; // days ago
var duration = 2; // days
- var old_start = Pers_util.get_unix_time() - Pers_util.DAY2SEC(days_last_seen);
- var old_end = Pers_util.get_unix_time() - Pers_util.DAY2SEC(days_last_seen - duration);
+ var day_last_seen = day_first_seen - duration;
+ var old_start = Pers_util.get_unix_time() - Pers_util.DAY2SEC(day_first_seen);
+ var old_end = Pers_util.get_unix_time() - Pers_util.DAY2SEC(day_last_seen);
var second_result_list = [
{ "server": "test1:8080",
@@ -280,6 +281,9 @@ function client_sanity() {
assert_setup(result_count === 2, "There are two observations in the results list.");
assert_setup(smaller_quorum_size < result_count, "Smaller quorum size < result count");
assert_setup(bigger_quorum_size > result_count, "Bigger quorum size > result count");
+ assert_setup(bigger_quorum_size > equal_quorum_size &&
+ equal_quorum_size > smaller_quorum_size &&
+ smaller_quorum_size >= 1, "all quorum sizes are >= 1");
spacer("weakly seen results");
var weakly_seen0 = Pers_client_policy.key_weakly_seen_by_quorum(key, short_result_list, smaller_quorum_size, -10);
@@ -295,23 +299,27 @@ function client_sanity() {
var weakly_seen3 = Pers_client_policy.key_weakly_seen_by_quorum(key, short_result_list, 0, 1);
assert(weakly_seen3 === false, "Quorum size 0 can't be weakly seen");
- var check_length0 = days_last_seen + 1; //days
- assert_setup(check_length0 >= days_last_seen , "check length >= ending day of observation.");
+ var check_length0 = day_last_seen + 1; //days
+ assert_setup(check_length0 >= 1, "check length >= 1");
+ assert_setup(check_length0 >= day_last_seen , "check length >= ending day of observation.");
var weakly_seen_test = Pers_client_policy.key_weakly_seen_by_quorum(key, second_result_list, bigger_quorum_size, check_length0);
assert(weakly_seen_test === false , "Keys seen but by fewer than quorum_size notaries do not count as weakly seen.");
- var check_length1 = days_last_seen - 1; //days
- assert_setup(check_length1 <= days_last_seen , "check length <= ending day of observation.");
+ var check_length1 = day_last_seen - 1; //days
+ assert_setup(check_length1 >= 1, "check length >= 1");
+ assert_setup(check_length1 <= day_last_seen , "check length <= ending day of observation.");
weakly_seen_test = Pers_client_policy.key_weakly_seen_by_quorum(key, second_result_list, equal_quorum_size, check_length1);
assert(weakly_seen_test === false , "Keys seen by quorum_size notaries but not in the past X days do not count as weakly seen.");
- var check_length2 = days_last_seen + 1; //days
- assert_setup(check_length2 >= days_last_seen , "check length >= ending day of observation.");
+ var check_length2 = day_last_seen + 1; //days
+ assert_setup(check_length2 >= 1, "check length >= 1");
+ assert_setup(check_length2 >= day_last_seen , "check length >= ending day of observation.");
weakly_seen_test = Pers_client_policy.key_weakly_seen_by_quorum(key, second_result_list, equal_quorum_size, check_length2);
assert(weakly_seen_test === true , "Keys seen by quorum_size notaries AND in the past X days DO count as weakly seen.");
- var check_length3 = days_last_seen; //days
- assert_setup(check_length3 === days_last_seen , "check length === ending day of observation.");
+ var check_length3 = day_last_seen; //days
+ assert_setup(check_length3 >= 1, "check length >= 1");
+ assert_setup(check_length3 === day_last_seen , "check length === ending day of observation.");
weakly_seen_test = Pers_client_policy.key_weakly_seen_by_quorum(key, second_result_list, equal_quorum_size, check_length3);
assert(weakly_seen_test === true , "Keys seen by quorum_size notaries exactly in the past X days DO count as weakly seen.");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/perspectives-extension.git
More information about the Pkg-mozext-commits
mailing list