diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2014-09-21 14:18:22 -0700 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2014-09-27 16:49:15 -0700 |
commit | 882051d38efbcf9162cda0a7f857170728ed500e (patch) | |
tree | ccacc793562ddaa57aaa4a6d01af8c497ac8a09b | |
parent | ad2ff14d64ad56106d3a6b20f5f685d686850b0b (diff) |
Test choices before search is run.
-rw-r--r-- | fzytest.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -209,6 +209,27 @@ int test_choices_2(){ return 0; } +int test_choices_without_search(){ + /* Before a search is run, it should return no results */ + + choices_t choices; + choices_init(&choices); + + assert(choices.available == 0); + assert(choices.selection == 0); + assert(choices.size == 0); + assert(choices_get(&choices, 0) == NULL); + + choices_add(&choices, "test"); + + assert(choices.available == 0); + assert(choices.selection == 0); + assert(choices.size == 1); + assert(choices_get(&choices, 0) == NULL); + + return 0; +} + void summary(){ printf("%i tests, %i assertions, %i failures\n", testsrun, assertionsrun, testsfailed); } @@ -228,6 +249,7 @@ int main(int argc, char *argv[]){ runtest(test_choices_empty); runtest(test_choices_1); runtest(test_choices_2); + runtest(test_choices_without_search); summary(); |