diff options
author | Arne H Juul <arnej27959@users.noreply.github.com> | 2017-04-24 12:10:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-24 12:10:42 +0200 |
commit | 9ff4bdb407ed8d855a3f86a17c99906ff738177b (patch) | |
tree | fc2b050224d7dde92d57e1f9cac12c1e5aaf6b90 /juniper/src | |
parent | 32ae190acc9ac5081049e1c7008d1602c68cf821 (diff) |
Revert "Balder/enforce override 2"
Diffstat (limited to 'juniper/src')
-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, 119 insertions, 48 deletions
diff --git a/juniper/src/test/SrcTestSuite.cpp b/juniper/src/test/SrcTestSuite.cpp index 4a648e6af19..f73e4c8fc3a 100644 --- a/juniper/src/test/SrcTestSuite.cpp +++ b/juniper/src/test/SrcTestSuite.cpp @@ -1,12 +1,29 @@ // 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. * @@ -36,7 +53,7 @@ SrcTestSuite::SrcTestSuite() : */ class SrcTestSuiteApp : public vespalib::TestApp { public: - int Main() override; + virtual int Main() override; }; int SrcTestSuiteApp::Main() { diff --git a/juniper/src/test/auxTest.cpp b/juniper/src/test/auxTest.cpp index 349792ed723..2dc3457e6c3 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: - const char* GetProperty(const char*, const char* def) override { + virtual const char* GetProperty(const char*, const char* def) override { return def; } }; @@ -626,12 +626,12 @@ public: TokenChecker(Token* output) : _out(output), i(0) { } - void handle_token(Token& token) override { + virtual void handle_token(Token& token) override { _out[i] = token; i++; } - void handle_end(Token&) override {} + virtual void handle_end(Token&) override {} }; @@ -670,13 +670,13 @@ private: std::vector<std::string> _tokens; public: TokenProcessor(const std::string & text) : _text(text), _tokens() {} - void handle_token(Token & t) override { + virtual 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); } - void handle_end(Token & t) override { + virtual 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 a98adc732f4..218dcaab6d0 100644 --- a/juniper/src/test/auxTest.h +++ b/juniper/src/test/auxTest.h @@ -7,6 +7,7 @@ #include <vespa/fastlib/testsuite/test.h> #include "testenv.h" + class AuxTest : public Test { private: @@ -24,14 +25,14 @@ public: void Run(MethodContainer::iterator &itr); void Run(const char* method); void Run(int argc, char* argv[]); - void Run() override; + virtual 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. */ - void print_progress() override { *m_osptr << '.' << std::flush; } + virtual 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 a9475998aa4..3f43c706d35 100644 --- a/juniper/src/test/auxTestApp.cpp +++ b/juniper/src/test/auxTestApp.cpp @@ -1,11 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "auxTest.h" +#include <vespa/fastos/fastos.h> #include <vespa/vespalib/testkit/testapp.h> +#include "auxTest.h" class AuxTestApp : public vespalib::TestApp { public: - int Main() override; + virtual int Main() override; }; diff --git a/juniper/src/test/fakerewriter.h b/juniper/src/test/fakerewriter.h index cf78fd28255..0a0554f76fc 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() {} - 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; + 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; private: std::string _name; }; diff --git a/juniper/src/test/matchobjectTest.h b/juniper/src/test/matchobjectTest.h index 0f4a1ace55b..9e0828cfa77 100644 --- a/juniper/src/test/matchobjectTest.h +++ b/juniper/src/test/matchobjectTest.h @@ -17,9 +17,9 @@ ***************************************************************************/ #pragma once -#include "testenv.h" -#include <vespa/fastlib/testsuite/test.h> #include <map> +#include <vespa/fastlib/testsuite/test.h> +#include "testenv.h" /** * The MatchObjectTest class holds @@ -98,7 +98,8 @@ protected: * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - void print_progress() override { *m_osptr << '.' << std::flush; } + virtual void print_progress() override { *m_osptr << '.' << std::flush; } + public: MatchObjectTest() : Test("MatchObject"), test_methods_() { init(); } @@ -108,7 +109,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - void Run() override; + virtual 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 f755c3e932a..065af199589 100644 --- a/juniper/src/test/matchobjectTestApp.cpp +++ b/juniper/src/test/matchobjectTestApp.cpp @@ -1,8 +1,25 @@ // 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 @@ -12,7 +29,7 @@ */ class MatchObjectTestApp : public vespalib::TestApp { public: - int Main() override { + virtual 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 7f7d7d42100..b185707c1be 100644 --- a/juniper/src/test/mcandTest.cpp +++ b/juniper/src/test/mcandTest.cpp @@ -16,11 +16,11 @@ * ALL RIGHTS RESERVED * </pre> ***************************************************************************/ - -#include "mcandTest.h" - +#include <vespa/fastos/fastos.h> #include <vespa/log/log.h> -LOG_SETUP(".mcandtest"); +LOG_SETUP(""); +#include "mcandTest.h" +#include "testenv.h" // 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() {} - void handle_token(Token &token) override { + virtual 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()); } - void handle_end(Token &token) override { + virtual 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 3fc32ee9f5d..754c18ee9dd 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. */ - void print_progress() override { *m_osptr << '.' << std::flush; } + virtual void print_progress() override { *m_osptr << '.' << std::flush; } public: @@ -207,7 +207,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - void Run() override; + virtual 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 cb33e503bb5..8a93c14cfc9 100644 --- a/juniper/src/test/mcandTestApp.cpp +++ b/juniper/src/test/mcandTestApp.cpp @@ -1,7 +1,25 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "mcandTest.h" +/** + * 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" /** * The MatchCandidateTestApp class is the main routine for running the unit @@ -11,7 +29,7 @@ */ class MatchCandidateTestApp : public vespalib::TestApp { public: - int Main() override { + virtual 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 d868fca659e..b4f464f7592 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. */ - void print_progress() override { *m_osptr << '.' << std::flush; } + virtual void print_progress() override { *m_osptr << '.' << std::flush; } public: @@ -108,7 +108,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - void Run() override; + virtual 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 7b3151a2314..3559b0177b6 100644 --- a/juniper/src/test/queryparserTestApp.cpp +++ b/juniper/src/test/queryparserTestApp.cpp @@ -1,8 +1,25 @@ // 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 @@ -12,7 +29,7 @@ */ class QueryParserTestApp : public vespalib::TestApp { public: - int Main() override { + virtual 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 cc126f3f3a5..88d250767fc 100644 --- a/juniper/src/test/testenv.h +++ b/juniper/src/test/testenv.h @@ -20,7 +20,6 @@ #include <vespa/juniper/mcand.h> #include <vespa/juniper/propreader.h> #include <vespa/juniper/specialtokenregistry.h> -#include <vespa/fastos/app.h> namespace juniper { @@ -56,9 +55,9 @@ private: std::map<std::string, std::string> _map; public: PropertyMap(); - ~PropertyMap(); + virtual ~PropertyMap(); PropertyMap &set(const char *name, const char *value); - const char* GetProperty(const char* name, const char* def = NULL) override; + virtual const char* GetProperty(const char* name, const char* def = NULL) override; }; |