summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2014-09-21 14:18:22 -0700
committerJohn Hawthorn <john.hawthorn@gmail.com>2014-09-27 16:49:15 -0700
commit882051d38efbcf9162cda0a7f857170728ed500e (patch)
treeccacc793562ddaa57aaa4a6d01af8c497ac8a09b
parentad2ff14d64ad56106d3a6b20f5f685d686850b0b (diff)
Test choices before search is run.
-rw-r--r--fzytest.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/fzytest.c b/fzytest.c
index 609fdb4..7d719f1 100644
--- a/fzytest.c
+++ b/fzytest.c
@@ -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();