From 15b29a48af2175f620d0acad00bac59d2d5d8630 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Tue, 31 Jan 2017 18:06:42 -0800 Subject: Pass options to choices_init --- test/fzytest.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/fzytest.c b/test/fzytest.c index d79ef69..7fe6fb2 100644 --- a/test/fzytest.c +++ b/test/fzytest.c @@ -7,6 +7,7 @@ #include "../config.h" #include "match.h" #include "choices.h" +#include "options.h" int testsrun = 0, testsfailed = 0, assertionsrun = 0; @@ -21,6 +22,8 @@ int testsrun = 0, testsfailed = 0, assertionsrun = 0; #define assert_streq(a, b) assert(!strcmp(a, b)) +static options_t default_options; + void runtest(void (*test)()) { testsrun++; test(); @@ -160,7 +163,7 @@ void test_positions_exact() { void test_choices_empty() { choices_t choices; - choices_init(&choices); + choices_init(&choices, &default_options); assert(choices.size == 0); assert(choices.available == 0); assert(choices.selection == 0); @@ -176,7 +179,7 @@ void test_choices_empty() { void test_choices_1() { choices_t choices; - choices_init(&choices); + choices_init(&choices, &default_options); choices_add(&choices, "tags"); choices_search(&choices, ""); @@ -201,7 +204,7 @@ void test_choices_1() { void test_choices_2() { choices_t choices; - choices_init(&choices); + choices_init(&choices, &default_options); choices_add(&choices, "tags"); choices_add(&choices, "test"); @@ -253,7 +256,7 @@ void test_choices_without_search() { /* Before a search is run, it should return no results */ choices_t choices; - choices_init(&choices); + choices_init(&choices, &default_options); assert(choices.available == 0); assert(choices.selection == 0); @@ -273,7 +276,7 @@ void test_choices_without_search() { /* Regression test for segfault */ void test_choices_unicode() { choices_t choices; - choices_init(&choices); + choices_init(&choices, &default_options); choices_add(&choices, "Edmund Husserl - Méditations cartésiennes - Introduction a la phénoménologie.pdf"); choices_search(&choices, "e"); @@ -283,7 +286,7 @@ void test_choices_unicode() { void test_choices_large_input() { choices_t choices; - choices_init(&choices); + choices_init(&choices, &default_options); int N = 100000; char *strings[N]; @@ -323,6 +326,8 @@ int main(int argc, char *argv[]) { * If we have no debugger running, we should ignore it */ signal(SIGTRAP, ignore_signal); + options_init(&default_options); + runtest(test_match); runtest(test_relative_scores); runtest(test_exact_scores); -- cgit v1.2.3