diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
commit | 72231250ed81e10d66bfe70701e64fa5fe50f712 (patch) | |
tree | 2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /juniper/src/test/queryparserTest.h |
Publish
Diffstat (limited to 'juniper/src/test/queryparserTest.h')
-rw-r--r-- | juniper/src/test/queryparserTest.h | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/juniper/src/test/queryparserTest.h b/juniper/src/test/queryparserTest.h new file mode 100644 index 00000000000..1a13e4d3cc1 --- /dev/null +++ b/juniper/src/test/queryparserTest.h @@ -0,0 +1,119 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * Definition of the automated unit test class for the QueryParser class. + * + * @file queryparserTest.h + * + * @author Knut Omang + * + * @date Created 24 Feb 2003 + * + * $Id$ + * + * <pre> + * Copyright (c) : 2003 Fast Search & Transfer ASA + * ALL RIGHTS RESERVED + * </pre> + ***************************************************************************/ +#pragma once + +#include <map> +#include <vespa/fastlib/testsuite/test.h> +#include "testenv.h" +#include <vespa/juniper/queryparser.h> +#include <vespa/juniper/rewriter.h> + +/** + * The QueryParserTest class holds + * the unit tests for the QueryParser class. + * + * @sa QueryParser + * @author Knut Omang + */ +class QueryParserTest : public Test { + + /************************************************************************* + * Test methods + * + * This section contains boolean methods for testing each public method + * in the class ing tested + *************************************************************************/ + + /** + * Test of the UsefulIndex method. + */ + void testUsefulIndex(); + + + /** + * Test of the Index method. + */ + void testIndex(); + + + /** + * Test of the Creator method. + */ + void testCreator(); + + + /** + * Test of the Weight method. + */ + void testWeight(); + + + /** + * Test of the Traverse method. + */ + void testTraverse(); + + + /************************************************************************* + * Test administration methods + *************************************************************************/ + + /** + * Set up common stuff for all test methods. + * This method is called immediately before each test method is called + */ + bool setUp(); + + /** + * Tear down common stuff for all test methods. + * This method is called immediately after each test method is called + */ + void tearDown(); + + typedef void(QueryParserTest::* tst_method_ptr) (); + typedef std::map<std::string, tst_method_ptr> MethodContainer; + MethodContainer test_methods_; + void init(); + +protected: + + /** + * Since we are running within Emacs, the default behavior of + * print_progress which includes backspace does not work. + * We'll use a single '.' instead. + */ + virtual void print_progress() { *m_osptr << '.' << std::flush; } + +public: + + QueryParserTest() : Test("QueryParser"), test_methods_() { init(); } + ~QueryParserTest() {} + + /************************************************************************* + * main entry points + *************************************************************************/ + void Run(MethodContainer::iterator &itr); + virtual void Run(); + void Run(const char *method); + void Run(int argc, char* argv[]); +}; + + +// Local Variables: +// mode:c++ +// End: |