|
|
@ -3,18 +3,25 @@ |
|
|
|
|
|
|
|
|
|
|
|
int main() { |
|
|
|
int main() { |
|
|
|
f2b_matches_t matches; |
|
|
|
f2b_matches_t matches; |
|
|
|
|
|
|
|
bool result = false; |
|
|
|
size_t size = 15; |
|
|
|
size_t size = 15; |
|
|
|
time_t now = time(NULL); |
|
|
|
time_t now = time(NULL); |
|
|
|
|
|
|
|
|
|
|
|
assert(f2b_matches_create(&matches, size) == true); |
|
|
|
UNUSED(result); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = f2b_matches_create(&matches, size); |
|
|
|
|
|
|
|
assert(result == true); |
|
|
|
assert(matches.used == 0); |
|
|
|
assert(matches.used == 0); |
|
|
|
assert(matches.max == 15); |
|
|
|
assert(matches.max == 15); |
|
|
|
assert(matches.times != NULL); |
|
|
|
assert(matches.times != NULL); |
|
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < size; i++) |
|
|
|
for (size_t i = 0; i < size; i++) { |
|
|
|
assert(f2b_matches_append(&matches, now - 60 * i) == true); |
|
|
|
result = f2b_matches_append(&matches, now - 60 * i); |
|
|
|
|
|
|
|
assert(result == true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assert(f2b_matches_append(&matches, 0) == false); |
|
|
|
result = f2b_matches_append(&matches, 0); |
|
|
|
|
|
|
|
assert(result == false); |
|
|
|
|
|
|
|
|
|
|
|
f2b_matches_expire(&matches, now - 60 * 4); |
|
|
|
f2b_matches_expire(&matches, now - 60 * 4); |
|
|
|
assert(matches.used == 4); |
|
|
|
assert(matches.used == 4); |
|
|
|