From c62a40b368c3f87f2af75038974961e83a48a779 Mon Sep 17 00:00:00 2001 From: Arne H Juul Date: Tue, 2 May 2017 11:05:57 +0200 Subject: misc cleanup from Baldersheim * include file cleanup * only do LOG_SETUP as needed * remove "virtual" where "override" is specified also * some minor reformatting and indentation changes --- juniper/src/test/SrcTestSuite.cpp | 25 ++++--------------------- juniper/src/test/auxTest.cpp | 16 ++++++++-------- juniper/src/test/auxTest.h | 5 ++--- juniper/src/test/auxTestApp.cpp | 5 ++--- juniper/src/test/fakerewriter.h | 8 ++++---- juniper/src/test/matchobjectTest.h | 9 ++++----- juniper/src/test/matchobjectTestApp.cpp | 23 +++-------------------- juniper/src/test/mcandTest.cpp | 12 ++++++------ juniper/src/test/mcandTest.h | 4 ++-- juniper/src/test/mcandTestApp.cpp | 24 +++--------------------- juniper/src/test/queryparserTest.h | 8 ++++---- juniper/src/test/queryparserTestApp.cpp | 23 +++-------------------- juniper/src/test/testenv.h | 5 +++-- 13 files changed, 48 insertions(+), 119 deletions(-) (limited to 'juniper/src') 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$ - * - *
- *              Copyright (c) : 2003 Fast Search & Transfer ASA
- *                              ALL RIGHTS RESERVED
- * 
- ****************************************************************************/ -#include -#include -#include + #include "testenv.h" #include "mcandTest.h" #include "queryparserTest.h" #include "matchobjectTest.h" #include "auxTest.h" - +#include +#include /** * 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..349792ed723 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 -#include -LOG_SETUP(""); #include "auxTest.h" +#include +#include +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 _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 #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 -#include #include "auxTest.h" +#include 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 -#include #include "testenv.h" +#include +#include /** * 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$ - * - *
- *              Copyright (c) : 2003 Fast Search & Transfer ASA
- *                              ALL RIGHTS RESERVED
- * 
- ****************************************************************************/ -#include -#include + #include "matchobjectTest.h" #include "testenv.h" +#include /** * 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..7f7d7d42100 100644 --- a/juniper/src/test/mcandTest.cpp +++ b/juniper/src/test/mcandTest.cpp @@ -16,11 +16,11 @@ * ALL RIGHTS RESERVED * ***************************************************************************/ -#include -#include -LOG_SETUP(""); + #include "mcandTest.h" -#include "testenv.h" + +#include +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 _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$ - * - *
- *              Copyright (c) : 2003 Fast Search & Transfer ASA
- *                              ALL RIGHTS RESERVED
- * 
- ****************************************************************************/ -#include -#include + #include "mcandTest.h" -#include "testenv.h" +#include /** * 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 -#include #include "testenv.h" #include #include +#include +#include /** * 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$ - * - *
- *              Copyright (c) : 2003 Fast Search & Transfer ASA
- *                              ALL RIGHTS RESERVED
- * 
- ****************************************************************************/ -#include -#include + #include "queryparserTest.h" #include "testenv.h" +#include /** * 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 #include #include +#include namespace juniper { @@ -55,9 +56,9 @@ private: std::map _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; }; -- cgit v1.2.3