diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-05 02:32:06 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-23 02:03:47 +0200 |
commit | b57308e4a134fb6139d2cb52a031d3e7185f16cf (patch) | |
tree | 7c31d445e2f76bb737ef90ce29e0e7e6738d6eb1 /juniper | |
parent | 40b8ba5a3f34028d208d4e0dc1b46940d6fe5a47 (diff) |
Use override
Diffstat (limited to 'juniper')
-rw-r--r-- | juniper/src/test/SrcTestSuite.cpp | 25 | ||||
-rw-r--r-- | juniper/src/test/auxTest.cpp | 16 | ||||
-rw-r--r-- | juniper/src/test/auxTest.h | 5 | ||||
-rw-r--r-- | juniper/src/test/auxTestApp.cpp | 5 | ||||
-rw-r--r-- | juniper/src/test/fakerewriter.h | 8 | ||||
-rw-r--r-- | juniper/src/test/matchobjectTest.h | 9 | ||||
-rw-r--r-- | juniper/src/test/matchobjectTestApp.cpp | 23 | ||||
-rw-r--r-- | juniper/src/test/mcandTest.cpp | 12 | ||||
-rw-r--r-- | juniper/src/test/mcandTest.h | 4 | ||||
-rw-r--r-- | juniper/src/test/mcandTestApp.cpp | 24 | ||||
-rw-r--r-- | juniper/src/test/queryparserTest.h | 8 | ||||
-rw-r--r-- | juniper/src/test/queryparserTestApp.cpp | 23 | ||||
-rw-r--r-- | juniper/src/test/testenv.h | 5 |
13 files changed, 48 insertions, 119 deletions
diff --git a/juniper/src/test/SrcTestSuite.cpp b/juniper/src/test/SrcTestSuite.cpp index f73e4c8fc3a..4a648e6af19 100644 --- a/juniper/src/test/SrcTestSuite.cpp +++ b/juniper/src/test/SrcTestSuite.cpp @@ -1,29 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Implementation of the test suite application SrcTestSuite. - * - * @file SrcTestSuite.cpp - * - * @author Knut Omang - * - * @date Created 21 Feb 2003 - * - * $Id$ - * - * <pre> - * Copyright (c) : 2003 Fast Search & Transfer ASA - * ALL RIGHTS RESERVED - * </pre> - ****************************************************************************/ -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/fastlib/testsuite/suite.h> + #include "testenv.h" #include "mcandTest.h" #include "queryparserTest.h" #include "matchobjectTest.h" #include "auxTest.h" - +#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/fastlib/testsuite/suite.h> /** * The SrcTestSuite class runs all the unit tests for the src module. * @@ -53,7 +36,7 @@ SrcTestSuite::SrcTestSuite() : */ class SrcTestSuiteApp : public vespalib::TestApp { public: - virtual int Main() override; + int Main() override; }; int SrcTestSuiteApp::Main() { diff --git a/juniper/src/test/auxTest.cpp b/juniper/src/test/auxTest.cpp index 2dc3457e6c3..0ea1a52aeb6 100644 --- a/juniper/src/test/auxTest.cpp +++ b/juniper/src/test/auxTest.cpp @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(""); #include "auxTest.h" +#include <vespa/fastos/file.h> +#include <vespa/log/log.h> +LOG_SETUP("auxtest"); // Using separator definitions only from here: @@ -560,7 +560,7 @@ void AuxTest::test_summary(Matcher& m, const char* content, size_t content_len, class DefProps : public IJuniperProperties { public: - virtual const char* GetProperty(const char*, const char* def) override { + const char* GetProperty(const char*, const char* def) override { return def; } }; @@ -626,12 +626,12 @@ public: TokenChecker(Token* output) : _out(output), i(0) { } - virtual void handle_token(Token& token) override { + void handle_token(Token& token) override { _out[i] = token; i++; } - virtual void handle_end(Token&) override {} + void handle_end(Token&) override {} }; @@ -670,13 +670,13 @@ private: std::vector<std::string> _tokens; public: TokenProcessor(const std::string & text) : _text(text), _tokens() {} - virtual void handle_token(Token & t) override { + void handle_token(Token & t) override { _tokens.push_back(std::string(_text.c_str() + t.bytepos, t.bytelen)); //LOG(info, "handle_token(%s): bytepos(%d), wordpos(%d), bytelen(%d), curlen(%d)", //_tokens.back().c_str(), //(int)t.bytepos, (int)t.wordpos, t.bytelen, t.curlen); } - virtual void handle_end(Token & t) override { + void handle_end(Token & t) override { _tokens.push_back(std::string(_text.c_str() + t.bytepos, t.bytelen)); //LOG(info, "handle_end(%s): bytepos(%d), wordpos(%d), bytelen(%d), curlen(%d)", //_tokens.back().c_str(), diff --git a/juniper/src/test/auxTest.h b/juniper/src/test/auxTest.h index 218dcaab6d0..a98adc732f4 100644 --- a/juniper/src/test/auxTest.h +++ b/juniper/src/test/auxTest.h @@ -7,7 +7,6 @@ #include <vespa/fastlib/testsuite/test.h> #include "testenv.h" - class AuxTest : public Test { private: @@ -25,14 +24,14 @@ public: void Run(MethodContainer::iterator &itr); void Run(const char* method); void Run(int argc, char* argv[]); - virtual void Run() override; + void Run() override; 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() override { *m_osptr << '.' << std::flush; } + void print_progress() override { *m_osptr << '.' << std::flush; } private: // tests: void TestPropertyMap(); diff --git a/juniper/src/test/auxTestApp.cpp b/juniper/src/test/auxTestApp.cpp index 3f43c706d35..a9475998aa4 100644 --- a/juniper/src/test/auxTestApp.cpp +++ b/juniper/src/test/auxTestApp.cpp @@ -1,12 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/testkit/testapp.h> #include "auxTest.h" +#include <vespa/vespalib/testkit/testapp.h> class AuxTestApp : public vespalib::TestApp { public: - virtual int Main() override; + int Main() override; }; diff --git a/juniper/src/test/fakerewriter.h b/juniper/src/test/fakerewriter.h index 0a0554f76fc..cf78fd28255 100644 --- a/juniper/src/test/fakerewriter.h +++ b/juniper/src/test/fakerewriter.h @@ -8,10 +8,10 @@ class FakeRewriter: public juniper::IRewriter { public: FakeRewriter() : _name() {} - virtual const char* Name() const override; - virtual juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term) override; - virtual juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term, size_t length) override; - virtual const char* NextTerm(juniper::RewriteHandle* exp, size_t& length) override; + const char* Name() const override; + juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term) override; + juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term, size_t length) override; + const char* NextTerm(juniper::RewriteHandle* exp, size_t& length) override; private: std::string _name; }; diff --git a/juniper/src/test/matchobjectTest.h b/juniper/src/test/matchobjectTest.h index 9e0828cfa77..0f4a1ace55b 100644 --- a/juniper/src/test/matchobjectTest.h +++ b/juniper/src/test/matchobjectTest.h @@ -17,9 +17,9 @@ ***************************************************************************/ #pragma once -#include <map> -#include <vespa/fastlib/testsuite/test.h> #include "testenv.h" +#include <vespa/fastlib/testsuite/test.h> +#include <map> /** * The MatchObjectTest class holds @@ -98,8 +98,7 @@ protected: * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() override { *m_osptr << '.' << std::flush; } - + void print_progress() override { *m_osptr << '.' << std::flush; } public: MatchObjectTest() : Test("MatchObject"), test_methods_() { init(); } @@ -109,7 +108,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - virtual void Run() override; + void Run() override; void Run(const char *method); void Run(int argc, char* argv[]); }; diff --git a/juniper/src/test/matchobjectTestApp.cpp b/juniper/src/test/matchobjectTestApp.cpp index 065af199589..f755c3e932a 100644 --- a/juniper/src/test/matchobjectTestApp.cpp +++ b/juniper/src/test/matchobjectTestApp.cpp @@ -1,25 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Definition and implementation of the application for running unit tests - * for the MatchObject class in isolation. - * - * @file matchobjectTestApp.cpp - * - * @author Knut Omang - * - * @date Created 21 Feb 2003 - * - * $Id$ - * - * <pre> - * Copyright (c) : 2003 Fast Search & Transfer ASA - * ALL RIGHTS RESERVED - * </pre> - ****************************************************************************/ -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/testkit/testapp.h> + #include "matchobjectTest.h" #include "testenv.h" +#include <vespa/vespalib/testkit/testapp.h> /** * The MatchObjectTestApp class is the main routine for running the unit @@ -29,7 +12,7 @@ */ class MatchObjectTestApp : public vespalib::TestApp { public: - virtual int Main() override { + int Main() override { juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); MatchObjectTest test; test.SetStream(&std::cout); diff --git a/juniper/src/test/mcandTest.cpp b/juniper/src/test/mcandTest.cpp index b185707c1be..0dc198864fe 100644 --- a/juniper/src/test/mcandTest.cpp +++ b/juniper/src/test/mcandTest.cpp @@ -16,11 +16,11 @@ * ALL RIGHTS RESERVED * </pre> ***************************************************************************/ -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(""); + #include "mcandTest.h" -#include "testenv.h" + +#include <vespa/log/log.h> +LOG_SETUP("mcandtest"); // Comment out cerr below to ignore unimplemented tests #define NOTEST(name) \ @@ -405,13 +405,13 @@ struct MyTokenProcessor : public ITokenProcessor Matcher &_m; std::vector<size_t> _cands; MyTokenProcessor(Matcher &m) : _m(m), _cands() {} - virtual void handle_token(Token &token) override { + void handle_token(Token &token) override { _m.handle_token(token); const match_sequence *ms = _m.GetWorkSet(); _cands.push_back(ms[0].size()); LOG(info, "match_sequence[0].size(%zu)", _cands.back()); } - virtual void handle_end(Token &token) override { + void handle_end(Token &token) override { _m.handle_end(token); } }; diff --git a/juniper/src/test/mcandTest.h b/juniper/src/test/mcandTest.h index 754c18ee9dd..3fc32ee9f5d 100644 --- a/juniper/src/test/mcandTest.h +++ b/juniper/src/test/mcandTest.h @@ -196,7 +196,7 @@ protected: * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() override { *m_osptr << '.' << std::flush; } + void print_progress() override { *m_osptr << '.' << std::flush; } public: @@ -207,7 +207,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - virtual void Run() override; + void Run() override; void Run(const char *method); void Run(int argc, char* argv[]); }; diff --git a/juniper/src/test/mcandTestApp.cpp b/juniper/src/test/mcandTestApp.cpp index 8a93c14cfc9..cb33e503bb5 100644 --- a/juniper/src/test/mcandTestApp.cpp +++ b/juniper/src/test/mcandTestApp.cpp @@ -1,25 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Definition and implementation of the application for running unit tests - * for the MatchCandidate class in isolation. - * - * @file mcandTestApp.cpp - * - * @author Knut Omang - * - * @date Created 27 Feb 2003 - * - * $Id$ - * - * <pre> - * Copyright (c) : 2003 Fast Search & Transfer ASA - * ALL RIGHTS RESERVED - * </pre> - ****************************************************************************/ -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/testkit/testapp.h> + #include "mcandTest.h" -#include "testenv.h" +#include <vespa/vespalib/testkit/testapp.h> /** * The MatchCandidateTestApp class is the main routine for running the unit @@ -29,7 +11,7 @@ */ class MatchCandidateTestApp : public vespalib::TestApp { public: - virtual int Main() override { + int Main() override { juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); MatchCandidateTest test; test.SetStream(&std::cout); diff --git a/juniper/src/test/queryparserTest.h b/juniper/src/test/queryparserTest.h index b4f464f7592..d868fca659e 100644 --- a/juniper/src/test/queryparserTest.h +++ b/juniper/src/test/queryparserTest.h @@ -17,11 +17,11 @@ ***************************************************************************/ #pragma once -#include <map> -#include <vespa/fastlib/testsuite/test.h> #include "testenv.h" #include <vespa/juniper/queryparser.h> #include <vespa/juniper/rewriter.h> +#include <vespa/fastlib/testsuite/test.h> +#include <map> /** * The QueryParserTest class holds @@ -97,7 +97,7 @@ protected: * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() override { *m_osptr << '.' << std::flush; } + void print_progress() override { *m_osptr << '.' << std::flush; } public: @@ -108,7 +108,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - virtual void Run() override; + void Run() override; void Run(const char *method); void Run(int argc, char* argv[]); }; diff --git a/juniper/src/test/queryparserTestApp.cpp b/juniper/src/test/queryparserTestApp.cpp index 3559b0177b6..7b3151a2314 100644 --- a/juniper/src/test/queryparserTestApp.cpp +++ b/juniper/src/test/queryparserTestApp.cpp @@ -1,25 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Definition and implementation of the application for running unit tests - * for the QueryParser class in isolation. - * - * @file queryparserTestApp.cpp - * - * @author Knut Omang - * - * @date Created 24 Feb 2003 - * - * $Id$ - * - * <pre> - * Copyright (c) : 2003 Fast Search & Transfer ASA - * ALL RIGHTS RESERVED - * </pre> - ****************************************************************************/ -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/testkit/testapp.h> + #include "queryparserTest.h" #include "testenv.h" +#include <vespa/vespalib/testkit/testapp.h> /** * The QueryParserTestApp class is the main routine for running the unit @@ -29,7 +12,7 @@ */ class QueryParserTestApp : public vespalib::TestApp { public: - virtual int Main() override { + int Main() override { juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); QueryParserTest test; test.SetStream(&std::cout); diff --git a/juniper/src/test/testenv.h b/juniper/src/test/testenv.h index 88d250767fc..cc126f3f3a5 100644 --- a/juniper/src/test/testenv.h +++ b/juniper/src/test/testenv.h @@ -20,6 +20,7 @@ #include <vespa/juniper/mcand.h> #include <vespa/juniper/propreader.h> #include <vespa/juniper/specialtokenregistry.h> +#include <vespa/fastos/app.h> namespace juniper { @@ -55,9 +56,9 @@ private: std::map<std::string, std::string> _map; public: PropertyMap(); - virtual ~PropertyMap(); + ~PropertyMap(); PropertyMap &set(const char *name, const char *value); - virtual const char* GetProperty(const char* name, const char* def = NULL) override; + const char* GetProperty(const char* name, const char* def = NULL) override; }; |