diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-26 22:13:52 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-26 22:13:52 +0200 |
commit | 8dce83b423159201d91e97c5d779ef8c064b025d (patch) | |
tree | 2de86cba041396eb8e3a94abe56898f7a408f316 /staging_vespalib/src/tests | |
parent | 46dd4350fd595b42ef213981773487f62c86417b (diff) |
No virtual on override
Optimize includes.
Diffstat (limited to 'staging_vespalib/src/tests')
30 files changed, 57 insertions, 389 deletions
diff --git a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp index ce21c918219..75092255f9e 100644 --- a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp @@ -1,5 +1,4 @@ // 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 <vespa/vespalib/util/rusage.h> #include <vespa/vespalib/util/optimized.h> diff --git a/staging_vespalib/src/tests/array/allocinarray_test.cpp b/staging_vespalib/src/tests/array/allocinarray_test.cpp index 059fff91cec..c68cc3fa874 100644 --- a/staging_vespalib/src/tests/array/allocinarray_test.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_test.cpp @@ -1,14 +1,10 @@ // 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> #include <vespa/vespalib/util/array.h> #include <vespa/vespalib/util/allocinarray.h> #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/testkit/testapp.h> #include <deque> -LOG_SETUP("array_test"); - using namespace vespalib; class Test : public TestApp diff --git a/staging_vespalib/src/tests/array/sort_benchmark.cpp b/staging_vespalib/src/tests/array/sort_benchmark.cpp index 9e2b286e864..29f1560e426 100644 --- a/staging_vespalib/src/tests/array/sort_benchmark.cpp +++ b/staging_vespalib/src/tests/array/sort_benchmark.cpp @@ -1,5 +1,4 @@ // 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 <vespa/vespalib/util/rusage.h> #include <vespa/vespalib/util/array.hpp> diff --git a/staging_vespalib/src/tests/benchmark/benchmark.cpp b/staging_vespalib/src/tests/benchmark/benchmark.cpp index 1c4c5a59c63..7a25fa39063 100644 --- a/staging_vespalib/src/tests/benchmark/benchmark.cpp +++ b/staging_vespalib/src/tests/benchmark/benchmark.cpp @@ -1,7 +1,4 @@ // 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("benchmark_test"); #include <vespa/vespalib/testkit/testapp.h> #include "testbase.h" diff --git a/staging_vespalib/src/tests/benchmark/testbase.cpp b/staging_vespalib/src/tests/benchmark/testbase.cpp index 9ac20638218..93f5c9b975a 100644 --- a/staging_vespalib/src/tests/benchmark/testbase.cpp +++ b/staging_vespalib/src/tests/benchmark/testbase.cpp @@ -1,10 +1,8 @@ // 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 <linux/time.h> -#include <vespa/log/log.h> -#include <vespa/fastos/timestamp.h> #include "testbase.h" +#include <vespa/fastos/timestamp.h> +#include <vespa/log/log.h> LOG_SETUP(".testbase"); namespace vespalib { diff --git a/staging_vespalib/src/tests/benchmark/testbase.h b/staging_vespalib/src/tests/benchmark/testbase.h index 02f11e21cac..beb485e6dab 100644 --- a/staging_vespalib/src/tests/benchmark/testbase.h +++ b/staging_vespalib/src/tests/benchmark/testbase.h @@ -45,7 +45,7 @@ public: private: typedef std::vector<int> Vector; size_t callByReference(const Vector & values) const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ParamByValueVectorInt : public Benchmark @@ -55,7 +55,7 @@ public: private: typedef std::vector<int> Vector; size_t callByValue(Vector values) const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ParamByReferenceVectorString : public Benchmark @@ -65,7 +65,7 @@ public: private: typedef std::vector<std::string> Vector; size_t callByReference(const Vector & values) const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ParamByValueVectorString : public Benchmark @@ -75,7 +75,7 @@ public: private: typedef std::vector<std::string> Vector; size_t callByValue(Vector values) const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ReturnByReferenceVectorString : public Benchmark @@ -85,7 +85,7 @@ public: private: typedef std::vector<std::string> Vector; const Vector & returnByReference(Vector & values) const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ReturnByValueVectorString : public Benchmark @@ -95,7 +95,7 @@ public: private: typedef std::vector<std::string> Vector; Vector returnByValue() const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ReturnByValueMultiVectorString : public Benchmark @@ -105,7 +105,7 @@ public: private: typedef std::vector<std::string> Vector; Vector returnByValue() const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class CreateVespalibString : public Benchmark @@ -113,7 +113,7 @@ class CreateVespalibString : public Benchmark public: DECLARE_BENCHMARK(CreateVespalibString); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockSystem : public Benchmark @@ -121,7 +121,7 @@ class ClockSystem : public Benchmark public: DECLARE_BENCHMARK(ClockSystem); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockREALTIME : public Benchmark @@ -129,7 +129,7 @@ class ClockREALTIME : public Benchmark public: DECLARE_BENCHMARK(ClockREALTIME); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockMONOTONIC : public Benchmark @@ -137,7 +137,7 @@ class ClockMONOTONIC : public Benchmark public: DECLARE_BENCHMARK(ClockMONOTONIC); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockMONOTONIC_RAW : public Benchmark @@ -146,7 +146,7 @@ public: DECLARE_BENCHMARK(ClockMONOTONIC_RAW); ClockMONOTONIC_RAW(); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockPROCESS_CPUTIME_ID : public Benchmark @@ -154,7 +154,7 @@ class ClockPROCESS_CPUTIME_ID : public Benchmark public: DECLARE_BENCHMARK(ClockPROCESS_CPUTIME_ID); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockTHREAD_CPUTIME_ID : public Benchmark @@ -162,8 +162,7 @@ class ClockTHREAD_CPUTIME_ID : public Benchmark public: DECLARE_BENCHMARK(ClockTHREAD_CPUTIME_ID); private: - virtual size_t onRun() override; + size_t onRun() override; }; } - diff --git a/staging_vespalib/src/tests/bits/bits_test.cpp b/staging_vespalib/src/tests/bits/bits_test.cpp index f7b3ef1bf84..783651db366 100644 --- a/staging_vespalib/src/tests/bits/bits_test.cpp +++ b/staging_vespalib/src/tests/bits/bits_test.cpp @@ -1,7 +1,5 @@ // 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("bits_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/bits.h> #include <boost/crc.hpp> diff --git a/staging_vespalib/src/tests/clock/clock_test.cpp b/staging_vespalib/src/tests/clock/clock_test.cpp index 025d8766a29..58a01a520b6 100644 --- a/staging_vespalib/src/tests/clock/clock_test.cpp +++ b/staging_vespalib/src/tests/clock/clock_test.cpp @@ -1,9 +1,7 @@ // 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("sharedptr_test"); -#include <vespa/vespalib/util/clock.h> + #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/clock.h> using vespalib::Clock; using fastos::TimeStamp; diff --git a/staging_vespalib/src/tests/crc/crc_test.cpp b/staging_vespalib/src/tests/crc/crc_test.cpp index 6a5a0779d8b..df8ac89db62 100644 --- a/staging_vespalib/src/tests/crc/crc_test.cpp +++ b/staging_vespalib/src/tests/crc/crc_test.cpp @@ -1,7 +1,5 @@ // 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("crc_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/crc.h> #include <boost/crc.hpp> diff --git a/staging_vespalib/src/tests/create-test.sh b/staging_vespalib/src/tests/create-test.sh index 56234dbab30..0e735e1b890 100755 --- a/staging_vespalib/src/tests/create-test.sh +++ b/staging_vespalib/src/tests/create-test.sh @@ -15,10 +15,9 @@ gen_project_file() { gen_source() { echo "generating '$1' ..." - echo "#include <vespa/log/log.h>" > $1 + echo "#include <vespa/vespalib/testkit/testapp.h>" > $1 + echo "#include <vespa/log/log.h>" >> $1 echo "LOG_SETUP(\"${test}_test\");" >> $1 - echo "#include <vespa/fastos/fastos.h>" >> $1 - echo "#include <vespa/vespalib/testkit/testapp.h>" >> $1 echo "" >> $1 echo "using namespace vespalib;" >> $1 echo "" >> $1 diff --git a/staging_vespalib/src/tests/databuffer/databuffer_test.cpp b/staging_vespalib/src/tests/databuffer/databuffer_test.cpp index 7ec83e58b5c..1a242e8eec4 100644 --- a/staging_vespalib/src/tests/databuffer/databuffer_test.cpp +++ b/staging_vespalib/src/tests/databuffer/databuffer_test.cpp @@ -1,7 +1,4 @@ // 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("databuffer_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/databuffer.h> diff --git a/staging_vespalib/src/tests/directio/directio.cpp b/staging_vespalib/src/tests/directio/directio.cpp index 570d7276bc9..0fb3b8a4434 100644 --- a/staging_vespalib/src/tests/directio/directio.cpp +++ b/staging_vespalib/src/tests/directio/directio.cpp @@ -1,10 +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("directio_test"); + #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/data/databuffer.h> +#include <vespa/fastos/file.h> using namespace fastos; using namespace vespalib; diff --git a/staging_vespalib/src/tests/encoding/base64/base64_test.cpp b/staging_vespalib/src/tests/encoding/base64/base64_test.cpp index e765ac7d601..a22484463a5 100644 --- a/staging_vespalib/src/tests/encoding/base64/base64_test.cpp +++ b/staging_vespalib/src/tests/encoding/base64/base64_test.cpp @@ -1,14 +1,8 @@ // 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 <vespa/vespalib/encoding/base64.h> - -#include <vespa/log/log.h> -#include <iostream> #include <vector> -#include <vespa/vespalib/testkit/testapp.h> - -LOG_SETUP("base64_test"); using namespace vespalib; diff --git a/staging_vespalib/src/tests/fileheader/fileheader_test.cpp b/staging_vespalib/src/tests/fileheader/fileheader_test.cpp index f2a6c8402ee..55ca571cdac 100644 --- a/staging_vespalib/src/tests/fileheader/fileheader_test.cpp +++ b/staging_vespalib/src/tests/fileheader/fileheader_test.cpp @@ -1,10 +1,8 @@ // 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("fileheader_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/fileheader.h> +#include <vespa/fastos/file.h> #include <iostream> using namespace vespalib; @@ -29,15 +27,9 @@ private: void testRewriteErrors(); void testLayout(); - void - testReadSize(bool mapped); - - void - testReadSizeErrors(bool mapped); - - bool - testReadSizeError(DataBuffer &buf, const std::string &expected, - bool mapped); + void testReadSize(bool mapped); + void testReadSizeErrors(bool mapped); + bool testReadSizeError(DataBuffer &buf, const std::string &expected, bool mapped); public: int Main() override { diff --git a/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp b/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp index 98b6804ac8e..19e52dbe885 100644 --- a/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp +++ b/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - // Include first to make sure it includes all it need. -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/objects/floatingpointtype.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/objects/floatingpointtype.h> class Test : public vespalib::TestApp { diff --git a/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp b/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp index aaf3f383c33..1ba9c912344 100644 --- a/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp +++ b/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp @@ -1,7 +1,5 @@ // 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("guard_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/growablebytebuffer.h> diff --git a/staging_vespalib/src/tests/librarypool/librarypool_test.cpp b/staging_vespalib/src/tests/librarypool/librarypool_test.cpp index 665dbca8a86..87e04d3ffbd 100644 --- a/staging_vespalib/src/tests/librarypool/librarypool_test.cpp +++ b/staging_vespalib/src/tests/librarypool/librarypool_test.cpp @@ -1,10 +1,7 @@ // 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 <vespa/vespalib/util/librarypool.h> #include <vespa/vespalib/util/exceptions.h> -#include <vespa/log/log.h> -LOG_SETUP("librarypool_test"); using namespace vespalib; diff --git a/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp b/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp index 5430e8c1465..5a1c0d7fb32 100644 --- a/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp +++ b/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp @@ -1,11 +1,8 @@ // 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("data_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/memorydatastore.h> #include <vespa/vespalib/stllike/asciistream.h> -#include <vector> using namespace vespalib; diff --git a/staging_vespalib/src/tests/objectdump/objectdump.cpp b/staging_vespalib/src/tests/objectdump/objectdump.cpp index 671e89b5011..3bdbe2401e4 100644 --- a/staging_vespalib/src/tests/objectdump/objectdump.cpp +++ b/staging_vespalib/src/tests/objectdump/objectdump.cpp @@ -1,5 +1,5 @@ // 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 <vespa/vespalib/objects/identifiable.h> #include <vespa/vespalib/objects/visit.hpp> @@ -22,7 +22,7 @@ IMPLEMENT_IDENTIFIABLE(Base, vespalib::Identifiable); struct Baz : public Base { DECLARE_IDENTIFIABLE(Baz); - virtual Baz *clone() const override { return new Baz(*this); } + Baz *clone() const override { return new Baz(*this); } }; IMPLEMENT_IDENTIFIABLE(Baz, Base); @@ -45,9 +45,9 @@ struct Bar : public Base _int32(-4), _uint32(4), _int64(-8), _uint64(8), _float(2.5), _double(2.75), _string("bla bla") {} - virtual Bar *clone() const override { return new Bar(*this); } + Bar *clone() const override { return new Bar(*this); } - virtual void visitMembers(ObjectVisitor &v) const override { + void visitMembers(ObjectVisitor &v) const override { visit(v, "_bool", _bool); visit(v, "_int8", _int8); visit(v, "_uint8", _uint8); diff --git a/staging_vespalib/src/tests/objects/identifiable_test.cpp b/staging_vespalib/src/tests/objects/identifiable_test.cpp index c60f33b9b55..5ef48b6e779 100644 --- a/staging_vespalib/src/tests/objects/identifiable_test.cpp +++ b/staging_vespalib/src/tests/objects/identifiable_test.cpp @@ -1,5 +1,5 @@ // 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 <vespa/vespalib/objects/identifiable.hpp> #include <vespa/vespalib/objects/namedobject.h> @@ -40,7 +40,7 @@ class A : public Abstract public: DECLARE_IDENTIFIABLE(A); A() { } - virtual void someAbstractVirtualMethod() override { } + void someAbstractVirtualMethod() override { }; }; class B : public A diff --git a/staging_vespalib/src/tests/objectselection/objectselection.cpp b/staging_vespalib/src/tests/objectselection/objectselection.cpp index 27ecb068231..db696230082 100644 --- a/staging_vespalib/src/tests/objectselection/objectselection.cpp +++ b/staging_vespalib/src/tests/objectselection/objectselection.cpp @@ -1,5 +1,5 @@ // 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 <vespa/vespalib/objects/identifiable.hpp> #include <vespa/vespalib/objects/objectpredicate.h> @@ -17,7 +17,7 @@ struct Foo : public Identifiable DECLARE_IDENTIFIABLE(Foo); virtual Foo *clone() const { return new Foo(*this); } - virtual void selectMembers(const ObjectPredicate &p, ObjectOperation &o) override { + void selectMembers(const ObjectPredicate &p, ObjectOperation &o) override { for (uint32_t i = 0; i < nodes.size(); ++i) { nodes[i]->select(p, o); } @@ -32,7 +32,7 @@ struct Bar : public Foo DECLARE_IDENTIFIABLE(Bar); Bar() : value(0) {} Bar(int v) { value = v; } - virtual Bar *clone() const override { return new Bar(*this); } + Bar *clone() const override { return new Bar(*this); } }; IMPLEMENT_IDENTIFIABLE(Bar, Identifiable); @@ -40,7 +40,7 @@ struct ObjectType : public ObjectPredicate { uint32_t cid; ObjectType(uint32_t id) : cid(id) {} - virtual bool check(const Identifiable &obj) const override { + bool check(const Identifiable &obj) const override { return (obj.getClass().id() == cid); } }; @@ -48,7 +48,7 @@ struct ObjectType : public ObjectPredicate struct ObjectCollect : public ObjectOperation { std::vector<Identifiable*> nodes; - virtual void execute(Identifiable &obj) override { + void execute(Identifiable &obj) override { nodes.push_back(&obj); } }; diff --git a/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp b/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp index affb7287674..a1c8a31729c 100644 --- a/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp +++ b/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp @@ -1,5 +1,5 @@ // 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/test_kit.h> #include <vespa/vespalib/util/polymorphicarrays.h> @@ -112,7 +112,7 @@ class Factory : public ComplexArrayT<A>::Factory { public: A * create() override { return new Complex(); } - virtual Factory * clone() const override { return new Factory(*this); } + Factory * clone() const override { return new Factory(*this); } }; TEST("require that complex arrays conforms") { diff --git a/staging_vespalib/src/tests/programoptions/programoptions_test.cpp b/staging_vespalib/src/tests/programoptions/programoptions_test.cpp index 881954bfa3f..709f8a3b723 100644 --- a/staging_vespalib/src/tests/programoptions/programoptions_test.cpp +++ b/staging_vespalib/src/tests/programoptions/programoptions_test.cpp @@ -1,14 +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/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/programoptions.h> #include <vespa/vespalib/util/programoptions_testutils.h> - #include <iostream> -#include <vespa/log/log.h> -#include <vespa/vespalib/testkit/testapp.h> - -LOG_SETUP("programoptions_test"); namespace vespalib { diff --git a/staging_vespalib/src/tests/rusage/rusage_test.cpp b/staging_vespalib/src/tests/rusage/rusage_test.cpp index 0367ab8c374..5094bd8b5c9 100644 --- a/staging_vespalib/src/tests/rusage/rusage_test.cpp +++ b/staging_vespalib/src/tests/rusage/rusage_test.cpp @@ -1,8 +1,5 @@ // 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 <stddef.h> -#include <vespa/log/log.h> -LOG_SETUP("alloc_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/rusage.h> diff --git a/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp b/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp index c31e34afe76..45e838ae271 100644 --- a/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp +++ b/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp @@ -1,7 +1,4 @@ // 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("shutdownguard_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/shutdownguard.h> diff --git a/staging_vespalib/src/tests/state_server/state_server_test.cpp b/staging_vespalib/src/tests/state_server/state_server_test.cpp index f572dbcd8e1..e15a3826669 100644 --- a/staging_vespalib/src/tests/state_server/state_server_test.cpp +++ b/staging_vespalib/src/tests/state_server/state_server_test.cpp @@ -1,5 +1,5 @@ // 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/test_kit.h> #include <vespa/vespalib/net/state_server.h> #include <vespa/vespalib/net/simple_health_producer.h> @@ -52,10 +52,8 @@ vespalib::string getFull(int port, const vespalib::string &path) { return getPag struct DummyHandler : JsonGetHandler { vespalib::string result; DummyHandler(const vespalib::string &result_in) : result(result_in) {} - virtual vespalib::string get(const vespalib::string &, - const vespalib::string &, - const std::map<vespalib::string,vespalib::string> &) - const override + vespalib::string get(const vespalib::string &, const vespalib::string &, + const std::map<vespalib::string,vespalib::string> &) const override { return result; } @@ -113,10 +111,8 @@ TEST_FFFF("require that handler is selected based on longest matching url prefix } struct EchoHost : JsonGetHandler { - virtual vespalib::string get(const vespalib::string &host, - const vespalib::string &, - const std::map<vespalib::string,vespalib::string> &) - const override + vespalib::string get(const vespalib::string &host, const vespalib::string &, + const std::map<vespalib::string,vespalib::string> &) const override { return "[\"" + host + "\"]"; } @@ -316,11 +312,11 @@ TEST_FFFFF("require that custom handlers can be added to the state server", } struct EchoConsumer : MetricsProducer { - virtual vespalib::string getMetrics(const vespalib::string &consumer) override { + vespalib::string getMetrics(const vespalib::string &consumer) override { return "[\"" + consumer + "\"]"; } - virtual vespalib::string getTotalMetrics(const vespalib::string &consumer) override { - return "[\"" + consumer + "\"]"; + vespalib::string getTotalMetrics(const vespalib::string &consumer) override { + return "[\"" + consumer + "\"]"; } }; diff --git a/staging_vespalib/src/tests/stllike/avl.cpp b/staging_vespalib/src/tests/stllike/avl.cpp deleted file mode 100644 index 53df03319d7..00000000000 --- a/staging_vespalib/src/tests/stllike/avl.cpp +++ /dev/null @@ -1,265 +0,0 @@ -// 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("memory_test"); -#include <vespa/vespalib/testkit/testapp.h> -#include <vespalib/stllike/avl_set.h> -#include <vespa/vespalib/stllike/avl_map.h> - -using namespace vespalib; -using std::make_pair; - -class Test : public TestApp -{ -public: - int Main(); - void testAvlTreeSet(); - void testAvlTreeSet2(); - void testAvlTreeMap(); - void testAvlTreeFind(); -}; - -int -Test::Main() -{ - TEST_INIT("avl_test"); - testAvlTreeSet(); - testAvlTreeSet2(); - testAvlTreeMap(); - testAvlTreeFind(); - TEST_DONE(); -} - -namespace { - struct Foo { - int i; - - Foo() : i(0) {} - Foo(int i_) : i(i_) {} - - bool operator<(const Foo& f) const - { return (i < f.i); } - friend std::ostream & operator << (std::ostream & os, const Foo & f) { return os << f.i; } - }; -} - -void Test::testAvlTreeSet2() -{ - const size_t testSize(2000); - avl_set<Foo> set(100); - // Verfify start conditions. - EXPECT_TRUE(set.size() == 0); - EXPECT_TRUE(set.begin() == set.end()); - EXPECT_TRUE(set.find(7) == set.end()); - // Insert one element - set.insert(Foo(7)); - EXPECT_TRUE(set.size() == 1); - EXPECT_TRUE(set.begin() != set.end()); - EXPECT_TRUE(set.find(Foo(7)) != set.end()); - EXPECT_TRUE(*set.find(Foo(7)) == Foo(7)); - EXPECT_TRUE(set.find(Foo(8)) == set.end()); - // erase non existing - set.erase(Foo(8)); - EXPECT_TRUE(set.size() == 1); - EXPECT_TRUE(set.begin() != set.end()); - EXPECT_TRUE(set.find(Foo(7)) != set.end()); - EXPECT_TRUE(*set.find(Foo(7)) == Foo(7)); - EXPECT_TRUE(set.find(Foo(8)) == set.end()); - // erase existing - set.erase(Foo(7)); - EXPECT_TRUE(set.size() == 0); - EXPECT_TRUE(set.begin() == set.end()); - EXPECT_TRUE(set.find(Foo(7)) == set.end()); - for (size_t i(0); i < testSize; i++) { - set.insert(Foo(i)); - avl_set<Foo, Foo::avl>::iterator it = set.find(Foo(i)); - ASSERT_TRUE(it != set.end()); - for (size_t j=0; j < i; j++) { - it = set.find(Foo(j)); - ASSERT_TRUE(it != set.end()); - } - } - EXPECT_TRUE(set.size() == testSize); - avl_set<Foo, Foo::avl>::iterator it = set.find(Foo((testSize/2)-1)); - ASSERT_TRUE(it != set.end()); - EXPECT_EQUAL(*it, Foo((testSize/2)-1)); - for (size_t i(0); i < testSize/2; i++) { - set.erase(Foo(i*2)); - } - ASSERT_TRUE(it != set.end()); - EXPECT_EQUAL(*it, Foo((testSize/2)-1)); - EXPECT_TRUE(set.find(Foo(testSize/2)) == set.end()); - EXPECT_TRUE(set.size() == testSize/2); - for (size_t i(0); i < testSize; i++) { - set.insert(Foo(i)); - } - EXPECT_EQUAL(set.size(), testSize); - EXPECT_TRUE(*set.find(Foo(7)) == Foo(7)); - EXPECT_TRUE(*set.find(Foo(0)) == Foo(0)); - EXPECT_TRUE(*set.find(Foo(1)) == Foo(1)); - EXPECT_TRUE(*set.find(Foo(testSize-1)) == Foo(testSize-1)); - EXPECT_TRUE(set.find(Foo(testSize)) == set.end()); - - set.clear(); - - EXPECT_EQUAL(set.size(), 0u); - EXPECT_TRUE(set.find(Foo(7)) == set.end()); -} - -void Test::testAvlTreeSet() -{ - avl_set<int> set(1000); - // Verfify start conditions. - EXPECT_TRUE(set.size() == 0); - EXPECT_TRUE(set.begin() == set.end()); - EXPECT_TRUE(set.find(7) == set.end()); - // Insert one element - set.insert(7); - EXPECT_TRUE(set.size() == 1); - EXPECT_TRUE(set.begin() != set.end()); - EXPECT_TRUE(set.find(7) != set.end()); - EXPECT_TRUE(*set.find(7) == 7); - EXPECT_TRUE(set.find(8) == set.end()); - // erase non existing - set.erase(8); - EXPECT_TRUE(set.size() == 1); - EXPECT_TRUE(set.begin() != set.end()); - EXPECT_TRUE(set.find(7) != set.end()); - EXPECT_TRUE(*set.find(7) == 7); - EXPECT_TRUE(set.find(8) == set.end()); - // erase existing - set.erase(7); - EXPECT_TRUE(set.size() == 0); - EXPECT_TRUE(set.begin() == set.end()); - EXPECT_TRUE(set.find(7) == set.end()); - for (size_t i(0); i < 10000; i++) { - set.insert(i); - } - EXPECT_TRUE(set.size() == 10000); - for (size_t i(0); i < 5000; i++) { - set.erase(i*2); - } - EXPECT_TRUE(*set.find(4999) == 4999); - EXPECT_TRUE(set.find(5000) == set.end()); - EXPECT_TRUE(set.size() == 5000); - for (size_t i(0); i < 10000; i++) { - set.insert(i); - } - EXPECT_EQUAL(set.size(), 10000u); - EXPECT_TRUE(*set.find(7) == 7); - EXPECT_TRUE(*set.find(0) == 0); - EXPECT_TRUE(*set.find(1) == 1); - EXPECT_TRUE(*set.find(9999) == 9999); - EXPECT_TRUE(set.find(10000) == set.end()); - - set.clear(); - - EXPECT_EQUAL(set.size(), 0u); - EXPECT_TRUE(set.find(7) == set.end()); -} - -void Test::testAvlTreeMap() -{ - avl_map<int, int> set(1000); - // Verfify start conditions. - EXPECT_TRUE(set.size() == 0); - EXPECT_TRUE(set.begin() == set.end()); - EXPECT_TRUE(set.find(7) == set.end()); - // Insert one element - set.insert(make_pair(7, 70)); - EXPECT_TRUE(set.size() == 1); - EXPECT_TRUE(set.begin() != set.end()); - EXPECT_TRUE(set.find(7) != set.end()); - EXPECT_TRUE(set.find(7)->first == 7); - EXPECT_TRUE(set.find(7)->second == 70); - EXPECT_TRUE(set.find(8) == set.end()); - // erase non existing - set.erase(8); - EXPECT_TRUE(set.size() == 1); - EXPECT_TRUE(set.begin() != set.end()); - EXPECT_TRUE(set.find(7) != set.end()); - EXPECT_TRUE(set.find(7)->first == 7); - EXPECT_TRUE(set.find(7)->second == 70); - EXPECT_TRUE(set.find(8) == set.end()); - // erase existing - set.erase(7); - EXPECT_TRUE(set.size() == 0); - EXPECT_TRUE(set.begin() == set.end()); - EXPECT_TRUE(set.find(7) == set.end()); - for (size_t i(0); i < 10000; i++) { - set.insert(make_pair(i,i*10)); - } - EXPECT_TRUE(set.size() == 10000); - for (size_t i(0); i < 5000; i++) { - set.erase(i*2); - } - EXPECT_TRUE(set.find(4999)->first == 4999); - EXPECT_TRUE(set.find(4999)->second == 49990); - EXPECT_TRUE(set.find(5000) == set.end()); - EXPECT_TRUE(set.size() == 5000); - for (size_t i(0); i < 10000; i++) { - set.insert(make_pair(i,i*10)); - } - EXPECT_EQUAL(set.size(), 10000u); - EXPECT_TRUE(set.find(7)->first == 7); - EXPECT_TRUE(set.find(7)->second == 70); - EXPECT_TRUE(set.find(0)->first == 0); - EXPECT_TRUE(set.find(0)->second == 0); - EXPECT_TRUE(set.find(1)->first == 1); - EXPECT_TRUE(set.find(1)->second == 10); - EXPECT_TRUE(set.find(9999)->first == 9999); - EXPECT_TRUE(set.find(9999)->second == 99990); - EXPECT_TRUE(set.find(10000) == set.end()); - - avl_map<int, int> set2(7); - set.swap(set2); - EXPECT_EQUAL(set2.size(), 10000u); - EXPECT_TRUE(set2.find(7)->first == 7); - EXPECT_TRUE(set2.find(7)->second == 70); - - EXPECT_EQUAL(set.size(), 0u); - EXPECT_TRUE(set.find(7) == set.end()); - for (int i=0; i < 100; i++) { - set.insert(make_pair(i,i*10)); - } - for (int i=0; i < 100; i++) { - EXPECT_TRUE(set.find(i)->second == i*10); - } - - avl_map<int, int> set3; - set3.insert(set.begin(), set.end()); - for (int i=0; i < 100; i++) { - EXPECT_EQUAL(i*10, set.find(i)->second); - } -} - -class S { -public: - explicit S(uint64_t l=0) : _a(l&0xfffffffful), _b(l>>32) { } - uint32_t avl() const { return _a; } - uint32_t a() const { return _a; } - friend bool operator == (const S & a, const S & b) { return a._a == b._a && a._b == b._b; } -private: - uint32_t _a, _b; -}; - -struct myavl { - size_t operator() (const S & arg) const { return arg.avl(); } -}; - -struct myextract { - uint32_t operator() (const S & arg) const { return arg.a(); } -}; - -void Test::testAvlTreeFind() -{ - avl_set<S, myavl> set(1000); - for (size_t i(0); i < 10000; i++) { - set.insert(S(i)); - } - EXPECT_TRUE(*set.find(S(1)) == S(1)); - avl_set<S, myavl>::iterator cit = set.find<uint32_t, myextract, vespalib::avl<uint32_t>, std::equal_to<uint32_t> >(7); - EXPECT_TRUE(*cit == S(7)); -} - -TEST_APPHOOK(Test) diff --git a/staging_vespalib/src/tests/timer/timer_test.cpp b/staging_vespalib/src/tests/timer/timer_test.cpp index ad782f4089f..21b60b828cc 100644 --- a/staging_vespalib/src/tests/timer/timer_test.cpp +++ b/staging_vespalib/src/tests/timer/timer_test.cpp @@ -1,7 +1,5 @@ // 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("timer_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/timer.h> #include <vespa/vespalib/util/executor.h> diff --git a/staging_vespalib/src/tests/util/process_memory_stats/process_memory_stats_test.cpp b/staging_vespalib/src/tests/util/process_memory_stats/process_memory_stats_test.cpp index 43288d630cf..9d178b850a9 100644 --- a/staging_vespalib/src/tests/util/process_memory_stats/process_memory_stats_test.cpp +++ b/staging_vespalib/src/tests/util/process_memory_stats/process_memory_stats_test.cpp @@ -1,6 +1,5 @@ // 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/test_kit.h> #include <vespa/vespalib/util/process_memory_stats.h> #include <iostream> diff --git a/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp b/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp index 1035c021f68..90fcdb8f94f 100644 --- a/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp +++ b/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp @@ -1,9 +1,7 @@ // 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/util/xmlserializable.h> - #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/xmlserializable.h> namespace vespalib { |